agentic_vector library

Vector storage and similarity search for the agentic framework.

One VectorStore port, an exact in-process implementation, a Qdrant adapter, and the glue that turns an embedding model plus a store into something you hand text to.

import 'package:agentic_vector/agentic_vector.dart';

final index = EmbeddingIndex(
  model: OpenAiCompatibleEmbeddingModel.openAi(apiKey: key),
  store: InMemoryVectorStore(dimensions: 1536),
);

await index.addText(
  'Dart 3 added exhaustive pattern matching.',
  id: 'dart-3-patterns',
  metadata: {'topic': 'language'},
);

final hits = await index.query(
  'How do I match on a sealed type?',
  filter: MetadataFilter.equals('topic', 'language'),
  topK: 3,
);

Writing another backend is a class implementing VectorStore in your own package; nothing here needs to change. The MetadataFilter hierarchy is sealed on purpose, so the compiler tells you what your adapter has not translated yet.

Classes

AndFilter
Matches records satisfying every child filter.
DelegatingVectorStore
Forwards every call to another store.
EmbeddingIndex
Embeds text and stores it, and answers questions with text.
EqualsFilter
Matches an exact value.
ExistsFilter
Matches records where a field is present.
GreaterThanFilter
Matches numbers above a bound.
InFilter
Matches membership of a set.
InMemoryVectorStore
Holds vectors in memory and scans them exhaustively.
LessThanFilter
Matches numbers below a bound.
MetadataFilter
A predicate over a record's metadata.
NamespacedVectorStore
Pins every operation to one namespace.
NotEqualsFilter
Matches anything but an exact value.
NotFilter
Matches records the child filter rejects.
ObservableVectorStore
Traces, logs and publishes events around every operation.
OrFilter
Matches records satisfying at least one child filter.
QdrantVectorStore
Talks to a Qdrant instance over its REST API.
VectorDeleteCompleted
Records were removed.
VectorEvent
Base for every vector-store event.
VectorMatch
One search result.
VectorOperationFailed
A store operation failed.
VectorQuery
A search request.
VectorRecord
One stored vector and the payload travelling with it.
VectorSearchCompleted
A search finished.
VectorStore
Stores vectors and finds the nearest ones.
VectorStoreInfo
What a store is and what it can do.
VectorUpsertCompleted
Records were written to a store.

Enums

SimilarityMetric
The comparison function a store uses.

Extensions

VectorStoreOperations on VectorStore
Conveniences available on every VectorStore.

Constants

kDefaultNamespace → const String
The key used for records stored without an explicit namespace.
kQdrantIdKey → const String
Payload key holding the caller's identifier.
kQdrantTextKey → const String
Payload key holding VectorRecord.text.

Functions

cosineSimilarity(List<double> a, List<double> b) double
Cosine similarity of a and b, from -1 to 1.
dotProduct(List<double> a, List<double> b) double
Dot product of a and b.
euclideanDistance(List<double> a, List<double> b) double
Euclidean distance between a and b.
normalise(List<double> vector) Float64List
Returns vector scaled to unit length.