(Optional) SSL verification. When None, automatically disabled for localhost and http:// URLs
dimension
Optional[int]
(Optional) Embedding dimension (auto-inferred if not provided)
metric
str
Distance metric: “cosine”, “euclidean”, or “squared_euclidean” (default: “cosine”)
Returns
CyborgVectorStore: Initialized vector store instance
The Python SDK requires a running CyborgDB service. Use base_url to point to your service endpoint instead of providing a StorageConfig; storage is configured on the service.
Example Usage
from cyborgdb.integrations.langchain import CyborgVectorStore# Generate a secure keyindex_key = CyborgVectorStore.generate_key(save=True)# Initialize with string embedding model namestore = CyborgVectorStore( index_name="my_documents", index_key=index_key, api_key="your-api-key", embedding="sentence-transformers/all-MiniLM-L6-v2", base_url="http://localhost:8000", metric="cosine")
new CyborgVectorStore(embeddings: EmbeddingsInterface, config: CyborgVectorStoreConfig)
Parameters
Parameter
Type
Description
embeddings
EmbeddingsInterface
LangChain embeddings instance
config
CyborgVectorStoreConfig
Configuration object (see below)
CyborgVectorStoreConfig
Parameter
Type
Description
baseUrl
string
Base URL of the CyborgDB microservice endpoint
apiKey
string
API key for CyborgDB authentication
indexName
string
Name of the index (must be unique)
indexKey
Uint8Array
32-byte encryption key for securing index data
dimension
number
(Optional) Embedding dimension (auto-inferred if not provided)
metric
string
(Optional) Distance metric: "cosine", "euclidean", or "squared_euclidean" (default: "cosine")
verifySsl
boolean
(Optional) SSL verification (default: true)
Returns
CyborgVectorStore: Initialized vector store instance
The JS/TS SDK requires a running CyborgDB service. Use baseUrl to point to your service endpoint; storage is configured on the service.
Example Usage
import { CyborgVectorStore } from 'cyborgdb/integrations/langchain';import { OpenAIEmbeddings } from '@langchain/openai';const store = new CyborgVectorStore( new OpenAIEmbeddings(), { baseUrl: "http://localhost:8000", apiKey: "your-api-key", indexName: "my_documents", indexKey: CyborgVectorStore.generateKey(), metric: "cosine" });
Exceptions
RuntimeError
Throws if no embedding model provided and dimension not specified