ontocast.tool.vector_store.factory¶
Factory for vector store backend selection.
Backend modules are imported inside the selected branch rather than at module
scope: importing :mod:ontocast.tool.vector_store.qdrant pulls the Qdrant SDK
(and, through it, gRPC and an ONNX runtime), and OntoCast's base install ships
neither. Only the backend actually configured is loaded.
Classes¶
Functions:¶
create_vector_store_manager(tool_config, embedding, sparse_embedding=None)
¶
Return a vector store manager for the configured backend.
Selection is driven by VectorStoreConfig.backend. The default,
:attr:~ontocast.onto.enum.VectorStoreBackend.AUTO, infers the backend from
whichever connection setting is populated and otherwise resolves to
:attr:~ontocast.onto.enum.VectorStoreBackend.NONE, returning None.
A deployment that configures neither Qdrant nor LanceDB has no vector
retrieval: ontology context comes from a single working ontology, which is
the default :class:~ontocast.onto.enum.OntologyContextMode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_config
|
ToolConfig
|
The resolved tool configuration. |
required |
embedding
|
EmbeddingTool
|
Dense embedding provider. |
required |
sparse_embedding
|
FastembedBm25SparseTool | None
|
BM25 sparse provider, required by both backends. |
None
|
Returns:
| Type | Description |
|---|---|
VectorStoreManager | None
|
A manager for the selected backend, or |
VectorStoreManager | None
|
explicitly disabled. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an explicitly requested backend is not configured, or if
Qdrant's |
Source code in ontocast/tool/vector_store/factory.py
resolve_backend(tool_config)
¶
Resolve AUTO against the populated connection settings.
AUTO falls back to NONE. Vector retrieval is one of three
ontology-context modes and the single-working-ontology mode is the default,
so an unconfigured deployment has never had a vector store; silently giving
every such deployment one would change indexing behaviour and embedding cost
without anyone asking. The two supported backends are Qdrant (server) and
LanceDB (embedded), each shipped as its own optional extra.