langchain/libs/partners/couchbase
2024-11-01 20:35:55 +00:00
..
langchain_couchbase couchbase: Add document id to vector search results (#27622) 2024-10-24 21:47:36 +00:00
scripts multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
tests couchbase: Add document id to vector search results (#27622) 2024-10-24 21:47:36 +00:00
.gitignore couchbase: Add the initial version of Couchbase partner package (#22087) 2024-06-07 14:04:08 -07:00
LICENSE couchbase: Add the initial version of Couchbase partner package (#22087) 2024-06-07 14:04:08 -07:00
Makefile standard-tests[patch]: add Ser/Des test 2024-09-04 10:24:06 -07:00
poetry.lock many: use core 0.3.15 (#27834) 2024-11-01 20:35:55 +00:00
pyproject.toml many: use core 0.3.15 (#27834) 2024-11-01 20:35:55 +00:00
README.md couchbase: Add the initial version of Couchbase partner package (#22087) 2024-06-07 14:04:08 -07:00

langchain-couchbase

This package contains the LangChain integration with Couchbase

Installation

pip install -U langchain-couchbase

Usage

The CouchbaseVectorStore class exposes the connection to the Couchbase vector store.

from langchain_couchbase.vectorstores import CouchbaseVectorStore

from couchbase.cluster import Cluster
from couchbase.auth import PasswordAuthenticator
from couchbase.options import ClusterOptions
from datetime import timedelta

auth = PasswordAuthenticator(username, password)
options = ClusterOptions(auth)
connect_string = "couchbases://localhost"
cluster = Cluster(connect_string, options)

# Wait until the cluster is ready for use.
cluster.wait_until_ready(timedelta(seconds=5))

embeddings = OpenAIEmbeddings()

vectorstore = CouchbaseVectorStore(
    cluster=cluster,
    bucket_name="",
    scope_name="",
    collection_name="",
    embedding=embeddings,
    index_name="vector-search-index",
)