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

Update chain_filter_prompt template to handle ValueError response. #20979

Closed
wants to merge 2 commits into from

Conversation

dylanlap98
Copy link

Fix for prompt_template where chain_filter_prompt can return a wordy response which produces multiple answers in model output, causing ValueError. In many cases you want model running chain_filter_prompt to be lightweight and this prompt injection helps accurately produce a more stable response.

  • Description: Fix for prompt_template where chain_filter_prompt can return a wordy response which produces multiple answers in model output, causing ValueError. In many cases you want model running chain_filter_prompt to be lightweight and this prompt injection helps accurately produce a more stable response.
  • Issue: ValueError('Ambiguous response. Both YES and NO in received: {text explaining model failure}.
  • Dependencies: NO DEPENDENCIES required for this change.
  • LinkedIn handle: https://www.linkedin.com/in/dylan-lapierre/

THANK YOU LANGCHAIN TEAM!

--> Note to myself: If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17.

Fix for prompt_template where chain_filter_prompt can return a wordy response which produces multiple answers in model output, causing ValueError.  In many cases you want model running chain_filter_prompt to be lightweight and this prompt injection helps accurately produce a more stable response.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 28, 2024
Copy link

vercel bot commented Apr 28, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2024 2:50pm

@dosubot dosubot bot added Ɑ: retriever Related to retriever module 🤖:improvement Medium size change to existing code to handle new use-cases labels Apr 28, 2024
Copy link
Collaborator

@baskaryan baskaryan left a comment

Choose a reason for hiding this comment

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

in general we try to not change default prompts since those can lead to silent changes in user code behavior. would it be better in this case to update the docs to show how you can pass in your own prompt?

@dylanlap98
Copy link
Author

dylanlap98 commented Apr 29, 2024 via email

@hwchase17
Copy link
Contributor

agree with bagatur on not changing prompts. Would be good to have a how-to guide on how to pass in a custom prompt, would go here: https://github.com/langchain-ai/langchain/tree/master/docs/docs/how_to

going to close this, but would love to see that documentation!

@hwchase17 hwchase17 closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases Ɑ: retriever Related to retriever module size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants