Skip to content

Commit

Permalink
Added missing lucene special char to remove_lucene_chars (langchain-a…
Browse files Browse the repository at this point in the history
…i#36)

* Updated CHANGELOG

* Fixed small GraphStore typo

* Added missing lucene special char to remove_lucene_chars

* Updated CHANGELOG

* Updated CHANGELOG
  • Loading branch information
alexthomas93 authored Jan 11, 2025
1 parent 158699e commit c1e5ae4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
### Changed

- Made the `source` parameter of `GraphDocument` optional and updated related methods to support this.
- Suppressed AggregationSkippedNull warnings raised by the Neo4j driver in the Neo4jGraph class when fetching the enhanced_schema.
- Suppressed AggregationSkippedNull warnings raised by the Neo4j driver in the `Neo4jGraph` class when fetching the enhanced_schema.
- Modified the `Neo4jGraph` class's enhanced schema Cypher query to utilize the apoc.meta.graph procedure instead of apoc.meta.graphSample.
- Updated `GraphStore` to be a Protocol, enabling compatibility with `GraphCypherQAChain` without requiring inheritance.

### Fixed

- Resolved syntax errors in GraphCypherQAChain by ensuring node labels with spaces are correctly quoted in Cypher queries.
- Resolved syntax errors in `GraphCypherQAChain` by ensuring node labels with spaces are correctly quoted in Cypher queries.
- Added missing Lucene special character '/' to the list of characters escaped in `remove_lucene_chars`.

## 0.2.0

Expand Down
2 changes: 1 addition & 1 deletion libs/neo4j/langchain_neo4j/graphs/graph_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def query(self, query: str, params: dict = {}) -> List[Dict[str, Any]]:

def refresh_schema(self) -> None:
"""Refresh the graph schema information."""
pass
...

def add_graph_documents(
self, graph_documents: List[GraphDocument], include_source: bool = False
Expand Down
1 change: 1 addition & 0 deletions libs/neo4j/langchain_neo4j/vectorstores/neo4j_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def remove_lucene_chars(text: str) -> str:
"?",
":",
"\\",
"/",
]
for char in special_chars:
if char in text:
Expand Down
4 changes: 4 additions & 0 deletions libs/neo4j/tests/unit_tests/vectorstores/test_neo4j.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def test_escaping_lucene() -> None:
remove_lucene_chars("It is the end of the world. Take shelter~")
== "It is the end of the world. Take shelter"
)
assert (
remove_lucene_chars("It is the end of the world. Take shelter/")
== "It is the end of the world. Take shelter"
)


def test_converting_to_yaml() -> None:
Expand Down

0 comments on commit c1e5ae4

Please sign in to comment.