mirror of
https://github.com/open-webui/open-webui
synced 2025-06-04 03:37:35 +00:00
Merge pull request #12477 from Ithanil/improved_rag_template
fix: more coherent default RAG template
This commit is contained in:
commit
579aca65bb
@ -1900,7 +1900,7 @@ CHUNK_OVERLAP = PersistentConfig(
|
|||||||
)
|
)
|
||||||
|
|
||||||
DEFAULT_RAG_TEMPLATE = """### Task:
|
DEFAULT_RAG_TEMPLATE = """### Task:
|
||||||
Respond to the user query using the provided context, incorporating inline citations in the format [source_id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id="1">).
|
Respond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id="1">).
|
||||||
|
|
||||||
### Guidelines:
|
### Guidelines:
|
||||||
- If you don't know the answer, clearly state that.
|
- If you don't know the answer, clearly state that.
|
||||||
@ -1908,17 +1908,17 @@ Respond to the user query using the provided context, incorporating inline citat
|
|||||||
- Respond in the same language as the user's query.
|
- Respond in the same language as the user's query.
|
||||||
- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.
|
- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.
|
||||||
- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.
|
- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.
|
||||||
- **Only include inline citations using [source_id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**
|
- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**
|
||||||
- Do not cite if the <source> tag does not contain an id attribute.
|
- Do not cite if the <source> tag does not contain an id attribute.
|
||||||
- Do not use XML tags in your response.
|
- Do not use XML tags in your response.
|
||||||
- Ensure citations are concise and directly related to the information provided.
|
- Ensure citations are concise and directly related to the information provided.
|
||||||
|
|
||||||
### Example of Citation:
|
### Example of Citation:
|
||||||
If the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like so:
|
If the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:
|
||||||
* "According to the study, the proposed method increases efficiency by 20% [1]."
|
* "According to the study, the proposed method increases efficiency by 20% [1]."
|
||||||
|
|
||||||
### Output:
|
### Output:
|
||||||
Provide a clear and direct response to the user's query, including inline citations in the format [source_id] only when the <source_id> tag is present in the context.
|
Provide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.
|
||||||
|
|
||||||
<context>
|
<context>
|
||||||
{{CONTEXT}}
|
{{CONTEXT}}
|
||||||
|
Loading…
Reference in New Issue
Block a user