ontocast.onto.sparse¶
Backend-neutral sparse vector representation.
BM25-style sparse embeddings are produced by
:class:~ontocast.tool.vector_store.embedding.FastembedBm25SparseTool and
consumed by whichever vector backend is configured. Modelling them locally --
rather than reusing qdrant_client.http.models.SparseVector -- keeps the
Qdrant SDK off the import path of every module that merely passes a sparse
vector around, and lets the LanceDB and in-memory backends work without it.
Conversion to a backend's own type happens at that backend's boundary; see
:mod:ontocast.tool.vector_store.qdrant.
SparseVector
¶
Bases: BaseModel
A sparse vector as parallel index and value arrays.
Attributes:
| Name | Type | Description |
|---|---|---|
indices |
list[int]
|
Dimension indices carrying a non-zero weight. |
values |
list[float]
|
The weight at each corresponding index. |
Source code in ontocast/onto/sparse.py
dot(other)
¶
Return the dot product with another sparse vector.