symfonic.knowledge.protocols¶
protocols ¶
Protocol interfaces for the knowledge retrieval layer.
KnowledgeProvider is the single abstract interface that all RAG adapters must satisfy. Implementations can connect to ChromaDB, Pinecone, Qdrant, or any other vector store.
Architecture note: the protocol is @runtime_checkable so that adapters can be validated with isinstance() without requiring explicit inheritance.
KnowledgeProvider ¶
Bases: Protocol
Abstract interface for semantic knowledge retrieval (RAG).
Concrete implementations connect to vector databases (ChromaDB, Pinecone, Qdrant, etc.) and return scored knowledge fragments.
All methods are async. Synchronous backends must wrap blocking calls
with asyncio.to_thread.
collection_info
async
¶
Return metadata about the connected collection.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict with at least |
search
async
¶
Search for knowledge fragments matching the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Natural language search query. |
required |
limit
|
int
|
Maximum number of fragments to return. |
3
|
Returns:
| Type | Description |
|---|---|
list[KnowledgeFragment]
|
List of KnowledgeFragment sorted by descending score. |