Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community: fix Cypher query generation for node names with spaces #28410

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chkaty
Copy link

@chkaty chkaty commented Nov 29, 2024

Description:
This PR fixes an issue in GraphCypherQAChain where node names containing spaces (e.g., "Medical Condition") resulted in a Neo.ClientError.Statement.SyntaxError when generating Cypher queries. The issue was caused by node names with spaces not being wrapped in backticks, which are required for correct Cypher syntax.

  • Modified the extract_cypher function to wrap node names containing spaces in backticks.

Issue:
Fixes #28375

Dependencies: N/A

Test Coverage:

  • Unit tests have been added to ensure that node names with single and multiple spaces are correctly wrapped in backticks. Additionally, queries with already backtick-wrapped node names remain unaffected.

Lint and Test:

  • Ran make format, make lint, and make test to ensure all tests pass and the code adheres to the formatting standards.

Twitter handle: N/A

- Updated `extract_cypher` to wrap node names with spaces in backticks.
- Added tests for node names with one and multiple spaces.
- Renamed test cases to improve clarity.
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 29, 2024
Copy link

vercel bot commented Nov 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Nov 29, 2024 3:57am

@dosubot dosubot bot added community Related to langchain-community 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature community Related to langchain-community size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

GraphCypherQAChain Issue with Node Names Containing Spaces
1 participant