Skip to content

Commit 3fa0201

Browse files
add more logs for tool calling
1 parent edc3e27 commit 3fa0201

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

llm-service/app/services/query/agents/crewai_querier.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ def assemble_crew(
140140
"You know when to use tools and when to answer directly.",
141141
llm=crewai_llm,
142142
verbose=True,
143+
step_callback=lambda output: step_callback(
144+
output, "Tool Result", crew_events_queue
145+
),
143146
)
144147

145148
# Define tasks for the researcher agents

llm-service/app/services/query/crew_events.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
from crewai import TaskOutput
4444
from crewai.agents.parser import AgentFinish
45+
from crewai.tools.tool_types import ToolResult
4546

4647
from pydantic import BaseModel
4748

@@ -72,3 +73,13 @@ def step_callback(output: Any, agent: str, crew_events_queue: Queue[CrewEvent])
7273
timestamp=time.time(),
7374
)
7475
)
76+
77+
if isinstance(output, ToolResult):
78+
crew_events_queue.put(
79+
CrewEvent(
80+
type="tool_result",
81+
name=agent,
82+
data=output.result,
83+
timestamp=time.time(),
84+
)
85+
)

0 commit comments

Comments
 (0)