praval.memory.long_term_memory๏ƒ

Long-term vector memory using Qdrant for Praval agents

This provides persistent, vector-based storage for: - Semantic knowledge and concepts - Long-term conversation history - Learned patterns and insights - Cross-session memory persistence

Classes

LongTermMemory([qdrant_url,ย ...])

Qdrant-based long-term memory for persistent vector storage

class praval.memory.long_term_memory.LongTermMemory(qdrant_url='http://localhost:6333', collection_name='praval_memories', vector_size=1536, distance_metric='cosine')[source]๏ƒ

Bases: object

Qdrant-based long-term memory for persistent vector storage

Features: - Vector similarity search - Persistent storage across sessions - Scalable to millions of memories - Semantic search capabilities - Memory importance scoring

Parameters:
  • qdrant_url (str)

  • collection_name (str)

  • vector_size (int)

  • distance_metric (str)

__init__(qdrant_url='http://localhost:6333', collection_name='praval_memories', vector_size=1536, distance_metric='cosine')[source]๏ƒ

Initialize long-term memory

Parameters:
  • qdrant_url (str) โ€“ URL to Qdrant instance

  • collection_name (str) โ€“ Name of the collection to use

  • vector_size (int) โ€“ Size of embedding vectors

  • distance_metric (str) โ€“ Distance metric for similarity search

store(memory)[source]๏ƒ

Store a memory entry with vector embedding

Parameters:

memory (MemoryEntry) โ€“ The memory entry to store

Return type:

str

Returns:

The ID of the stored memory

retrieve(memory_id)[source]๏ƒ

Retrieve a specific memory by ID

Parameters:

memory_id (str) โ€“ The ID of the memory to retrieve

Return type:

Optional[MemoryEntry]

Returns:

The memory entry if found, None otherwise

search(query)[source]๏ƒ

Search memories using vector similarity

Parameters:

query (MemoryQuery) โ€“ The search query

Return type:

MemorySearchResult

Returns:

Search results with matching memories

delete(memory_id)[source]๏ƒ

Delete a memory entry

Parameters:

memory_id (str) โ€“ The ID of the memory to delete

Return type:

bool

Returns:

True if deleted successfully, False otherwise

clear_agent_memories(agent_id)[source]๏ƒ

Clear all memories for a specific agent

Parameters:

agent_id (str)

get_stats()[source]๏ƒ

Get memory statistics

Return type:

Dict[str, Any]

health_check()[source]๏ƒ

Check if Qdrant connection is healthy

Return type:

bool