Spaces:
Runtime error
Runtime error
Commit ·
a46409c
1
Parent(s): f9eb568
qwen
Browse files- agents/agent.py +6 -20
- system_prompt.txt +17 -0
agents/agent.py
CHANGED
|
@@ -45,22 +45,7 @@ with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
|
| 45 |
system_prompt = f.read()
|
| 46 |
|
| 47 |
# System message
|
| 48 |
-
sys_msg = SystemMessage(content=system_prompt
|
| 49 |
-
|
| 50 |
-
TOOL USAGE REMINDERS:
|
| 51 |
-
- For ANY mathematical calculation, use the math tools (multiply, divide, etc.)
|
| 52 |
-
- For finding specific data or statistics, use web_search tool
|
| 53 |
-
- For complex calculations or data analysis, use execute_code_multilang tool
|
| 54 |
-
- Show your work step by step and verify calculations
|
| 55 |
-
|
| 56 |
-
CRITICAL GAIA ANSWER FORMAT:
|
| 57 |
-
- Give the answer in the simplest, most direct form
|
| 58 |
-
- For numeric questions: Return ONLY the number (e.g., "3" not "3 studio albums")
|
| 59 |
-
- For names: Return ONLY the name (e.g., "FunkMonk" not "FunkMonk nominated...")
|
| 60 |
-
- For yes/no questions: Return ONLY "Yes" or "No"
|
| 61 |
-
- NO explanations, NO context, JUST the answer
|
| 62 |
-
- End your response with "Final Answer: [your answer]"
|
| 63 |
-
""")
|
| 64 |
|
| 65 |
|
| 66 |
tools = [
|
|
@@ -94,10 +79,10 @@ tools = [
|
|
| 94 |
def build_graph():
|
| 95 |
"""Build the graph"""
|
| 96 |
# Load environment variables from .env file
|
| 97 |
-
llm = ChatGroq(model= "
|
| 98 |
temperature=0,
|
| 99 |
-
max_tokens=
|
| 100 |
-
timeout=
|
| 101 |
)
|
| 102 |
|
| 103 |
# Bind tools to LLM
|
|
@@ -107,6 +92,7 @@ def build_graph():
|
|
| 107 |
def assistant(state: MessagesState):
|
| 108 |
"""Assistant node with GAIA format compliance"""
|
| 109 |
response = llm_with_tools.invoke(state["messages"])
|
|
|
|
| 110 |
|
| 111 |
# Extract pure answer for GAIA format
|
| 112 |
content = response.content
|
|
@@ -182,4 +168,4 @@ def build_graph():
|
|
| 182 |
return builder.compile()
|
| 183 |
|
| 184 |
# Add recursion limit
|
| 185 |
-
return builder.compile(checkpointer=None, recursion_limit=
|
|
|
|
| 45 |
system_prompt = f.read()
|
| 46 |
|
| 47 |
# System message
|
| 48 |
+
sys_msg = SystemMessage(content=system_prompt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
tools = [
|
|
|
|
| 79 |
def build_graph():
|
| 80 |
"""Build the graph"""
|
| 81 |
# Load environment variables from .env file
|
| 82 |
+
llm = ChatGroq(model= "qwen-qwq-32b", # llama3-8b-8192 # gemma-7b-it # qwen-qwq-32b #deepseek-r1-distill-llama-70b
|
| 83 |
temperature=0,
|
| 84 |
+
max_tokens=8192,
|
| 85 |
+
timeout=120
|
| 86 |
)
|
| 87 |
|
| 88 |
# Bind tools to LLM
|
|
|
|
| 92 |
def assistant(state: MessagesState):
|
| 93 |
"""Assistant node with GAIA format compliance"""
|
| 94 |
response = llm_with_tools.invoke(state["messages"])
|
| 95 |
+
return {"messages": [response]}
|
| 96 |
|
| 97 |
# Extract pure answer for GAIA format
|
| 98 |
content = response.content
|
|
|
|
| 168 |
return builder.compile()
|
| 169 |
|
| 170 |
# Add recursion limit
|
| 171 |
+
return builder.compile(checkpointer=None, recursion_limit=50)
|
system_prompt.txt
CHANGED
|
@@ -9,6 +9,23 @@ You MUST follow these rules for EVERY question:
|
|
| 9 |
5. For names, give them EXACTLY as requested (e.g., "First Last" or just "Last")
|
| 10 |
6. For lists, use the EXACT separator requested (comma, semicolon, etc.)
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
CRITICAL: Your final answer must match the expected format EXACTLY. No extra words, no explanations, just the answer.
|
| 13 |
|
| 14 |
==========================
|
|
|
|
| 9 |
5. For names, give them EXACTLY as requested (e.g., "First Last" or just "Last")
|
| 10 |
6. For lists, use the EXACT separator requested (comma, semicolon, etc.)
|
| 11 |
|
| 12 |
+
TOOL USAGE REMINDERS:
|
| 13 |
+
- For ANY mathematical calculation, use the math tools (multiply, divide, etc.)
|
| 14 |
+
- For finding specific data or statistics, use web_search tool
|
| 15 |
+
- For complex calculations or data analysis, use execute_code_multilang tool
|
| 16 |
+
- Show your work step by step and verify calculations
|
| 17 |
+
|
| 18 |
+
CRITICAL GAIA ANSWER FORMAT:
|
| 19 |
+
Your FINAL ANSWER must follow these rules:
|
| 20 |
+
- Give ONLY the requested information with no extra text
|
| 21 |
+
- For numbers: Just the number (e.g., "42" not "42 albums" or "The answer is 42")
|
| 22 |
+
- For names: Just the name (e.g., "John Smith" not "The person is John Smith")
|
| 23 |
+
- For dates: Use the exact format requested (e.g., "01/01/2023" or "January 1, 2023")
|
| 24 |
+
- For yes/no: Just "Yes" or "No"
|
| 25 |
+
- For lists: Comma-separated values (e.g., "apple, banana, orange")
|
| 26 |
+
- Always end with: Final Answer: [your answer]
|
| 27 |
+
- The answer after "Final Answer:" should contain ONLY the requested information
|
| 28 |
+
|
| 29 |
CRITICAL: Your final answer must match the expected format EXACTLY. No extra words, no explanations, just the answer.
|
| 30 |
|
| 31 |
==========================
|