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

GraphCypherQAChain: Dynamic inputs cypher generation #24300

Conversation

RafaelXokito
Copy link
Contributor

@RafaelXokito RafaelXokito commented Jul 16, 2024

Description: This PR introduces a change to the cypher_generation_chain to dynamically concatenate inputs. This improvement aims to streamline the input handling process and make the method more flexible. The change involves updating the arguments dictionary with all elements from the inputs dictionary, ensuring that all necessary inputs are dynamically appended. This will ensure that any cypher generation template will not require a new _call method patch.

Issue: This PR fixes issue #24260.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 16, 2024
Copy link

vercel bot commented Jul 16, 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 Jul 16, 2024 9:08am

@dosubot dosubot bot added community Related to langchain-community 🤖:improvement Medium size change to existing code to handle new use-cases labels Jul 16, 2024
"question": question,
"schema": self.graph_schema,
}
args.update(inputs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does args.update not duplicate the question content? under the key self.input_key

Is there any unit test you could write?

Copy link
Contributor Author

@RafaelXokito RafaelXokito Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question, regarding the content duplication, if the input_key for the question is different than "question" it will indeed duplicate because the default template uses "question" and I cant guarantee that the user didn't specified other cypher_prompt template.

At the end of the day will not impact if it duplicate.
But give me your feedback on this.

@eyurtsev eyurtsev self-assigned this Jul 18, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Jul 19, 2024
@eyurtsev eyurtsev merged commit 6a45bf9 into langchain-ai:master Jul 19, 2024
43 checks passed
@RafaelXokito
Copy link
Contributor Author

@eyurtsev should I include tests for more edge cases? I can open another PR.

Give your feedback on this.

olgamurraft pushed a commit to olgamurraft/langchain that referenced this pull request Aug 16, 2024
…rovided by the user for cypher generation (langchain-ai#24300)

**Description:** This PR introduces a change to the
`cypher_generation_chain` to dynamically concatenate inputs. This
improvement aims to streamline the input handling process and make the
method more flexible. The change involves updating the arguments
dictionary with all elements from the `inputs` dictionary, ensuring that
all necessary inputs are dynamically appended. This will ensure that any
cypher generation template will not require a new `_call` method patch.

**Issue:** This PR fixes issue langchain-ai#24260.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Related to langchain-community 🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants