Initializes a new CyborgVectorStore instance for use with LangChain.
CyborgVectorStore(
    index_name: str,
    index_key: bytes,
    api_key: str,
    embedding: Union[str, Embeddings, SentenceTransformer],
    index_location: DBConfig,
    config_location: DBConfig,
    items_location: Optional[DBConfig] = None,
    index_type: str = "ivfflat",
    index_config_params: Optional[Dict[str, Any]] = None,
    dimension: Optional[int] = None,
    metric: str = "cosine"
)

Parameters

ParameterTypeDescription
index_namestrName of the index (must be unique)
index_keybytes32-byte encryption key for securing index data
api_keystrAPI key for CyborgDB authentication
embeddingUnion[str, Embeddings, SentenceTransformer]Embedding model name or instance
index_locationDBConfigConfiguration for index data storage location
config_locationDBConfigConfiguration for index config storage location
items_locationOptional[DBConfig](Optional) Location for item data storage (default: memory)
index_typestrType of index: “ivfflat”, “ivf”, or “ivfpq” (default: “ivfflat”)
index_config_paramsOptional[Dict[str, Any]](Optional) Additional index configuration parameters
dimensionOptional[int](Optional) Embedding dimension (auto-inferred if not provided)
metricstrDistance metric: “cosine”, “euclidean”, or “squared_euclidean” (default: “cosine”)

Returns

CyborgVectorStore: Initialized vector store instance

Exceptions

Example Usage

from cyborgdb_core.langchain import CyborgVectorStore
from cyborgdb_core import DBConfig

# Generate a secure key
index_key = CyborgVectorStore.generate_key()

# Initialize with string embedding model name
store = CyborgVectorStore(
    index_name="my_documents",
    index_key=index_key,
    api_key="your-api-key",
    embedding="sentence-transformers/all-MiniLM-L6-v2",
    index_location=DBConfig("s3", bucket="my-bucket"),
    config_location=DBConfig("s3", bucket="my-bucket"),
    index_type="ivfflat",
    metric="cosine"
)