The model answers in English instead of French

#2
by Dimi3 - opened

Hello Guys.

I am using this model with langchain and "dangvantuan/sentence-camembert-large" model embeddings
to build a Chatbot with RAG on French document.

But when I ask question to the chatbot+RAG model in French, it answers in English systematically.

I am sure that:

  • The vector space contains french sentence
  • vigogne-7b-chat model answer in french

But the the chatbot+RAG model resulting always answers in English

Hello

I finally solve my problem by adding a prompt template to ConversationalRetrievalChain instance.
Prompt written in french

template="""Vous êtes un chatbot en conversation avec un humain.

À partir des parties extraites suivantes d'un long document et d'une question, créez une réponse finale.
{context}

{chat_history}
Humain: {user_query}
Chatbot:"""

Prompt template

prompt = PromptTemplate(
input_variables=["chat_history", "user_query", "context"],
template=template
)

qa_llm = ConversationalRetrievalChain.from_llm(llm=llm,
retriever=retriever,
combine_docs_chain_kwargs={"prompt": prompt},
return_source_documents=True,
memory=memory,
get_chat_history=lambda h : h)

Dimi3 changed discussion status to closed

Sign up or log in to comment