ontocast.tool.vector_store.util¶
Backend-agnostic helpers for ontology vector storage.
EmbeddingContractMismatchError
¶
atom_scope_fingerprint(store_config)
¶
Fingerprint fragment for settings that change what gets stored per atom.
Covers both which entities become atoms and which literals become their surface forms and lexical triggers. All of these change the stored payload, so serving an index built under different values silently degrades retrieval instead of raising.
Returns None at the defaults, so collections built under them keep the
fingerprint they already have and need no reindex on upgrade.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_config
|
VectorStoreConfig
|
Active vector-store settings. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: Compact divergence marker, or |
Source code in ontocast/tool/vector_store/util.py
embedding_fingerprint_matches(stored, embedding_config, *, minimal_label_limit=None, atom_scope=None)
¶
Whether stored is the fingerprint the given config would produce.
Takes the same optional components as :func:embedding_model_fingerprint.
Omitting them previously made this disagree with
validate_embedding_contract_metadata for any non-default collection --
it would report a match the validator rejects.
Source code in ontocast/tool/vector_store/util.py
embedding_model_fingerprint(embedding_config, *, minimal_label_limit=None, atom_scope=None)
¶
Identity of the vectors a config produces, stored alongside the collection.
Query/document prefixes belong here: they change the embedded text, so an index
built without them is not comparable to queries issued with them, and the mismatch
would otherwise show up only as quietly degraded retrieval. The sparse surface-form
cap is included for the same reason -- it decides how many of a term's aliases enter
the BM25 text. It contributes only when set to a non-default value, so collections
built under the default keep their existing fingerprint. atom_scope follows the
same rule for settings that decide which entities are atomized at all.
The surface-form contract (sf=) is separate and always contributes: it records
which literals become surface forms and which entities become atoms, both of which
change the stored index even at default settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embedding_config
|
EmbeddingConfig
|
Dense/sparse model configuration. |
required |
minimal_label_limit
|
int | None
|
Sparse surface-form cap, when it differs from the default. |
None
|
atom_scope
|
str | None
|
Atom-scope divergence from :func: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Stable fingerprint stored alongside the collection. |
Source code in ontocast/tool/vector_store/util.py
sync_atomizer_from_store_config(atomizer, store_config)
¶
Mirror vector-store representation settings onto the atomizer.