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

Custom LangChain prompt via config.retriever.custom_prompt #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matteocargnelutti
Copy link

This PR allows for replacing LangChain's default prompt via the retriever.custom_prompt property of the config object.

Allows for replacing LangChain's default prompt via the `retriever.custom_prompt` property of the config object.
@AlexPerkin
Copy link

Could you please provide an example chatdocs.yml for a custom LangChain prompt. Thank you in advance

@matteocargnelutti
Copy link
Author

For sure. Any prompt compatible with LangChain's PromptTemplate should do.

In chatdocs.yml:

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:"

@AlexPerkin
Copy link

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:"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants