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

fix issue: cannot use document_variable_name to override context in create_stuff_documents_chain #25531

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

jiru1997
Copy link
Contributor

…he prompt in the create_stuff_documents_chain

Thank you for contributing to LangChain!

  • PR title: "langchain:add document_variable_name in the function _validate_prompt in create_stuff_documents_chain"

  • PR message:

    • Description: add document_variable_name in the function _validate_prompt in create_stuff_documents_chain
    • Issue: according to the description of create_stuff_documents_chain function, the parameter document_variable_name can be used to override the "context" in the prompt, but in the function, _validate_prompt it still use DOCUMENTS_KEY to check if it is a valid prompt, the value of DOCUMENTS_KEY is always "context", so even through the user use document_variable_name to override it, the code still tries to check if "context" is in the prompt, and finally it reports error. so I use document_variable_name to replace DOCUMENTS_KEY, the default value of document_variable_name is "context" which is same as DOCUMENTS_KEY, but it can be override by users.
    • Dependencies: none
    • Twitter handle: https://x.com/xjr199703
  • Add tests and docs: none

  • Lint and test: Run make format, make lint and make test from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:

  • Make sure optional dependencies are imported within a function.
  • Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests.
  • Most PRs should not touch more than one package.
  • Changes should be backwards compatible.
  • If you are adding something to community, do not re-import it in langchain.

If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.

…he prompt in the create_stuff_documents_chain
Copy link

vercel bot commented Aug 18, 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 Aug 19, 2024 1:19pm

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. langchain Related to the langchain package 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Aug 18, 2024
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Aug 19, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Aug 19, 2024
@ccurme ccurme enabled auto-merge (squash) August 19, 2024 13:22
@ccurme ccurme merged commit 0f7b8ad into langchain-ai:master Aug 19, 2024
53 checks passed
@jiru1997 jiru1997 deleted the combine_doc_issue branch September 3, 2024 05:29
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 langchain Related to the langchain package lgtm PR looks good. Use to confirm that a PR is ready for merging. size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants