ItzCrazyKns / Perplexica

Perplexica is an AI-powered search engine. It is an Open source alternative to Perplexity AI
MIT License
13.67k stars 1.3k forks source link

[FR] Specify the language for LLM generation used in search and final response through variables respectively. #181

Closed wwjCMP closed 3 months ago

wwjCMP commented 3 months ago

Is your feature request related to a problem? Please describe.

https://github.com/ItzCrazyKns/Perplexica/issues/72

Previously, we discussed this issue. The main concern is about damaging the built-in prompt, but in fact, we don't need to make any changes to the original prompt, just add some content base on it.

For a multi-step process, we can easily specify the language for LLM output at each step without breaking the original prompt, simply by adding a prompt at the end of each step: "Please answer in $variable."

By setting two variables, we can control the language of the materials we search for and the language used to answer the final question. Since LLMs have cross-lingual capabilities, we can control the output language with explicit instructions regardless of the language of the prompts and reference materials.

For example, if I search for general questions, I can set the search language to Chinese or other languages; the response language to Chinese or other languages. If I search for academic questions first, I can set the search language to English and the response language to Chinese or other languages.

By placing options for these two language settings on the dialogue interface and dynamically modifying the prompt with variables, users can easily control the language of the materials they want to use for question answering. Currently, the search language depends entirely on the language of the question, and sometimes it can only be English content. This is because even if other languages are used to ask questions, the content for retrieval is in English due to the English prompts in the first step.

PeterDaveHello commented 2 months ago

This feature is important!