如何处理特定语言的LLM回复语言?

问题描述 投票:0回答:1

我一直在使用 Falcon-40b 模型开发 RAG 架构,并且聊天机器人的实现必须使用西班牙语。我了解 Falcon-40b 是多语言的。到目前为止,RAG 已返回良好的响应,但有时会以英语输出响应(响应正常,但以英语返回)。

为了尝试解决这个问题,我制作了一个提示模板,专门向 Falcon 指示它应该用西班牙语给出答案。但有时它仍然会给出英文答案。

我该如何解决这个问题?我附上下面的提示模板:

"""You are a helpful AI assistant and provide the answer to the question based on the given context.
All the answers you generate must be in Spanish because it is the language that the user understands.
Answer only using context information. If the answer is not contained in the given context, just answer 'I can't answer that'.
>>CONTEXT<<
{context}
>>QUESTION<< {question}
>>ANSWER<<

我使用的西班牙语版本的提示模板:

"""Eres un útil asistente de IA y proporcionas la respuesta a la pregunta según el contexto dado. 
Todas las respuestas que generes deben ser en español porque es el idioma que entiende el usuario. 
Responde sólo usando la información del contexto. Si la respuesta no está contenida en el contexto dado, sólo responde 'No puedo responder a eso'. 
>>CONTEXT<<   
{context}  
>>QUESTION<< {question}
>>ANSWER<< ```
nlp chatbot nlp-question-answering llm large-language-model
1个回答
0
投票

只需给出简单的提示即可,即始终用西班牙语回答

© www.soinside.com 2019 - 2024. All rights reserved.