CyborgVectorStore class, which conforms to the VectorStore interface from langchain-core.
Installation
- Embedded
- Python SDK
- JS/TS
Install
cyborgdb-core with the langchain extra (Python 3.10 or newer; the python3 that ships with macOS is 3.9):Import
- Embedded
- Python SDK
- JS/TS
Key Features
- Full VectorStore API compatibility (
add_texts,similarity_search, etc.) - Async operations support
- Configurable distance metrics (
cosine,euclidean,squared_euclidean) - Document ID tracking and management
- Max marginal relevance search
- Factory methods (
from_texts,from_documents) for quick setup
Key Classes
CyborgVectorStore
Implements the LangChain-compatible vector store interface. Supports:
.add_texts()/.add_documents().similarity_search()/.similarity_search_with_score().max_marginal_relevance_search().get()/.list_ids()/.delete().as_retriever()for use in LangChain chains- Async variants (
.aadd_texts(),.asimilarity_search(), etc.) - Reversible document ID tracking
- Configurable distance metric (
cosine,euclidean,squared_euclidean)
StorageConfig (Embedded only)
Configuration object for defining where index data is stored, built with StorageConfig.disk(path) or StorageConfig.s3(bucket, ...). Used only with the Embedded library (cyborgdb-core).
Quick Start
- Embedded
- Python SDK
- JS/TS
index_key and construct CyborgVectorStore(index_name="langchain_index", index_key=index_key, api_key="", embedding="all-MiniLM-L6-v2", storage_config=...) directly: it reopens an existing index instead of creating one.To embed with OpenAI instead of the built-in model, install langchain-openai (it is not part of the langchain extra), set OPENAI_API_KEY, and pass embedding=OpenAIEmbeddings():generate_key(save=True) exists in the Python SDK only. The embedded library’s generate_key() returns the bytes and nothing else, so persist the key yourself as shown above.