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

preserve language in conversation retrieval #4969

Merged

Conversation

hansvdam
Copy link
Contributor

Without the addition of 'in its original language', the condensing response, more often than not, outputs the rephrased question in English, even when the conversation is in another language. This question in English then transfers to the question in the retrieval prompt and the chatbot is stuck in English.

I'm sometimes surprised that this does not happen more often, but apparently the GPT models are smart enough to understand that when the template contains

Question: ....
Answer:

then the answer should be in in the language of the question.

Without the addition of 'in its original language', the condensing response more often that not outputs the rephrased question in English, even when the conversation is in another language.
@hansvdam
Copy link
Contributor Author

before:
Screenshot 2023-05-19 at 08 01 22
after:
Screenshot 2023-05-19 at 08 03 57

@hansvdam
Copy link
Contributor Author

I think the normal prompt_template in the prompts.py could also use some other-than-english instruction. I have experimented with it a little bit: when I ask an initial dutch question like:
'wat is NS?', with the prompt_template it answers in english, because it assumes the 'wat' is a typo (although it is Dutch for 'what' (when I type a longer more clearly Dutch question it works fine though). With the CHAT_PROMPT from question_answering/stuff_prompt.py it understand the language is Dutch. It is mysterious, but in general I think prompts should get a language-choice-instructions t be more robust.

@eyurtsev eyurtsev added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label May 19, 2023
@eyurtsev eyurtsev requested review from hwchase17 and dev2049 May 19, 2023 14:24
@eyurtsev
Copy link
Collaborator

This looks good to me, but would appreciate 👁️ since it's a core prompt

@hwchase17 hwchase17 merged commit a395ff7 into langchain-ai:master May 22, 2023
@danielchalef danielchalef mentioned this pull request Jun 5, 2023
This was referenced Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants