Skip to content

Commit af2871e

Browse files
authored
Fixing tool failures crashing runners in failover answer (#808)
1 parent a39bec2 commit af2871e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

paperqa/agents/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,11 @@ async def _run_with_timeout_failure(
166166
generate_answer_tool = next(
167167
filter(lambda x: x.info.name == GenerateAnswer.TOOL_FN_NAME, env.tools)
168168
)
169-
await generate_answer_tool._tool_fn(state=env.state)
170-
env.state.record_action(
171-
ToolRequestMessage(tool_calls=[ToolCall.from_tool(generate_answer_tool)])
169+
action = ToolRequestMessage(
170+
tool_calls=[ToolCall.from_tool(generate_answer_tool)]
172171
)
172+
await env.exec_tool_calls(message=action, state=env.state, handle_tool_exc=True)
173+
env.state.record_action(action)
173174
return env.state.session, status
174175

175176

0 commit comments

Comments
 (0)