DBConfig
The DBConfig class specifies the storage location for the index, with options for in-memory storage or databases.Parameters
The supported location options are:
"rocksdb": Use for persistent, on-disk key-value storage (recommended for embedded/local deployments).
"s3": Use for AWS S3 or any S3-compatible object store (MinIO, Cloudflare R2). Connection string carries the URI and credentials.
"memory": Use for temporary in-memory storage (for benchmarking and evaluation purposes).
"threadsafememory": Use for thread-safe in-memory storage (for multi-threaded benchmarking).
Example Usage
Embeddings
The Embedded LangChain integration accepts any LangChain Embeddings implementation:Supported Embedding Types
Example Usage
DistanceMetric
DistanceMetric is a string representing the distance metric used for the index. Options include:
"cosine": Cosine similarity (recommended for normalized embeddings)
"euclidean": Euclidean distance
"squared_euclidean": Squared Euclidean distance
Metric Characteristics
IndexType
The index type determines the algorithm used for approximate nearest neighbor search.Available Index Types
The default index type for the Embedded library is "ivfsq".
Example Usage
IndexConfigParams
Optional parameters for configuring the index, passed as a dictionary.Parameters by Index Type
IVFFlat
IVFPQ
IVFSQ
Tuning Guidelines
- n_lists: Use √n where n is the expected number of vectors. Common values: 256, 512, 1024, 2048
- pq_dim: Should divide the embedding dimension evenly. Lower values = more compression
- pq_bits / sq_bits: 8 bits provides good balance. Lower = more compression, higher = better accuracy
Document
LangChain Document object used for storing text with metadata.Attributes
Example Usage
Metadata filters use a dictionary format for querying documents.Simple Filters
Advanced Filters
Supported Operators
Return Types
Query Results
Query operations return documents with optional scores:Score Normalization
Scores are normalized to [0, 1] range where:
- 1.0 = Perfect match
- 0.0 = Worst match
The normalization depends on the distance metric used.
Async Support
All methods have async variants prefixed with a:Example Usage
Connection Configuration
The Python SDK connects to a running CyborgDB service instead of using DBConfig for storage locations.DBConfig and GPUConfig are not applicable to the Python SDK. Storage configuration is managed by the CyborgDB service.
Example Usage
Embeddings
The Python SDK supports the same embedding types as the Embedded library:
DistanceMetric
Same as Embedded:
"cosine": Cosine similarity (recommended for normalized embeddings)
"euclidean": Euclidean distance
"squared_euclidean": Squared Euclidean distance
IndexType
Same as Embedded:
Document
LangChain Document object used for storing text with metadata.
Same filter format as Embedded. Metadata filters use a dictionary format:Supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin
Return Types
Same as Embedded:
Async Support
Same async variants as Embedded, prefixed with a:CyborgVectorStoreConfig
Configuration interface for constructing a CyborgVectorStore in JavaScript/TypeScript.All parameters use camelCase convention, consistent with JavaScript/TypeScript standards.
EmbeddingsInterface
The JS/TS SDK accepts any LangChain EmbeddingsInterface implementation:Unlike the Python SDKs, the JS/TS SDK does not accept raw model name strings. You must pass a LangChain EmbeddingsInterface instance.
DistanceMetric
Same options as Python SDKs:
"cosine": Cosine similarity (recommended for normalized embeddings)
"euclidean": Euclidean distance
"squared_euclidean": Squared Euclidean distance
Document
LangChain Document object:
FilterType
Metadata filters use an object format:Supports the same operators as the Python SDKs: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin.
Return Types
Async
All JS/TS methods are natively async and return Promise<...>. There are no separate sync/async variants — every method uses await.