You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/partners/couchbase
Nithish Raghunandanan 1639ccfd15
couchbase: [patch] Return chat message history in order (#24498)
**Description:** Fixes an issue where the chat message history was not
returned in order. Fixed it now by returning based on timestamps.

- [x] **Add tests and docs**: Updated the tests to check the order
1. a test for the integration, preferably unit tests that do not rely on
network access,
2. an example notebook showing its use. It lives in
`docs/docs/integrations` directory.


- [x] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

---------

Co-authored-by: Nithish Raghunandanan <nithishr@users.noreply.github.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
2 months ago
..
langchain_couchbase couchbase: [patch] Return chat message history in order (#24498) 2 months ago
scripts couchbase: Add the initial version of Couchbase partner package (#22087) 4 months ago
tests couchbase: [patch] Return chat message history in order (#24498) 2 months ago
.gitignore couchbase: Add the initial version of Couchbase partner package (#22087) 4 months ago
LICENSE couchbase: Add the initial version of Couchbase partner package (#22087) 4 months ago
Makefile infra: update mypy 1.10, ruff 0.5 (#23721) 3 months ago
README.md couchbase: Add the initial version of Couchbase partner package (#22087) 4 months ago
poetry.lock couchbase: Add chat message history (#24356) 2 months ago
pyproject.toml couchbase: [patch] Return chat message history in order (#24498) 2 months ago

README.md

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",
)