Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…to brace/agent-stream-example
  • Loading branch information
bracesproul committed Dec 5, 2023
2 parents 17169f5 + df6f043 commit d86b3d0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/core_docs/docs/integrations/vectorstores/xata.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions langchain/src/vectorstores/tests/xata.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion langchain/src/vectorstores/xata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand Down
13 changes: 11 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d86b3d0

Please sign in to comment.