vector
collection.set_embedding_model
Declare the embedding model a vector collection's vectors come from.
strata vector collection set-embedding-modeldb.vectors.set_embedding_model(collection: 'str', model: 'str') -> 'Any'wire vector_set_embedding_model
Records, once, which embedding model produces this collection's vectors. A declaration, not a verification: a stored vector carries no model, so this takes the caller's word for the vectors present; from then on `text` on upsert and query is embedded with this model and no other, and a collection with no recorded model cannot embed `text` at all. A vector supplied directly is not checked against the record - it cannot be - so supplying one remains the caller's statement that the recorded model produced it. Declaring the model a collection already records is a no-op and commits nothing. Declaring a different one is refused with `failed_precondition.engine.embedding_model_mismatch`: the stored vectors came from the recorded model, so create a separate collection for the other one. The current wire response uses the collection-list output with one item.
Successful mutations return an acknowledgement of the outcome: for a state-changing write, the affected target with the mutation effect and commit facts; for mutations that produce a domain result (such as a branch or a promotion outcome), that result object.
To see the complete help for this command, run:
strata vector collection set-embedding-model --helphelp(db.vectors.set_embedding_model)
Example
Declare a collection's embedding model so text can be stored and searched.
strata vector collection create docs 3 --metric cosinecreated collection docs (3 dimensions, cosine)strata vector collection set-embedding-model docs openai:text-embedding-3-small # Declared once; repeating it with the same model is a no-op.updated collection docs: embedding model openai:text-embedding-3-small
_ = db.vectors.create_collection("docs", 3, metric="cosine")db.vectors.set_embedding_model("docs", "openai:text-embedding-3-small").items[0].embedding_model
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| collection | string | yes | Collection name. |
| model | string | yes | The model that produced, and will produce, this collection's vectors. |
| branch | string or null | no | Target branch. Defaults to the executor handle branch. |
| space | string or null | no | Target product space. Defaults to `"default"`. |
Returns
MutationAck
- dataobject
Shared pagination continuation facts.
- typestring
Errors
Recover by code. Retry policy and commit outcome come from the shipped error registry.
| Code | Retry | Commit outcome |
|---|---|---|
| failed_precondition.engine.runtime_closed | never | not_started |
| not_found.engine.branch | never | not_applicable |
| invalid_argument.engine.product_space | never | not_started |
| invalid_argument.engine.vector_collection | never | not_started |
| invalid_argument.engine.vector_key | never | not_started |
| not_found.engine.vector_collection | never | not_applicable |
| invalid_argument.engine.embedding_model | never | not_started |
| failed_precondition.engine.embedding_model_mismatch | never | not_started |