Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion holmes/core/tool_calling_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ def call( # type: ignore

perf_timing.measure(f"tool completed {tool_call_result.tool_name}")

# Update the tool number offset for the next iteration
tool_number_offset += len(tools_to_call)

# Add a blank line after all tools in this batch complete
if tools_to_call:
logging.info("")
Expand Down Expand Up @@ -602,6 +605,7 @@ def call_stream(
perf_timing.measure("get_all_tools_openai_format")
max_steps = self.max_steps
i = 0
tool_number_offset = 0

while i < max_steps:
i += 1
Expand Down Expand Up @@ -695,7 +699,7 @@ def call_stream(
tool_to_call=t, # type: ignore
previous_tool_calls=tool_calls,
trace_span=DummySpan(), # Streaming mode doesn't support tracing yet
tool_number=tool_index,
tool_number=tool_number_offset + tool_index,
)
)
yield StreamMessage(
Expand All @@ -716,6 +720,9 @@ def call_stream(
data=tool_call_result.as_streaming_tool_result_response(),
)

# Update the tool number offset for the next iteration
tool_number_offset += len(tools_to_call)

raise Exception(
f"Too many LLM calls - exceeded max_steps: {i}/{self.max_steps}"
)
Expand Down
Loading