Spaces:
Runtime error
Runtime error
Update LG_agent.py
Browse files- LG_agent.py +4 -27
LG_agent.py
CHANGED
|
@@ -37,9 +37,10 @@ def assistant(state: AgentState):
|
|
| 37 |
content=(
|
| 38 |
"You are a helpful AI assistant who solves GAIA benchmark questions using step-by-step reasoning.\n"
|
| 39 |
"Before answering, always think out loud and plan your approach.\n"
|
| 40 |
-
"Use tools when you
|
| 41 |
-
"
|
| 42 |
-
"
|
|
|
|
| 43 |
"\nAvailable tools:\n"
|
| 44 |
f"{tool_descriptions}"
|
| 45 |
)
|
|
@@ -108,30 +109,6 @@ def build_graph(max_steps: int = 5):
|
|
| 108 |
|
| 109 |
return state
|
| 110 |
|
| 111 |
-
# def limited_invoke(state):
|
| 112 |
-
# steps = 0
|
| 113 |
-
# while steps < max_steps:
|
| 114 |
-
# print(f"\U0001f501 Step {steps + 1}")
|
| 115 |
-
# state = graph.invoke(state)
|
| 116 |
-
|
| 117 |
-
# for msg in state["messages"]:
|
| 118 |
-
# if isinstance(msg, AIMessage):
|
| 119 |
-
# print("\n🤖 Assistant says:")
|
| 120 |
-
# print("-" * 40)
|
| 121 |
-
# print(msg.content.strip())
|
| 122 |
-
# print("-" * 40)
|
| 123 |
-
|
| 124 |
-
# latest_message = state["messages"][-1] if state["messages"] else None
|
| 125 |
-
|
| 126 |
-
# if isinstance(latest_message, AIMessage):
|
| 127 |
-
# if not getattr(latest_message, "tool_calls", None):
|
| 128 |
-
# print("✅ Final answer detected. Ending loop.")
|
| 129 |
-
# break
|
| 130 |
-
# else:
|
| 131 |
-
# print("🔄 Tool call detected — continuing loop.")
|
| 132 |
-
# steps += 1
|
| 133 |
-
# return state
|
| 134 |
-
|
| 135 |
return limited_invoke
|
| 136 |
|
| 137 |
# 5. BasicAgent class
|
|
|
|
| 37 |
content=(
|
| 38 |
"You are a helpful AI assistant who solves GAIA benchmark questions using step-by-step reasoning.\n"
|
| 39 |
"Before answering, always think out loud and plan your approach.\n"
|
| 40 |
+
"Use tools when you need external data or must transform text.\n"
|
| 41 |
+
"After every tool call, always analyze the result and continue reasoning to arrive at a final answer.\n"
|
| 42 |
+
"Never treat tool outputs as final — interpret them and continue solving the task step-by-step.\n"
|
| 43 |
+
"Finish with a clear and concise answer, such as 'The answer is: right'.\n"
|
| 44 |
"\nAvailable tools:\n"
|
| 45 |
f"{tool_descriptions}"
|
| 46 |
)
|
|
|
|
| 109 |
|
| 110 |
return state
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
return limited_invoke
|
| 113 |
|
| 114 |
# 5. BasicAgent class
|