Vector Stores API
This module provides integrations for vector databases.
Base Vector Index
maticlib.vectorstores.base_index.BaseVectorIndex
Bases: ABC
Abstract base class for all vector store index backends.
Initializes the BaseVectorIndex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embeddings
|
BaseEmbeddings
|
An embeddings provider matching BaseEmbeddings. |
required |
Source code in maticlib/vectorstores/base_index.py
add_segments
abstractmethod
Add a list of text segments to the index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segments
|
List[TextSegment]
|
TextSegments to embed and store. |
required |
delete
abstractmethod
Delete segments from the index by their IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segment_ids
|
List[str]
|
List of segment ID strings to remove. |
required |
similarity_search
abstractmethod
Search the index for the top k most similar segments to the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The natural language search query string. |
required |
k
|
int
|
Number of results to return. |
4
|
filter_dict
|
Optional[Dict[str, Any]]
|
Optional metadata key/value filters. |
None
|
Returns:
| Type | Description |
|---|---|
List[TextSegment]
|
A list of matching TextSegments. |
Source code in maticlib/vectorstores/base_index.py
In-Memory Vector Index
maticlib.vectorstores.in_memory.InMemoryVectorIndex
Bases: BaseVectorIndex
Pure in-memory vector index using Numpy cosine similarity.
Suitable for rapid prototyping and small-scale workloads. Requires numpy.
Initializes the InMemoryVectorIndex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embeddings
|
BaseEmbeddings
|
An embeddings provider matching BaseEmbeddings. |
required |
Raises:
| Type | Description |
|---|---|
MissingDependencyError
|
If numpy is not installed. |
Source code in maticlib/vectorstores/in_memory.py
Chroma Vector Index
maticlib.vectorstores.chroma.ChromaVectorIndex
ChromaVectorIndex(
embeddings,
collection_name="maticlib_collection",
persist_directory=None,
config=None,
)
Bases: BaseVectorIndex
Vector index backed by ChromaDB (ephemeral or persistent).
Initializes the ChromaVectorIndex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embeddings
|
BaseEmbeddings
|
An embeddings provider matching BaseEmbeddings. |
required |
collection_name
|
str
|
Name of the Chroma collection. Default is |
'maticlib_collection'
|
persist_directory
|
Optional[str]
|
If set, uses a PersistentClient saving to this directory. |
None
|
config
|
Optional[VectorIndexConfig]
|
Optional VectorIndexConfig for distance metric settings. |
None
|
Source code in maticlib/vectorstores/chroma.py
Milvus Vector Index
maticlib.vectorstores.milvus.MilvusVectorIndex
MilvusVectorIndex(
embeddings,
collection_name="maticlib_collection",
uri="./milvus_demo.db",
dim=None,
config=None,
)
Bases: BaseVectorIndex
Vector index backed by Milvus (Lite file mode or standalone server).
Initializes the MilvusVectorIndex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embeddings
|
BaseEmbeddings
|
An embeddings provider matching BaseEmbeddings. |
required |
collection_name
|
str
|
Name of the Milvus collection. Default is |
'maticlib_collection'
|
uri
|
str
|
Milvus URI. Use a |
'./milvus_demo.db'
|
dim
|
Optional[int]
|
Embedding dimension. Auto-detected if not provided. |
None
|
config
|
Optional[VectorIndexConfig]
|
Optional VectorIndexConfig for distance metric and strategy. |
None
|
Source code in maticlib/vectorstores/milvus.py
Pinecone Vector Index
maticlib.vectorstores.pinecone.PineconeVectorIndex
Bases: BaseVectorIndex
Vector index backed by Pinecone Cloud.
Initializes the PineconeVectorIndex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embeddings
|
BaseEmbeddings
|
An embeddings provider matching BaseEmbeddings. |
required |
index_name
|
str
|
Name of an existing Pinecone index. |
required |
api_key
|
Optional[str]
|
Pinecone API key. Falls back to |
None
|
config
|
Optional[VectorIndexConfig]
|
Optional VectorIndexConfig for distance metric and strategy. |
None
|
Source code in maticlib/vectorstores/pinecone.py
Qdrant Vector Index
maticlib.vectorstores.qdrant.QdrantVectorIndex
QdrantVectorIndex(
embeddings,
collection_name="maticlib_collection",
location=":memory:",
url=None,
api_key=None,
dim=None,
config=None,
)
Bases: BaseVectorIndex
Vector index backed by Qdrant (in-memory, local, or cloud).
Initializes the QdrantVectorIndex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
embeddings
|
BaseEmbeddings
|
An embeddings provider matching BaseEmbeddings. |
required |
collection_name
|
str
|
Name of the Qdrant collection. Default is |
'maticlib_collection'
|
location
|
str
|
Qdrant storage location. Use |
':memory:'
|
url
|
Optional[str]
|
Optional URL to a remote Qdrant instance (e.g. |
None
|
api_key
|
Optional[str]
|
Optional API key for Qdrant Cloud. |
None
|
dim
|
Optional[int]
|
Embedding dimension. Auto-detected if not provided. |
None
|
config
|
Optional[VectorIndexConfig]
|
Optional VectorIndexConfig for distance metric and strategy. |
None
|
Source code in maticlib/vectorstores/qdrant.py
Schema Vector Index
maticlib.vectorstores.schema_index.SchemaVectorIndex
A specialized wrapper around a VectorIndex for storing and retrieving Database/Table schemas for Text2SQL workflows.
Source code in maticlib/vectorstores/schema_index.py
retrieve_relevant_tables
Search the index for the most relevant tables given a natural language question. Returns a list of DDL strings.