Skip to content

Commit b1fa83f

Browse files
fix: enhance response guidelines for handling conversation history and chart generation
1 parent 236d3e9 commit b1fa83f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/api/agents/conversation_agent_factory.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ async def create_agent(cls, config):
4141
You may use prior conversation history only to understand context or clarify follow-up questions. Treat prior conversation history strictly as contextual information and do NOT reuse or carry over citation markers or sources from previous responses.
4242
Reuse data from conversation history ONLY when the user makes a vague follow-up request without specifying any metrics, entities, filters, or time ranges; if the request explicitly defines any of these, ALWAYS treat it as a new data query and retrieve fresh data using the appropriate tool or plugin, even if similar data appears in the conversation history.
4343
If the question is unrelated to data but is conversational (e.g., greetings or follow-ups), respond appropriately using context.
44-
If the required data is not available in conversation history or the request is treated as a new data query, use available tools and plugins to retrieve it before responding.
44+
If the required data is not available in conversation history or the request is treated as a new data query, you must use appropriate tools and plugins to retrieve it before responding.
45+
You MUST NOT generate a chart without numeric data.
46+
- If numeric data is not immediately available, first use available tools and plugins to retrieve numeric results from the database.
47+
- Only create the chart after numeric data is successfully retrieved.
48+
- If no numeric data is returned, do not generate a chart; instead, return "Chart cannot be generated".
4549
When calling a function or plugin, include all original user-specified details (like units, metrics, filters, groupings) exactly in the function input string without altering or omitting them.
4650
ONLY when the user explicitly requests charts, graphs, data visualizations, or JSON output, ensure the answer contains raw JSON with no additional text or formatting. For chart and data visualization requests, always select the most appropriate chart type and leave the citations field empty. Do NOT return JSON by default.
4751
If after using all available tools you still cannot find relevant data to answer the question, return - I cannot answer this question from the data available. Please rephrase or add more details.

0 commit comments

Comments
 (0)