diff --git a/docs/core_docs/docs/integrations/vectorstores/xata.mdx b/docs/core_docs/docs/integrations/vectorstores/xata.mdx index bc302ff0a8b7..604a67d824ae 100644 --- a/docs/core_docs/docs/integrations/vectorstores/xata.mdx +++ b/docs/core_docs/docs/integrations/vectorstores/xata.mdx @@ -17,7 +17,7 @@ npm install @xata.io/cli -g In the [Xata UI](https://app.xata.io) create a new database. You can name it whatever you want, but for this example we'll use `langchain`. Create a table, again you can name it anything, but we will use `vectors`. Add the following columns via the UI: -- `content` of type "Long text". This is used to store the `Document.pageContent` values. +- `content` of type "Text". This is used to store the `Document.pageContent` values. - `embedding` of type "Vector". Use the dimension used by the model you plan to use (1536 for OpenAI). - any other columns you want to use as metadata. They are populated from the `Document.metadata` object. For example, if in the `Document.metadata` object you have a `title` property, you can create a `title` column in the table and it will be populated. diff --git a/langchain/package.json b/langchain/package.json index ab967ae256ca..8f1777db616d 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -944,7 +944,7 @@ "@vercel/kv": "^0.2.3", "@vercel/postgres": "^0.5.0", "@writerai/writer-sdk": "^0.40.2", - "@xata.io/client": "^0.25.1", + "@xata.io/client": "^0.28.0", "@xenova/transformers": "^2.5.4", "@zilliz/milvus2-sdk-node": ">=2.2.11", "apify-client": "^2.7.1", @@ -1066,7 +1066,7 @@ "@vercel/kv": "^0.2.3", "@vercel/postgres": "^0.5.0", "@writerai/writer-sdk": "^0.40.2", - "@xata.io/client": "^0.25.1", + "@xata.io/client": "^0.28.0", "@xenova/transformers": "^2.5.4", "@zilliz/milvus2-sdk-node": ">=2.2.7", "apify-client": "^2.7.1", diff --git a/langchain/src/vectorstores/tests/xata.int.test.ts b/langchain/src/vectorstores/tests/xata.int.test.ts index cab301657669..977754d0189c 100644 --- a/langchain/src/vectorstores/tests/xata.int.test.ts +++ b/langchain/src/vectorstores/tests/xata.int.test.ts @@ -6,6 +6,11 @@ import { XataVectorSearch } from "../xata.js"; import { OpenAIEmbeddings } from "../../embeddings/openai.js"; import { Document } from "../../document.js"; +// Tests require a DB with a table called "docs" with: +// * a column name content of type Text +// * a column named embedding of type Vector +// * a column named a of type Integer + test.skip("XataVectorSearch integration", async () => { if (!process.env.XATA_API_KEY) { throw new Error("XATA_API_KEY not set"); diff --git a/langchain/src/vectorstores/xata.ts b/langchain/src/vectorstores/xata.ts index 8d8ed0b5c7e9..ccd6089ea4e9 100644 --- a/langchain/src/vectorstores/xata.ts +++ b/langchain/src/vectorstores/xata.ts @@ -118,7 +118,7 @@ export class XataVectorSearch< k: number, filter?: XataFilter | undefined ): Promise<[Document, number][]> { - const records = await this.client.db[this.table].vectorSearch( + const { records } = await this.client.db[this.table].vectorSearch( "embedding", query, { diff --git a/yarn.lock b/yarn.lock index 9015e889a3c3..1d547abb963e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12665,6 +12665,15 @@ __metadata: languageName: node linkType: hard +"@xata.io/client@npm:^0.28.0": + version: 0.28.0 + resolution: "@xata.io/client@npm:0.28.0" + peerDependencies: + typescript: ">=4.5" + checksum: 39dbf590c320ba49623f44ab1124fb084f08f2820d04bc1f7c20459304ac4008227964ce4e5d9bf1ab34828c7d3fa3afb50f3455a1f37a981238463ae4289036 + languageName: node + linkType: hard + "@xenova/transformers@npm:^2.5.4": version: 2.5.4 resolution: "@xenova/transformers@npm:2.5.4" @@ -22690,7 +22699,7 @@ __metadata: "@vercel/kv": ^0.2.3 "@vercel/postgres": ^0.5.0 "@writerai/writer-sdk": ^0.40.2 - "@xata.io/client": ^0.25.1 + "@xata.io/client": ^0.28.0 "@xenova/transformers": ^2.5.4 "@zilliz/milvus2-sdk-node": ">=2.2.11" apify-client: ^2.7.1 @@ -22827,7 +22836,7 @@ __metadata: "@vercel/kv": ^0.2.3 "@vercel/postgres": ^0.5.0 "@writerai/writer-sdk": ^0.40.2 - "@xata.io/client": ^0.25.1 + "@xata.io/client": ^0.28.0 "@xenova/transformers": ^2.5.4 "@zilliz/milvus2-sdk-node": ">=2.2.7" apify-client: ^2.7.1