ChromaVectorDB
Comprehensive Chroma Vector Database interface for Haystack integration with support for cloud deployments, local persistent storage, and ephemeral in-memory storage.Constructor
str
Chroma server hostname for HttpClient connections
int
Chroma server port number (default: 8000)
str
API key for authenticated Chroma instances
str
Tenant name for multi-tenant mode (default: “default_tenant”)
str
Database name within tenant (default: “default_database”)
str
Local storage path for PersistentClient (default: ”./chroma”)
bool
default:"True"
Use persistent storage when no host provided
str
Default collection name for operations
Dict[str, Any]
Direct configuration dictionary to load settings from
str
Path to YAML configuration file
Any
Additional parameters including ssl, tracing_project_name
Methods
create_collection
Create a new collection in the Chroma database.str
required
Unique identifier for the collection
CollectionConfiguration
Collection-specific configuration object
CollectionMetadata
Metadata to associate with the collection
EmbeddingFunction
Function to generate embeddings. Uses DefaultEmbeddingFunction if not provided
bool
default:"True"
If True, retrieves existing collection if it exists. If False, raises error if collection exists
upsert
Insert or update documents in the current collection.Union[List[Any], Dict[str, Any]]
required
Either a list of Haystack Documents or a dictionary with keys: ids, documents/texts, metadatas, embeddings
query
Query the collection for similar vectors.list[float]
Vector embedding to search for
str
Raw text to embed and search for
int
default:"10"
Maximum number of results to return
dict[str, Any]
Metadata filter conditions (Chroma filter syntax)
dict[str, Any]
Document content filter conditions
List[str]
List of fields to include in results. Defaults to [“metadatas”, “documents”, “distances”]
bool
default:"False"
Whether to include embeddings in results
List[str]
List of document IDs
List[str]
List of document contents
List[dict]
List of metadata dictionaries
List[float]
List of distance scores
List[List[float]]
List of vectors (if include_vectors=True)
delete_collection
Delete a collection from the Chroma database.str
Name of collection to delete. Uses default collection_name if not provided
flatten_metadata
Recursively flatten nested metadata for Chroma compatibility.Dict[str, Any]
required
Dictionary potentially containing nested dictionaries, lists, or complex types
Dict[str, Any]
Flattened dictionary compatible with Chroma metadata storage. Nested keys use dot notation (e.g., “parent.child.key”)
MilvusVectorDB
Interface for interacting with Milvus/Zilliz vector databases with support for dense vectors, sparse vectors, and hybrid search.Constructor
str
default:"http://localhost:19530"
Milvus server URI. Use “http://localhost:19530” for local Milvus or “https://…” for Zilliz Cloud endpoints
str
default:""
API token for Zilliz Cloud authentication. Leave empty for local Milvus or when using no authentication
str
Deprecated. Use uri instead. Maintained for backward compatibility
str
Deprecated. Use uri instead. Maintained for backward compatibility
str
Default collection name for operations. Can be overridden per-method
Methods
create_collection
Create a Milvus collection with comprehensive schema for document storage.str
required
Unique name for the collection
int
required
Dimensionality of dense embedding vectors. Must match the embedding model used (e.g., 768 for most transformer models)
str
default:""
Human-readable description of the collection’s purpose
bool
default:"False"
Whether to include a sparse vector field for hybrid search. Adds storage overhead but enables keyword matching alongside semantic search
bool
default:"False"
Whether to enable physical data partitioning. Enables efficient multi-tenancy by isolating data at the partition level
str
default:"namespace"
Name of the partition key field. Documents with the same partition key value are routed to the same physical partition
bool
default:"False"
If True, drops existing collection with the same name before creating new one. Use with caution in production
search
Perform semantic search with support for dense, sparse, or hybrid retrieval.List[float]
Dense query vector for semantic search. Typically from a text embedding model (e.g., 768-dim)
Union[Dict[int, float], SparseEmbedding]
Sparse query vector for keyword search. Can be Dict[int, float] mapping term IDs to weights, or Haystack SparseEmbedding
int
default:"10"
Maximum number of results to return
str
Target collection. Uses default from constructor if None
Dict[str, Any]
Metadata filter conditions as nested dict. Supports operators: gt/in (list membership), $contains (JSON contains)
str
Unified tenant/partition identifier. Preferred over ‘namespace’ as it clearly conveys the isolation concept
str
Legacy alias for scope. Partition key value for data isolation. Only used if scope is not provided
str
default:"namespace"
Name of the partition key field in schema. Used to construct partition filter expressions
str
default:"rrf"
Reranking strategy for hybrid search. “rrf” uses Reciprocal Rank Fusion (k=60 constant). “weighted” uses explicit weights
List[float]
Two-element list [dense_weight, sparse_weight] for weighted ranker. Only used when ranker_type=“weighted”. Defaults to [0.5, 0.5]
bool
default:"False"
If True, includes embedding vectors in returned Documents. Increases response size but useful for downstream processing
List[Document]
List of Haystack Document objects ordered by relevance score (descending). Documents include content, metadata, score, and optionally embeddings
PineconeVectorDB
Production-ready interface for Pinecone vector database operations with support for hybrid search and multi-tenancy.Constructor
str
Pinecone API key for authentication
str
Name of the Pinecone index to operate on
Dict[str, Any]
Direct configuration dictionary
str
Path to YAML configuration file
Any
Additional connection parameters (host, proxy_url, ssl_verify, pool_threads)
Methods
create_index
Create a new Pinecone index or ensure an existing one is ready.int
required
Dimensionality of the vectors. Required for new indexes
str
default:"cosine"
Distance metric for similarity calculations. Options: “cosine”, “euclidean”, “dotproduct”
Union[Dict[str, Any], ServerlessSpec]
ServerlessSpec or dict defining cloud provider and region. Defaults to AWS us-east-1 serverless if not provided
bool
default:"False"
If True, delete existing index before creating new one
str
Override the index name from init for this operation
query
Query the index for similar vectors.List[float]
required
Query dense embedding vector
int
default:"10"
Number of results to return
Dict[str, Any]
Metadata filters to apply
str
default:""
Namespace to search in (legacy parameter)
str
Unified scope/namespace parameter (preferred over namespace)
bool
default:"True"
Whether to include metadata in results
bool
default:"False"
Whether to include vector values in results (legacy parameter)
bool
default:"False"
Whether to include vector values in results (preferred parameter)
List[Document]
List of Haystack Documents with content, metadata, and optional embeddings
flatten_metadata
Transform nested metadata into Pinecone-compatible flat structure.Dict[str, Any]
required
Potentially nested dictionary with arbitrary values
Dict[str, Any]
Flat dictionary with only Pinecone-supported types. Nested dictionaries use underscore notation (e.g., user.id becomes user_id)