Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chubby-guests-sink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@langchain/community": patch
---

chore(couchbase): Deprecate CouchbaseVectorStore and create CouchbaseSearchVectorStore
22 changes: 11 additions & 11 deletions docs/core_docs/docs/integrations/vectorstores/couchbase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ For more details on how to create a search index with support for Vector fields,
- [Couchbase Capella](https://docs.couchbase.com/cloud/search/create-search-indexes.html)
- [Couchbase Server](https://docs.couchbase.com/server/current/search/create-search-indexes.html)

For using this vector store, CouchbaseVectorStoreArgs needs to be configured.
For using this vector store, CouchbaseSearchVectorStoreArgs needs to be configured.
textKey and embeddingKey are optional fields, required if you want to use specific keys

```typescript
const couchbaseConfig: CouchbaseVectorStoreArgs = {
const couchbaseConfig: CouchbaseSearchVectorStoreArgs = {
cluster: couchbaseClient,
bucketName: "testing",
scopeName: "_default",
Expand All @@ -164,7 +164,7 @@ const couchbaseConfig: CouchbaseVectorStoreArgs = {
We create the vector store object with the cluster information and the search index name.

```typescript
const store = await CouchbaseVectorStore.initialize(
const store = await CouchbaseSearchVectorStore.initialize(
embeddings, // embeddings object to create embeddings from text
couchbaseConfig
);
Expand All @@ -183,9 +183,9 @@ At the end, it also shows how to get similarity score
```ts
import { OpenAIEmbeddings } from "@langchain/openai";
import {
CouchbaseVectorStoreArgs,
CouchbaseVectorStore,
} from "@langchain/community/vectorstores/couchbase";
CouchbaseSearchVectorStoreArgs,
CouchbaseSearchVectorStore,
} from "@langchain/community/vectorstores/couchbase_search";
import { Cluster } from "couchbase";
import { TextLoader } from "langchain/document_loaders/fs/text";
import { CharacterTextSplitter } from "@langchain/textsplitters";
Expand Down Expand Up @@ -215,7 +215,7 @@ const embeddings = new OpenAIEmbeddings({
apiKey: process.env.OPENAI_API_KEY,
});

const couchbaseConfig: CouchbaseVectorStoreArgs = {
const couchbaseConfig: CouchbaseSearchVectorStoreArgs = {
cluster: couchbaseClient,
bucketName: "testing",
scopeName: "_default",
Expand All @@ -225,7 +225,7 @@ const couchbaseConfig: CouchbaseVectorStoreArgs = {
embeddingKey: "embedding",
};

const store = await CouchbaseVectorStore.fromDocuments(
const store = await CouchbaseSearchVectorStore.fromDocuments(
docs,
embeddings,
couchbaseConfig
Expand Down Expand Up @@ -291,7 +291,7 @@ for (let i = 0; i < docs.length; i += 1) {
docs[i].metadata.author = ["John Doe", "Jane Doe"][i % 2];
}

const store = await CouchbaseVectorStore.fromDocuments(
const store = await CouchbaseSearchVectorStore.fromDocuments(
docs,
embeddings,
couchbaseConfig
Expand Down Expand Up @@ -405,9 +405,9 @@ Please refer to the documentation for more details on the available query method

# Frequently Asked Questions

## Question: Should I create the Search index before creating the CouchbaseVectorStore object?
## Question: Should I create the Search index before creating the CouchbaseSearchVectorStore object?

Yes, currently you need to create the Search index before creating the `CouchbaseVectorStore` object.
Yes, currently you need to create the Search index before creating the `CouchbaseSearchVectorStore` object.

## Question: I am not seeing all the fields that I specified in my search results.

Expand Down
4 changes: 2 additions & 2 deletions docs/core_docs/src/theme/FeatureTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ const FEATURE_TABLES = {
idsInAddDocuments: false,
},
{
name: "CouchbaseVectorStore",
link: "couchbase",
name: "CouchbaseSearchVectorStore",
link: "couchbase_search",
deleteById: true,
filtering: true,
searchByVector: false,
Expand Down
4 changes: 4 additions & 0 deletions libs/langchain-community/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ vectorstores/couchbase.cjs
vectorstores/couchbase.js
vectorstores/couchbase.d.ts
vectorstores/couchbase.d.cts
vectorstores/couchbase_search.cjs
vectorstores/couchbase_search.js
vectorstores/couchbase_search.d.ts
vectorstores/couchbase_search.d.cts
vectorstores/elasticsearch.cjs
vectorstores/elasticsearch.js
vectorstores/elasticsearch.d.ts
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-community/langchain.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const config = {
"vectorstores/cloudflare_vectorize": "vectorstores/cloudflare_vectorize",
"vectorstores/convex": "vectorstores/convex",
"vectorstores/couchbase": "vectorstores/couchbase",
"vectorstores/couchbase_search": "vectorstores/couchbase_search",
"vectorstores/elasticsearch": "vectorstores/elasticsearch",
"vectorstores/faiss": "vectorstores/faiss",
"vectorstores/googlevertexai": "vectorstores/googlevertexai",
Expand Down
15 changes: 14 additions & 1 deletion libs/langchain-community/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"closevector-web": "0.1.6",
"cohere-ai": ">=6.0.0",
"convex": "^1.3.1",
"couchbase": "^4.3.0",
"couchbase": "^4.4.6",
"crypto-js": "^4.2.0",
"d3-dsv": "^2.0.0",
"datastore-core": "^9.2.9",
Expand Down Expand Up @@ -1592,6 +1592,15 @@
"import": "./vectorstores/couchbase.js",
"require": "./vectorstores/couchbase.cjs"
},
"./vectorstores/couchbase_search": {
"types": {
"import": "./vectorstores/couchbase_search.d.ts",
"require": "./vectorstores/couchbase_search.d.cts",
"default": "./vectorstores/couchbase_search.d.ts"
},
"import": "./vectorstores/couchbase_search.js",
"require": "./vectorstores/couchbase_search.cjs"
},
"./vectorstores/elasticsearch": {
"types": {
"import": "./vectorstores/elasticsearch.d.ts",
Expand Down Expand Up @@ -3663,6 +3672,10 @@
"vectorstores/couchbase.js",
"vectorstores/couchbase.d.ts",
"vectorstores/couchbase.d.cts",
"vectorstores/couchbase_search.cjs",
"vectorstores/couchbase_search.js",
"vectorstores/couchbase_search.d.ts",
"vectorstores/couchbase_search.d.cts",
"vectorstores/elasticsearch.cjs",
"vectorstores/elasticsearch.js",
"vectorstores/elasticsearch.d.ts",
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-community/src/load/import_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export * as llms__friendli from "../llms/friendli.js";
export * as llms__ollama from "../llms/ollama.js";
export * as llms__togetherai from "../llms/togetherai.js";
export * as llms__yandex from "../llms/yandex.js";
export * as vectorstores__couchbase_search from "../vectorstores/couchbase_search.js";
export * as vectorstores__prisma from "../vectorstores/prisma.js";
export * as vectorstores__turbopuffer from "../vectorstores/turbopuffer.js";
export * as vectorstores__vectara from "../vectorstores/vectara.js";
Expand Down
21 changes: 3 additions & 18 deletions libs/langchain-community/src/vectorstores/couchbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,15 @@ import { Document } from "@langchain/core/documents";
import { v4 as uuid } from "uuid";

/**
* This interface define the optional fields for adding vector
* - `ids` - vector of ids for each document. If undefined, then uuid will be used
* - `metadata` - vector of metadata object for each document
* @deprecated This interface has been relocated to `@langchain/community/vectorstores/couchbase_search`. This interface will be removed in a future release.
*/
export interface AddVectorOptions {
ids?: string[];
metadata?: Record<string, any>[];
}

/**
* This interface defines the fields required to initialize a vector store
* These are the fields part of config:
* @property {Cluster} cluster - The Couchbase cluster that the store will interact with.
* @property {string} bucketName - The name of the bucket in the Couchbase cluster.
* @property {string} scopeName - The name of the scope within the bucket.
* @property {string} collectionName - The name of the collection within the scope.
* @property {string} indexName - The name of the index to be used for vector search.
* @property {string} textKey - The key to be used for text in the documents. Defaults to "text".
* @property {string} embeddingKey - The key to be used for embeddings in the documents. Defaults to "embedding".
* @property {boolean} scopedIndex - Whether to use a scoped index for vector search. Defaults to true.
* @property {AddVectorOptions} addVectorOptions - Options for adding vectors with specific id/metadata
* @deprecated Use CouchbaseSearchVectorStoreArgs from `@langchain/community/vectorstores/couchbase_search` instead. This interface will be removed in a future release.
*/
export interface CouchbaseVectorStoreArgs {
cluster: Cluster;
Expand All @@ -63,10 +51,7 @@ type CouchbaseVectorStoreFilter = {
};

/**
* Class for interacting with the Couchbase database. It extends the
* VectorStore class and provides methods for adding vectors and
* documents, and searching for similar vectors.
* Initiate the class using initialize() method.
* @deprecated Use CouchbaseSearchVectorStore from `@langchain/community/vectorstores/couchbase_search` instead. This class will be removed in a future release.
*/
export class CouchbaseVectorStore extends VectorStore {
declare FilterType: CouchbaseVectorStoreFilter;
Expand Down
Loading
Loading