Skip to content

Commit

Permalink
community[patch]: Neo4j metadata filtering (#5215)
Browse files Browse the repository at this point in the history
* Implement addGraphDocuments method for neo4j graph~

* Add integration tests for new method and make them pass.

* Revert back to int skipped, because remote db

* Fix Serializable extension

* Make metadata optional

* Linting

* Format

* Update extensions and props passing

* Format

* Add metadata filtering

* Fix metadata test equality check. Format.

* Skip int test.

* Refactor IndexType from enum to plain type

* Move filter arg to params

* Format
  • Loading branch information
easwee committed May 20, 2024
1 parent 14e697f commit c327d58
Show file tree
Hide file tree
Showing 4 changed files with 1,138 additions and 595 deletions.
10 changes: 5 additions & 5 deletions libs/langchain-community/src/graphs/neo4j_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export type PathType = { start: string; type: string; end: string };
export const BASE_ENTITY_LABEL = "__Entity__";

const INCLUDE_DOCS_QUERY = `
MERGE (d:Document {id:$document.metadata.id})
SET d.text = $document.pageContent
SET d += $document.metadata
WITH d
MERGE (d:Document {id:$document.metadata.id})
SET d.text = $document.pageContent
SET d += $document.metadata
WITH d
`;

/**
Expand Down Expand Up @@ -262,7 +262,7 @@ export class Neo4jGraph {
if (!constraintExists) {
await this.query(`
CREATE CONSTRAINT IF NOT EXISTS FOR (b:${BASE_ENTITY_LABEL})
REQUIRE b.id IS UNIQUE;
REQUIRE b.id IS UNIQUE;
`);
await this.refreshSchema();
}
Expand Down
Loading

0 comments on commit c327d58

Please sign in to comment.