langchain icon indicating copy to clipboard operation
langchain copied to clipboard

preserve language in conversation retrieval

Open hansvdam opened this issue 2 years ago • 3 comments

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.

hansvdam avatar May 19 '23 06:05 hansvdam

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

hansvdam avatar May 19 '23 06:05 hansvdam

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.

hansvdam avatar May 19 '23 09:05 hansvdam

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

eyurtsev avatar May 19 '23 14:05 eyurtsev