|
@@ -1181,21 +1181,30 @@ CHUNK_OVERLAP = PersistentConfig(
|
|
|
int(os.environ.get("CHUNK_OVERLAP", "100")),
|
|
|
)
|
|
|
|
|
|
-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.
|
|
|
+DEFAULT_RAG_TEMPLATE = """### Task:
|
|
|
+Respond to the user query using the provided context, incorporating inline citations in the format [source_id].
|
|
|
+
|
|
|
+### Guidelines:
|
|
|
+- If you don't know the answer, clearly state that.
|
|
|
+- If uncertain, ask the user for clarification.
|
|
|
+- 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 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.
|
|
|
+- Include inline citations using [source_id] corresponding to the sources listed in the context.
|
|
|
+- Do not use XML tags in your response.
|
|
|
+- Ensure citations are concise and directly related to the information provided.
|
|
|
+
|
|
|
+### Example of Citation:
|
|
|
+If the user asks about a specific topic and the information is found in "whitepaper.pdf", the response should include the citation like so:
|
|
|
+* "According to the study, the proposed method increases efficiency by 20% [whitepaper.pdf]."
|
|
|
+
|
|
|
+### Output:
|
|
|
+Provide a clear and direct response to the user's query, including inline citations in the format [source_id] where relevant.
|
|
|
|
|
|
<context>
|
|
|
{{CONTEXT}}
|
|
|
</context>
|
|
|
|
|
|
-<rules>
|
|
|
-- If you don't know, just say so.
|
|
|
-- If you are not sure, ask for clarification.
|
|
|
-- Answer in the same language as the user query.
|
|
|
-- 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>
|
|
|
-
|
|
|
<user_query>
|
|
|
{{QUERY}}
|
|
|
</user_query>
|