Skip to main content
LlamaIndex is a data framework for building LLM applications over external data. It provides tools for ingesting, structuring, and querying data, making it straightforward to connect large language models with diverse data sources. Actian VectorAI DB integrates with LlamaIndex as a vector store through the llama-index-vector-stores-actian-vectorai package. This integration supports all standard LlamaIndex vector store operations, including adding nodes, similarity search, metadata filtering, and both synchronous and asynchronous workflows.

Installation

Install the VectorAI DB vector store integration for LlamaIndex:
pip install llama-index-vector-stores-actian-vectorai
You also need LlamaIndex core and an embedding provider:
pip install llama-index-core llama-index-embeddings-openai

Requirements

Before using this integration, make sure your environment meets the following prerequisites:
  • Python 3.10–3.12
  • A running Actian VectorAI DB instance (default endpoint: localhost:50051)

Quickstart

The ActianVectorAIVectorStore uses a context manager to handle connection lifecycle automatically. Vector configuration is inferred from the first inserted embedding if not specified. The following example creates text nodes with embeddings, stores them in VectorAI DB, and performs a similarity search:
from llama_index.vector_stores.actian_vectorai import ActianVectorAIVectorStore
from llama_index.core.schema import TextNode
from llama_index.core.vector_stores.types import VectorStoreQuery

# Create nodes with embeddings.
nodes = [
    TextNode(text="VectorAI DB supports semantic search.", embedding=[0.1, 0.2, 0.3]),
    TextNode(text="LlamaIndex builds RAG pipelines.", embedding=[0.4, 0.5, 0.6]),
]

with ActianVectorAIVectorStore() as vector_store:
    # Add nodes to the vector store.
    vector_store.add(nodes)

    # Query the vector store with an embedding.
    query = VectorStoreQuery(query_embedding=[0.1, 0.2, 0.3], similarity_top_k=5)
    result = vector_store.query(query)

Connection management

The integration supports several connection patterns for managing client lifecycle. The examples in this section assume you have nodes and query objects as shown in the Quickstart above. Use a context manager for automatic connection handling:
with ActianVectorAIVectorStore(url="localhost:50051") as vector_store:
    vector_store.add(nodes)
    result = vector_store.query(query)

Manual connection

For fine-grained control over connection lifecycle:
vector_store = ActianVectorAIVectorStore()

vector_store.connect()
vector_store.add(nodes)
result = vector_store.query(query)
vector_store.close()

External client

Pass a pre-configured VectorAIClient when you need to share a connection or supply custom client configuration:
from actian_vectorai import VectorAIClient

with VectorAIClient("localhost:50051") as client:
    vector_store = ActianVectorAIVectorStore(client=client)
    vector_store.add(nodes)
    result = vector_store.query(query)
When an external client is provided, url and client_kwargs are ignored. The caller is responsible for managing the client’s lifecycle.

Async operations

All operations have async counterparts for non-blocking workflows. Async methods use AsyncVectorAIClient under the hood. The examples in this section use the same nodes setup as the Quickstart.

Async context manager

Use an async context manager for automatic connection handling:
from llama_index.vector_stores.actian_vectorai import ActianVectorAIVectorStore
from llama_index.core.vector_stores.types import VectorStoreQuery

async with ActianVectorAIVectorStore() as vector_store:
    await vector_store.async_add(nodes)

    query = VectorStoreQuery(query_embedding=[0.1, 0.2, 0.3], similarity_top_k=5)
    result = await vector_store.aquery(query)

    await vector_store.adelete("doc_01")
    await vector_store.aclear()

Async manual connection

For fine-grained control over async connection lifecycle:
vector_store = ActianVectorAIVectorStore()

await vector_store.aconnect()
await vector_store.async_add(nodes)

query = VectorStoreQuery(query_embedding=[0.1, 0.2, 0.3], similarity_top_k=5)
result = await vector_store.aquery(query)
await vector_store.aclose()

Async external client

Pass a pre-configured AsyncVectorAIClient when you need to share an async connection:
from actian_vectorai import AsyncVectorAIClient

async with AsyncVectorAIClient("localhost:50051") as async_client:
    vector_store = ActianVectorAIVectorStore(async_client=async_client)
    await vector_store.async_add(nodes)

    query = VectorStoreQuery(query_embedding=[0.1, 0.2, 0.3], similarity_top_k=5)
    result = await vector_store.aquery(query)
The async_client must be a different instance from the internal async client of a provided sync client.

Deleting data

Remove nodes from the vector store using document IDs, metadata filters, or by clearing the entire collection.

Delete by source document ID

Remove all nodes associated with a source document:
with ActianVectorAIVectorStore() as vector_store:
    vector_store.delete("doc_01")

Delete with metadata filters

Remove nodes matching specific metadata conditions:
from llama_index.core.vector_stores.types import (
    FilterOperator,
    MetadataFilter,
    MetadataFilters,
)

vector_store.delete_nodes(
    filters=MetadataFilters(
        filters=[
            MetadataFilter(
                key="category",
                operator=FilterOperator.IN,
                value=["ai", "energy"],
            ),
        ]
    )
)

Clear collection

Delete the entire collection:
with ActianVectorAIVectorStore() as vector_store:
    vector_store.clear()

Custom vector configuration

Specify explicit vector parameters instead of relying on auto-detection:
from actian_vectorai import VectorParams, Distance

with ActianVectorAIVectorStore(
    url="localhost:50051",
    collection_name="my_collection",
    dense_vector_name="dense_vector",
    dense_vector_params=VectorParams(size=1536, distance=Distance.Cosine),
) as vector_store:
    vector_store.add(nodes)
When dense_vector_params is omitted, vector configuration is inferred from the first inserted embedding and defaults to cosine distance.

Metadata filtering

Metadata filters can be used with query, delete_nodes, and adelete_nodes to narrow results based on payload fields.

Supported filter operators

The following operators are supported for metadata filtering:
OperatorDescription
EQExact match (string or numeric).
NENot equal.
GT / LTNumeric greater/less than.
GTE / LTENumeric greater/less than or equal.
INMatch any value in a list (or comma-separated string).
NINMatch none of the values in a list (or comma-separated string).
TEXT_MATCHCase-sensitive substring/token match.
IS_EMPTYField is absent or null.
Unsupported operators (ANY, ALL, TEXT_MATCH_INSENSITIVE, CONTAINS) raise NotImplementedError.

Filter conditions

AND, OR, and NOT conditions are supported through FilterCondition:
from llama_index.core.vector_stores.types import (
    FilterCondition,
    FilterOperator,
    MetadataFilter,
    MetadataFilters,
    VectorStoreQuery,
)

# AND condition
query = VectorStoreQuery(
    query_embedding=[0.1, 0.2, 0.3],
    similarity_top_k=5,
    filters=MetadataFilters(
        filters=[
            MetadataFilter(
                key="category", operator=FilterOperator.EQ, value="ai"
            ),
            MetadataFilter(
                key="score", operator=FilterOperator.GTE, value=0.7
            ),
        ],
        condition=FilterCondition.AND,
    ),
)

result = vector_store.query(query)

Configuration

The following table lists the parameters you can pass when creating an ActianVectorAIVectorStore instance.
ParameterTypeDefaultDescription
urlstr"localhost:50051"Actian VectorAI DB endpoint (host:port). Ignored when explicit clients are provided.
collection_namestr"llama_index_collection"Collection to use for storing vectors and metadata.
dense_vector_namestr"llama_index_dense_vector"Name of the dense vector field inside the collection.
dense_vector_paramsVectorParams | NoneNoneVector configuration (size, distance metric). Inferred from the first inserted embedding if omitted (defaults to cosine distance).
stores_textboolFalseStore node text in the point payload in addition to metadata.
clear_existing_collectionboolFalseDelete any existing collection with the same name before the first operation.
client_kwargsdict | NoneNoneExtra keyword arguments forwarded to internally created sync/async clients.
collection_kwargsdict | NoneNoneExtra keyword arguments passed to collection creation. Do not include vectors_config; it is derived from dense_vector_name and dense_vector_params.
clientVectorAIClient | NoneNonePre-configured synchronous client. When provided, url and client_kwargs are ignored.
async_clientAsyncVectorAIClient | NoneNonePre-configured asynchronous client. Must be a different instance from the internal async client of a provided client.

API reference

The following table lists all available methods and their async counterparts.
MethodAsync variantDescription
add()async_add()Add nodes to the vector store.
query()aquery()Query the vector store with an embedding.
delete()adelete()Delete nodes by source document ID.
delete_nodes()adelete_nodes()Delete nodes matching metadata filters.
clear()aclear()Delete the entire collection.
connect()aconnect()Manually open a connection.
close()aclose()Manually close a connection.

Limitations

The following limitations apply to the current version of this integration:
  • get_nodes() and aget_nodes() are not implemented (pending scroll API support in the Actian VectorAI client).
  • Only VectorStoreQueryMode.DEFAULT (dense vector search) is supported.

Next steps

Explore related topics to get the most out of VectorAI DB with LlamaIndex:
  • OpenAI embeddings — Configure OpenAI as your embedding provider.
  • LangChain — Use VectorAI DB with the LangChain framework.
  • Search — Understand the underlying vector search operations.
  • Filtering — Apply metadata conditions to narrow search results.