Custom LangChain prompt via config.retriever.custom_prompt#84
Open
matteocargnelutti wants to merge 1 commit intomarella:mainfrom
Open
Custom LangChain prompt via config.retriever.custom_prompt#84matteocargnelutti wants to merge 1 commit intomarella:mainfrom
config.retriever.custom_prompt#84matteocargnelutti wants to merge 1 commit intomarella:mainfrom
Conversation
Allows for replacing LangChain's default prompt via the `retriever.custom_prompt` property of the config object.
|
Could you please provide an example chatdocs.yml for a custom LangChain prompt. Thank you in advance |
Author
|
For sure. Any prompt compatible with LangChain's In retriever:
custom_prompt: "
Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
{context}
Question: {question}
Helpful Answer:" |
|
For my part, I would like to offer a prompt designed for Llama 2, which significantly improves the quality of answers: retriever:
custom_prompt: "[INST] <<SYS>>Use the following pieces of context to answer the question at the end. Let's think step by step. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
<</SYS>>
CONTEXT:
{context}
Question: {question}
[/INST]
Helpful Answer:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows for replacing LangChain's default prompt via the
retriever.custom_promptproperty of the config object.