jeevesagent.memory.redis_facts¶
Redis-backed bi-temporal fact store.
Each fact lives in a Redis hash at {prefix}{id} (default prefix
jeeves:fact:). Fields:
id/subject/predicate/object— stringsconfidence— string-encoded floatvalid_from_ts/recorded_at_ts— string-encoded floatsvalid_until_ts— string-encoded float ("0"when still valid)currently_valid—b"1"/b"0"flag (mirror ofvalid_until_ts == 0)sources— JSON-encoded list of episode idsembedding— float32 BLOB (only present when an embedder is configured)
Supersession is a brute-force scan: SCAN for all fact keys, find
those with matching subject + predicate that are currently valid and
have a different object, and HSET each to flip
currently_valid=False + stamp valid_until_ts. RediSearch with
HNSW + numeric/tag indexes is a follow-up.
Attributes¶
Classes¶
Bi-temporal fact store over plain Redis hashes. |
Module Contents¶
- class jeevesagent.memory.redis_facts.RedisFactStore(client: Any, *, embedder: jeevesagent.core.protocols.Embedder | None = None, key_prefix: str = DEFAULT_KEY_PREFIX)[source]¶
Bi-temporal fact store over plain Redis hashes.
- async all_facts() list[jeevesagent.core.types.Fact][source]¶
- async append(fact: jeevesagent.core.types.Fact) str[source]¶
- classmethod connect(url: str = 'redis://localhost:6379/0', *, embedder: jeevesagent.core.protocols.Embedder | None = None, key_prefix: str = DEFAULT_KEY_PREFIX) RedisFactStore[source]¶
- Async:
- async query(*, subject: str | None = None, predicate: str | None = None, object_: str | None = None, valid_at: datetime.datetime | None = None, limit: int = 10, user_id: str | None = None) list[jeevesagent.core.types.Fact][source]¶
- async recall_text(query: str, *, limit: int = 5, valid_at: datetime.datetime | None = None, user_id: str | None = None) list[jeevesagent.core.types.Fact][source]¶
- property embedder: jeevesagent.core.protocols.Embedder¶
- jeevesagent.memory.redis_facts.DEFAULT_KEY_PREFIX = 'jeeves:fact:'¶