diff --git a/docs/extras/modules/data_connection/vectorstores/integrations/neo4jvector.mdx b/docs/extras/modules/data_connection/vectorstores/integrations/neo4jvector.mdx index 4e1a099b1fb4..06986c4c1093 100644 --- a/docs/extras/modules/data_connection/vectorstores/integrations/neo4jvector.mdx +++ b/docs/extras/modules/data_connection/vectorstores/integrations/neo4jvector.mdx @@ -35,7 +35,7 @@ You can find more information on how to setup `Neo4j` on their [website](https:/ import Example from "@examples/indexes/vector_stores/neo4j_vector/neo4j_vector.ts"; -One complete example of using `Neo4jVectorIndex` is the following: +One complete example of using `Neo4jVectorStore` is the following: {Example} @@ -45,7 +45,7 @@ import RetrievalExample from "@examples/indexes/vector_stores/neo4j_vector/neo4j {RetrievalExample} -### Instantiate Neo4jVectorIndex from existing graph +### Instantiate Neo4jVectorStore from existing graph import ExistingGraphExample from "@examples/indexes/vector_stores/neo4j_vector/neo4j_vector_existinggraph.ts"; diff --git a/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector.ts b/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector.ts index b54f3f632176..3e30bc7c2d56 100644 --- a/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector.ts +++ b/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector.ts @@ -1,5 +1,5 @@ import { OpenAIEmbeddings } from "langchain/embeddings/openai"; -import { Neo4jVectorIndex } from "langchain/vectorstores/neo4j_vector"; +import { Neo4jVectorStore } from "langchain/vectorstores/neo4j_vector"; // Configuration object for Neo4j connection and other related settings const config = { @@ -19,7 +19,7 @@ const documents = [ { pageContent: "Cat drinks milk", metadata: { a: 1 } }, ]; -const neo4jVectorIndex = await Neo4jVectorIndex.fromDocuments( +const neo4jVectorIndex = await Neo4jVectorStore.fromDocuments( documents, new OpenAIEmbeddings(), config @@ -33,4 +33,4 @@ console.log(results); [ Document { pageContent: 'Cat drinks milk', metadata: { a: 1 } } ] */ -await Neo4jVectorIndex.close(); +await neo4jVectorIndex.close(); diff --git a/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_existinggraph.ts b/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_existinggraph.ts index 8e25f11c654f..cdbcd7d2d475 100644 --- a/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_existinggraph.ts +++ b/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_existinggraph.ts @@ -1,5 +1,5 @@ import { OpenAIEmbeddings } from "langchain/embeddings/openai"; -import { Neo4jVectorIndex } from "langchain/vectorstores/neo4j_vector"; +import { Neo4jVectorStore } from "langchain/vectorstores/neo4j_vector"; /** * `fromExistingGraph` Method: @@ -27,9 +27,9 @@ const config = { }; // You should have a populated Neo4j database to use this method -const neo4jVectorIndex = await Neo4jVectorIndex.fromExistingGraph( +const neo4jVectorIndex = await Neo4jVectorStore.fromExistingGraph( new OpenAIEmbeddings(), config ); -await Neo4jVectorIndex.close(); +await neo4jVectorIndex.close(); diff --git a/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_retrieval.ts b/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_retrieval.ts index cb975f71cd87..addbe6c173d9 100644 --- a/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_retrieval.ts +++ b/examples/src/indexes/vector_stores/neo4j_vector/neo4j_vector_retrieval.ts @@ -1,5 +1,5 @@ import { OpenAIEmbeddings } from "langchain/embeddings/openai"; -import { Neo4jVectorIndex } from "langchain/vectorstores/neo4j_vector"; +import { Neo4jVectorStore } from "langchain/vectorstores/neo4j_vector"; /* * The retrievalQuery is a customizable Cypher query fragment used in the Neo4jVectorStore class to define how @@ -42,7 +42,7 @@ const documents = [ { pageContent: "Cat drinks milk", metadata: { a: 1 } }, ]; -const neo4jVectorIndex = await Neo4jVectorIndex.fromDocuments( +const neo4jVectorIndex = await Neo4jVectorStore.fromDocuments( documents, new OpenAIEmbeddings(), config @@ -56,4 +56,4 @@ console.log(results); [ Document { pageContent: 'Cat drinks milk', metadata: { a: 2 } } ] */ -await Neo4jVectorIndex.close(); +await neo4jVectorIndex.close(); diff --git a/langchain/.gitignore b/langchain/.gitignore index 79252693cd61..0edc574a9c7a 100644 --- a/langchain/.gitignore +++ b/langchain/.gitignore @@ -232,6 +232,9 @@ vectorstores/pgvector.d.ts vectorstores/milvus.cjs vectorstores/milvus.js vectorstores/milvus.d.ts +vectorstores/neo4j_vector.cjs +vectorstores/neo4j_vector.js +vectorstores/neo4j_vector.d.ts vectorstores/prisma.cjs vectorstores/prisma.js vectorstores/prisma.d.ts diff --git a/langchain/package.json b/langchain/package.json index 456cfedb3b38..904f0b3bb206 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -244,6 +244,9 @@ "vectorstores/milvus.cjs", "vectorstores/milvus.js", "vectorstores/milvus.d.ts", + "vectorstores/neo4j_vector.cjs", + "vectorstores/neo4j_vector.js", + "vectorstores/neo4j_vector.d.ts", "vectorstores/prisma.cjs", "vectorstores/prisma.js", "vectorstores/prisma.d.ts", @@ -1633,6 +1636,11 @@ "import": "./vectorstores/milvus.js", "require": "./vectorstores/milvus.cjs" }, + "./vectorstores/neo4j_vector": { + "types": "./vectorstores/neo4j_vector.d.ts", + "import": "./vectorstores/neo4j_vector.js", + "require": "./vectorstores/neo4j_vector.cjs" + }, "./vectorstores/prisma": { "types": "./vectorstores/prisma.d.ts", "import": "./vectorstores/prisma.js", diff --git a/langchain/src/load/import_constants.ts b/langchain/src/load/import_constants.ts index 0e68d31554b7..9b6c2e5868a4 100644 --- a/langchain/src/load/import_constants.ts +++ b/langchain/src/load/import_constants.ts @@ -56,6 +56,7 @@ export const optionalImportEntrypoints = [ "langchain/vectorstores/opensearch", "langchain/vectorstores/pgvector", "langchain/vectorstores/milvus", + "langchain/vectorstores/neo4j_vector", "langchain/vectorstores/typeorm", "langchain/vectorstores/myscale", "langchain/vectorstores/redis", diff --git a/langchain/src/load/import_type.d.ts b/langchain/src/load/import_type.d.ts index b30c9225af61..357403b3e87c 100644 --- a/langchain/src/load/import_type.d.ts +++ b/langchain/src/load/import_type.d.ts @@ -166,6 +166,9 @@ export interface OptionalImportMap { "langchain/vectorstores/milvus"?: | typeof import("../vectorstores/milvus.js") | Promise; + "langchain/vectorstores/neo4j_vector"?: + | typeof import("../vectorstores/neo4j_vector.js") + | Promise; "langchain/vectorstores/typeorm"?: | typeof import("../vectorstores/typeorm.js") | Promise; diff --git a/langchain/tsconfig.json b/langchain/tsconfig.json index 411374de189f..98fa1f39f550 100644 --- a/langchain/tsconfig.json +++ b/langchain/tsconfig.json @@ -110,6 +110,7 @@ "src/vectorstores/opensearch.ts", "src/vectorstores/pgvector.ts", "src/vectorstores/milvus.ts", + "src/vectorstores/neo4j_vector.ts", "src/vectorstores/prisma.ts", "src/vectorstores/typeorm.ts", "src/vectorstores/myscale.ts",