Skip to main content

Module vectors

Module vectors 

Source
Expand description

Vector-store abstractions: describe a collection’s fields, then read and write records through a provider-agnostic trait pair.

Ports the portable core of upstream’s agent_framework._vectors (#8014): VectorStoreField and VectorStoreCollectionDefinition describe a collection’s shape, VectorCollection is one collection’s data plane, and VectorStore is the connection that hands out collections. A provider crate implements the two traits; nothing here talks to a service.

§Divergence: records are serde_json::Value, not a registered model type

Roughly half of upstream’s module is a model layer: a @vector_store_model decorator that registers a Python class, walks its annotations, and generates encoders/decoders between instances of that class and the flat mappings a store wants. Rust needs none of it — a record type derives Serialize/Deserialize and serde already performs that conversion, with the field names checked at compile time rather than at registration time.

So a record here is a serde_json::Value object keyed by field name, exactly as the workflow engine passes payloads, and a caller with a typed struct converts at the boundary with serde_json::to_value / from_value. That keeps both traits object-safe, so a Box<dyn VectorCollection> can be swapped between providers — which a generic-over-record-type trait could not be.

The one piece of upstream’s model layer that is not redundant is the split between a field’s logical name and its storage name, since that is a property of the store rather than of the Rust type. VectorStoreCollectionDefinition::to_storage and VectorStoreCollectionDefinition::from_storage perform that renaming.

Modules§

filters
Portable vector-store filter expressions.

Structs§

DistanceFunction
How similarity between two vectors is measured. Open value wrapper, as IndexKind.
Filter
One field test.
FilterGroup
Several filters combined by a boolean operator.
InMemoryVectorStore
An in-memory VectorStore, for tests and for running a pipeline before a real store is provisioned.
IndexKind
How a vector index is built. Open value wrapper — the constants cover upstream’s list, and any other string a provider understands is accepted.
VectorSearchOptions
Paging and shaping options for a search.
VectorSearchResult
One search hit: the record, and the provider’s score for it.
VectorStoreCollectionDefinition
The shape of one vector-store collection: its fields, and the accessors a provider needs to build requests from them.
VectorStoreField
One field in a vector-store collection.

Enums§

FieldType
What role a field plays in a collection.
FilterExpression
A filter tree: either one field test or a group of them.
FilterGroupOperator
How a FilterGroup’s children combine.
FilterOperator
How one field is tested.

Constants§

MAX_FILTER_DEPTH
Maximum nesting depth of a filter expression.
MAX_FILTER_NODES
Maximum number of nodes (leaves plus groups) in a filter expression.

Traits§

VectorCollection
One collection’s data plane: create/drop, read/write, and search.
VectorStore
A connection to a vector store: lists collections and hands them out.