Imemorymanager¶
Classes¶
- class arshai.core.interfaces.imemorymanager.ConversationMemoryType(value)[source]¶
Bases:
StrEnum- SHORT_TERM_MEMORY = 'SHORT_TERM_MEMORY'¶
- LONG_TERM_MEMORY = 'LONG_TERM_MEMORY'¶
- WORKING_MEMORY = 'WORKING_MEMORY'¶
- class arshai.core.interfaces.imemorymanager.IMemoryConfig(**data)[source]¶
Bases:
IDTOConfiguration for memory systems.
This class represents configuration settings for different memory types such as working memory, short-term memory, and long-term memory.
- model_config: ClassVar[ConfigDict] = {'allow_mutation': False, 'arbitrary_types_allowed': True, 'smart_union': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class arshai.core.interfaces.imemorymanager.IMemoryInput(**data)[source]¶
Bases:
IDTORepresents the input for memory operations.
- conversation_id¶
Unique identifier for the conversation
- memory_type¶
Type of memory to operate on
- data¶
Memory data for store/update operations
- query¶
Search query for retrieve operations
- memory_id¶
Specific memory ID for update/delete operations
- limit¶
Maximum number of items to retrieve
- filters¶
Additional filters to apply
- metadata¶
Additional metadata for the memory entry
-
memory_type:
ConversationMemoryType¶
-
data:
Optional[List[IWorkingMemory]]¶
- model_config: ClassVar[ConfigDict] = {'allow_mutation': False, 'arbitrary_types_allowed': True, 'smart_union': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class arshai.core.interfaces.imemorymanager.IMemoryItem(**data)[source]¶
Bases:
IDTORepresents a single item in conversation memory.
This class represents a message or other item stored in conversation memory, with metadata about the item.
- model_config: ClassVar[ConfigDict] = {'allow_mutation': False, 'arbitrary_types_allowed': True, 'smart_union': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class arshai.core.interfaces.imemorymanager.IMemoryManager(*args, **kwargs)[source]¶
Bases:
ProtocolUniversal interface for memory management systems. Provides a unified approach to handling different types of memory: - Short-term memory: Recent conversations and temporary information - Long-term memory: Persistent knowledge and important information - Context management: Current conversation state and context
Implementations can choose to implement all or specific memory management features.
- store(input)[source]¶
Universal method to store any type of memory data.
- Parameters:
input (
IMemoryInput) – IMemoryInput containing data and metadata for storage- Returns:
Unique identifier for the stored memory
- Return type:
- retrieve(input)[source]¶
Universal method to retrieve any type of memory data.
- Parameters:
input (
IMemoryInput) – IMemoryInput containing query and retrieval parameters- Returns:
Matching memory entries
- Return type:
List[IWorkingMemory]
- update(input)[source]¶
Universal method to update any type of memory data.
- Parameters:
input (
IMemoryInput) – IMemoryInput containing memory ID and update data- Return type:
- delete(input)[source]¶
Universal method to delete memory data.
- Parameters:
input (
IMemoryInput) – IMemoryInput containing memory ID or deletion criteria- Return type:
- __init__(*args, **kwargs)¶
- class arshai.core.interfaces.imemorymanager.IWorkingMemory(**data)[source]¶
Bases:
IDTOMaintains the assistant’s working memory during conversations.
Contains a single structured string field that encompasses all Working Memory components in a format optimized for LLM understanding and processing.
- classmethod initialize_memory()[source]¶
Create a new working memory state with initial values
- Return type:
- classmethod from_dict(data)[source]¶
Create working memory state from stored dictionary format
- Return type:
- model_config: ClassVar[ConfigDict] = {'allow_mutation': False, 'arbitrary_types_allowed': True, 'smart_union': True, 'validate_assignment': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].