Skip to content

Commit 0ec0ad6

Browse files
authored
Update addEmbeddings.js
1 parent 2fe3033 commit 0ec0ad6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

apps/graph_rag_demo/addEmbeddings.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
2-
import { MongoDBAtlasVectorSearch } from "@langchain/mongodb";
2+
import { MongoDBVectorSearch } from "@langchain/mongodb";
33
import { OpenAIEmbeddings } from "@langchain/openai";
44
import { MongoClient } from "mongodb";
55
import { PDFLoader } from "langchain/document_loaders/fs/pdf";
66
import dotenv from "dotenv";
77
dotenv.config();
88

9-
const client = new MongoClient(process.env.ATLAS_CONNECTION_STRING, appname="devrel.showcase.apps.graph_rag_demo");
9+
const client = new MongoClient(process.env._CONNECTION_STRING, appname="devrel.showcase.apps.graph_rag_demo");
1010
process.env.OPENAI_API_KEY = process.env.OPENAI_API_KEY1;
1111

1212
async function run() {
@@ -17,7 +17,7 @@ async function run() {
1717
const collection = database.collection("knowledge_graph");
1818
const dbConfig = {
1919
collection: collection,
20-
indexName: "vector_index", // The name of the Atlas search index to use.
20+
indexName: "vector_index", // The name of the MongoDB search index to use.
2121
textKey: "chunks", // Field name for the raw text content. Defaults to "text".
2222
embeddingKey: "embedding", // Field name for the vector embeddings. Defaults to "embedding".
2323
};
@@ -44,7 +44,7 @@ async function run() {
4444
chunkOverlap: 200,
4545
});
4646
const docs = await textSplitter.splitDocuments(data);
47-
await MongoDBAtlasVectorSearch.fromDocuments(docs, new OpenAIEmbeddings(), dbConfig);
47+
await MongoDBVectorSearch.fromDocuments(docs, new OpenAIEmbeddings(), dbConfig);
4848
console.log("Ending sync...", pdfname);
4949
})
5050
} catch (error){

0 commit comments

Comments
 (0)