feat(embedding): expose model_version on dense and sparse embedder ports
Why: - ADR-0001's Qdrant payload records embedding_model_version so a future model swap can identify which chunks need re-embedding. The embedder is what knows which model produced its vectors, so it reports this rather than the call site reconstructing it from settings. Changes: - DenseEmbedder/SparseEmbedder protocols gain a model_version: str attribute. - OpenAICompatibleEmbedder reports its configured model; Bm25SparseEmbedder reports its analyzer (bm25-<analyzer>).
This commit is contained in:
@@ -19,6 +19,14 @@ class DenseEmbedder(Protocol):
|
||||
"""
|
||||
|
||||
name: str
|
||||
model_version: str
|
||||
"""Identifies the model that produced these vectors (ADR-0001).
|
||||
|
||||
Written into every point's `embedding_model_version` payload field, which
|
||||
exists so a future model swap can tell which chunks need re-embedding. The
|
||||
embedder is what knows this, so it is reported here rather than
|
||||
reconstructed from configuration at the call site.
|
||||
"""
|
||||
|
||||
async def embed_batch(self, texts: Sequence[str]) -> list[list[float]]:
|
||||
"""Return one vector per input text, same order. Raises `EmbedderError`
|
||||
@@ -37,6 +45,12 @@ class SparseEmbedder(Protocol):
|
||||
"""
|
||||
|
||||
name: str
|
||||
model_version: str
|
||||
"""Identifies the analyzer/parameters that produced these vectors.
|
||||
|
||||
Same purpose as `DenseEmbedder.model_version`; for BM25 the "model" is the
|
||||
analyzer choice (ADR-0005), which is equally a re-embedding trigger.
|
||||
"""
|
||||
|
||||
def embed_batch(self, texts: Sequence[str], *, query: bool = False) -> list[SparseVector]:
|
||||
"""Return one sparse vector per input text, same order.
|
||||
|
||||
Reference in New Issue
Block a user