Skip to main content

Crate entelix_memory

Crate entelix_memory 

Source
Expand description

§entelix-memory

Tier-3 cross-thread persistent knowledge. Defines Store<V>, Namespace (mandatory tenant_id — invariant 11 / F2 mitigation), the Embedder / Retriever / VectorStore traits, and the five LangChain-style patterns: BufferMemory, SummaryMemory, EntityMemory, SemanticMemory<E, V>, EpisodicMemory<V>. Concrete Embedder / VectorStore / Retriever impls ship in companion crates .

Structs§

BufferMemory
Bounded conversation buffer.
ConsolidatingBufferMemory
Layered memory: a BufferMemory for recent turns, a SummaryMemory for the running summary, and a Summarizer that bridges the two when the buffer’s policy fires.
ConsolidationContext
Inputs that a ConsolidationPolicy consults when deciding whether to consolidate. Carries the buffer plus optional signals (last-consolidated-at, current/available context tokens) so non-trivial policies — for example, “summarise once we use 80 % of the model’s context window” or “throttle consolidation to at most once per hour” — can express their decision without embedding their own clock or token counter.
CostCalculatorAdapter
Adapter that bridges any CostCalculator (ChatModel pricing source) into the EmbeddingCostCalculator surface.
Document
One retrieved document with optional similarity score.
EdgeId
Stable, opaque edge identifier minted by the backend.
Embedding
One embedded text’s vector plus optional usage metadata.
EmbeddingRetriever
Adapter that combines an Embedder and a VectorStore (scoped to one Namespace) into a Retriever.
EmbeddingUsage
Token-accounting metadata an Embedder reports alongside the computed vector. Mirrors the ChatModel Usage shape so cost meters can charge embedding calls with the same machinery they use for completions.
EntityMemory
Map of entity_name → EntityRecord keyed by namespace.
EntityRecord
One entity’s recorded fact plus provenance metadata.
Episode
One time-stamped episode of operator-shaped payload.
EpisodeId
Stable identifier for one episode. Backed by UUID v7 so two ids minted in order compare in the same order — the audit trail and external correlation paths stay consistent without a separate sequence column.
EpisodicMemory
Time-ordered append-only episode store keyed by Namespace.
GraphHop
One traversal hop produced by GraphMemory::traverse or GraphMemory::find_path.
IdentityReranker
No-op Reranker: returns the first top_k candidates in the order the underlying VectorStore produced them, copying the retrieval score into RerankedDocument::rerank_score so downstream consumers see a uniform shape.
InMemoryGraphMemory
In-process GraphMemory backed by BTreeMap adjacency lists, sharded per namespace.
InMemoryStore
In-process Store<V> backed by a HashMap keyed by (rendered_namespace, key). Cheap to clone — internal state is Arc<Mutex<...>>-shared.
InMemoryVectorStore
In-process VectorStore backed by a per-namespace Vec<Slot>.
MeteredEmbedder
Embedder decorator that emits OTel-compatible telemetry per call (and optional cost via EmbeddingCostCalculator).
MmrReranker
Maximal Marginal Relevance reranker.
Namespace
Hierarchical key prefix for memory operations.
NamespacePrefix
Hierarchical prefix used by crate::Store::list_namespaces.
NeverConsolidate
Never trigger. Useful as a default when consolidation is wired but the operator wants to disable it temporarily without rebuilding the agent graph.
NodeId
Stable, opaque node identifier minted by the backend.
OnMessageCount
Trigger consolidation once the buffer reaches max_messages.
OnTokenBudget
Trigger consolidation when the buffer’s total text length (summed UTF-8 byte length of every ContentPart::Text) exceeds max_bytes. Approximates a token-budget gate without needing a tokenizer in the SDK.
PolicyExtras
Optional signals fed into BufferMemory::should_consolidate_with. Operators that don’t track tokens or last-consolidated time can pass Self::default and the policy will see the buffer plus whatever the buffer itself tracks via BufferMemory::mark_consolidated.
PutOptions
Per-write knobs the operator may attach when calling Store::put_with_options. Default::default() corresponds to the simple Store::put path: no TTL, no extra metadata.
RerankedDocument
One reranked document paired with the score the Reranker assigned.
RetrievalQuery
Declarative description of one retrieval call.
SemanticMemory
Embedder + VectorStore + Namespace bundle.
SummaryMemory
Single-string summary keyed by Namespace.

Enums§

Direction
Direction of edge traversal — outgoing edges leave a node, incoming edges arrive at it. Both returns the union.
VectorFilter
Predicate against Document::metadata used by VectorStore::search_filtered. Backends translate this into their native filter language (pgvector WHERE, qdrant Filter, lancedb where); backends that cannot honour a given variant fall back to filterless search and emit a LossyEncode-style warning at the operator layer.

Traits§

ConsolidationPolicy
Decides whether the current buffered conversation should be consolidated.
Embedder
Text → vector encoder.
EmbeddingCostCalculator
Compute a monetary cost for one embedder call.
GraphMemory
Generic graph-of-knowledge memory. Trait so backends (Neo4j, ArangoDB, Postgres-with-recursive-CTE) can plug in without touching the consumer code; reference in-process impl is InMemoryGraphMemory.
Reranker
Re-rank a candidate document set against the originating query.
Retriever
Returns documents ranked by relevance to a RetrievalQuery.
SemanticMemoryBackend
Object-safe consumer trait — tier 3 of the semantic-memory layering documented at the module level. Consumers (tools, orchestration code, recipes) take Arc<dyn SemanticMemoryBackend> to operate on a namespace-scoped embed-and-search surface without parameterising over the concrete embedder / vector-store types.
Store
Persistent (or in-memory) key/value store, scoped by Namespace.
Summarizer
Reduces a buffer of conversation messages to a summary string.
VectorStore
Vector index keyed by Namespace. Backed by qdrant, lancedb, pgvector, etc. in companion crates.

Functions§

first_non_finite_vector_value
Return the first non-finite vector element, if any.
validate_vector_shape
Validate vector dimension and finite values for vector-store calls.

Type Aliases§

DocumentId
Stable identifier for an indexed document. Backends mint these at insertion time; passing the same id to VectorStore::update or VectorStore::delete is the canonical way to mutate or remove a previously-indexed document.