mirror of
https://github.com/open-webui/open-webui
synced 2025-02-22 13:18:25 +00:00
fix: much improved RAG template
This commit is contained in:
parent
ed2a1e7db9
commit
209e246e6f
@ -1085,19 +1085,25 @@ CHUNK_OVERLAP = PersistentConfig(
|
|||||||
int(os.environ.get("CHUNK_OVERLAP", "100")),
|
int(os.environ.get("CHUNK_OVERLAP", "100")),
|
||||||
)
|
)
|
||||||
|
|
||||||
DEFAULT_RAG_TEMPLATE = """Use the following context as your learned knowledge, inside <context></context> XML tags.
|
DEFAULT_RAG_TEMPLATE = """You are given a user query, some textual context and rules, all inside xml tags. You have to answer the query based on the context while respecting the rules.
|
||||||
|
|
||||||
<context>
|
<context>
|
||||||
[context]
|
[context]
|
||||||
</context>
|
</context>
|
||||||
|
|
||||||
When answer to user:
|
<rules>
|
||||||
- If you don't know, just say that you don't know.
|
- If you don't know, just say so.
|
||||||
- If you don't know when you are not sure, ask for clarification.
|
- If you are not sure, ask for clarification.
|
||||||
Avoid mentioning that you obtained the information from the context.
|
- Answer in the same language as the user query.
|
||||||
And answer according to the language of the user's question.
|
- If the context appears unreadable or of poor quality, tell the user then answer as best as you can.
|
||||||
|
- If the answer is not in the context but you think you know the answer, explain that to the user then answer with your own knowledge.
|
||||||
|
- Answer directly and without using xml tags.
|
||||||
|
</rules>
|
||||||
|
|
||||||
Given the context information, answer the query.
|
<user_query>
|
||||||
Query: [query]"""
|
[query]
|
||||||
|
</user_query>
|
||||||
|
"""
|
||||||
|
|
||||||
RAG_TEMPLATE = PersistentConfig(
|
RAG_TEMPLATE = PersistentConfig(
|
||||||
"RAG_TEMPLATE",
|
"RAG_TEMPLATE",
|
||||||
|
Loading…
Reference in New Issue
Block a user