Index
diapason.tools.storage
¶
Storage primitive — persistent searchable storage.
Chunk
dataclass
¶
A single chunk produced by the chunking pipeline.
ChunkConfig
dataclass
¶
Parameters controlling the chunking strategy.
ContextConfig
dataclass
¶
Controls how retrieved context is injected into prompts.
MemoryBackend
¶
Bases: ABC
Base class for all memory / retrieval backends.
Subclasses must be registered via
@MemoryRegistry.register("name") to become discoverable.
clear()
abstractmethod
¶
Remove all stored documents.
delete(doc_id)
abstractmethod
¶
Delete a document by id. Return True if it existed.
retrieve(query, *, top_k=5, **kwargs)
abstractmethod
¶
Search for query and return the top-k results.
store(content, *, source='', metadata=None)
abstractmethod
¶
Persist content and return a unique document id.
RetrievalResult
dataclass
¶
A single result returned by a memory backend query.
chunk_text(text, *, source='', config=None)
¶
ingest_path(path, *, config=None)
¶
Ingest a file or directory into chunks.
If path is a file, reads and chunks it. If path is a directory, recursively walks it (skipping hidden and common non-content directories) and chunks each file.
inject_context(query, messages, backend, *, config=None)
¶
Retrieve relevant context and prepend it to messages.
Returns a new list — the original list is not mutated. If no results pass the score threshold, returns the original messages unchanged.
Parameters¶
query:
The user query to search for.
messages:
The existing message list.
backend:
The memory backend to search.
config:
Context injection settings (uses defaults if None).