core
core copied to clipboard
add multilingual support
Default prompts in chains and agents are in english.
-
OPTION 1: localization There should be a language detector to classify user input and to load default prompts in the appropriate language. (localized content should be organized in a similar manner as in CMSs like WordPress)
-
OPTION 2: wrapper Run the language detector, translate user input in english using a translation model, run the pipelines/agents/chains in english and then translate back the final response back to user language.
Let's go with option 2 as llms are weak in languages other than english
I developed a multilingual FAQ Search a year ago using the DeepL API and xlm model.
Other option, we can use XLM. I tested with openaAI and if a give the input in italian it responds in italian, for HF we can force a cross language model (xlm) and multilingual embeddings
Hooks to change prompt language are now exposed