jeevesagent.memory.chroma¶
Memory backed by Chroma (local persistent or in-memory client).
Chroma’s Python API is sync; we dispatch every blocking call to a
worker thread via anyio.to_thread.run_sync() so the event loop
stays free.
Working blocks are kept in process memory (small, re-derivable);
episodes go to Chroma. The collection is created lazily on first use
and — if a persist_directory was supplied — survives process
restarts.
Attributes¶
Classes¶
Memory backed by |
Module Contents¶
- class jeevesagent.memory.chroma.ChromaMemory(client: Any, *, embedder: jeevesagent.core.protocols.Embedder | None = None, collection_name: str = DEFAULT_COLLECTION, fact_store: Any | None = None)[source]¶
Memory backed by
chromadb.Construct via
local()for an on-disk persistent client orephemeral()for a process-local in-memory client.- classmethod ephemeral(*, embedder: jeevesagent.core.protocols.Embedder | None = None, collection_name: str = DEFAULT_COLLECTION, with_facts: bool = False, facts_collection_name: str = 'jeeves_facts') ChromaMemory[source]¶
In-memory client (lost on process exit). Great for tests.
- classmethod local(persist_directory: str, *, embedder: jeevesagent.core.protocols.Embedder | None = None, collection_name: str = DEFAULT_COLLECTION, with_facts: bool = False, facts_collection_name: str = 'jeeves_facts') ChromaMemory[source]¶
Persistent on-disk client at
persist_directory.with_facts=Trueattaches aChromaFactStorerooted at the same client so facts persist alongside episodes in the same on-disk store.
- async recall(query: str, *, kind: str = 'episodic', limit: int = 5, time_range: tuple[datetime.datetime, datetime.datetime] | None = None, user_id: str | None = None) list[jeevesagent.core.types.Episode][source]¶
- async recall_facts(query: str, *, limit: int = 5, valid_at: datetime.datetime | None = None, user_id: str | None = None) list[jeevesagent.core.types.Fact][source]¶
- async remember(episode: jeevesagent.core.types.Episode) str[source]¶
- async session_messages(session_id: str, *, user_id: str | None = None, limit: int = 20) list[jeevesagent.core.types.Message][source]¶
- async working() list[jeevesagent.core.types.MemoryBlock][source]¶
- jeevesagent.memory.chroma.DEFAULT_COLLECTION = 'jeeves_episodes'¶