mirror of https://github.com/kortix-ai/suna.git
tool index
This commit is contained in:
parent
cf13f3af31
commit
308c31e25f
|
@ -109,10 +109,7 @@ class ResponseProcessor:
|
||||||
# For tracking pending tool executions
|
# For tracking pending tool executions
|
||||||
pending_tool_executions = []
|
pending_tool_executions = []
|
||||||
|
|
||||||
# Tool execution index counter
|
# Tool index counter for tracking all tool executions
|
||||||
tool_execution_index = 0
|
|
||||||
|
|
||||||
# Tool index for remaining tools (used at end of function)
|
|
||||||
tool_index = 0
|
tool_index = 0
|
||||||
|
|
||||||
logger.info(f"Starting to process streaming response for thread {thread_id}")
|
logger.info(f"Starting to process streaming response for thread {thread_id}")
|
||||||
|
@ -150,7 +147,7 @@ class ResponseProcessor:
|
||||||
# Create a context for this tool execution
|
# Create a context for this tool execution
|
||||||
context = self._create_tool_context(
|
context = self._create_tool_context(
|
||||||
tool_call=tool_call,
|
tool_call=tool_call,
|
||||||
tool_index=tool_execution_index
|
tool_index=tool_index
|
||||||
)
|
)
|
||||||
|
|
||||||
# Execute tool if needed, but in background
|
# Execute tool if needed, but in background
|
||||||
|
@ -165,12 +162,12 @@ class ResponseProcessor:
|
||||||
pending_tool_executions.append({
|
pending_tool_executions.append({
|
||||||
"task": execution_task,
|
"task": execution_task,
|
||||||
"tool_call": tool_call,
|
"tool_call": tool_call,
|
||||||
"tool_index": tool_execution_index,
|
"tool_index": tool_index,
|
||||||
"context": context
|
"context": context
|
||||||
})
|
})
|
||||||
|
|
||||||
# Increment the tool execution index
|
# Increment the tool index
|
||||||
tool_execution_index += 1
|
tool_index += 1
|
||||||
|
|
||||||
# Immediately continue processing more chunks
|
# Immediately continue processing more chunks
|
||||||
|
|
||||||
|
@ -223,7 +220,7 @@ class ResponseProcessor:
|
||||||
# Create a context for this tool execution
|
# Create a context for this tool execution
|
||||||
context = self._create_tool_context(
|
context = self._create_tool_context(
|
||||||
tool_call=tool_call_data,
|
tool_call=tool_call_data,
|
||||||
tool_index=tool_execution_index
|
tool_index=tool_index
|
||||||
)
|
)
|
||||||
|
|
||||||
# Yield tool execution start message
|
# Yield tool execution start message
|
||||||
|
@ -236,12 +233,12 @@ class ResponseProcessor:
|
||||||
pending_tool_executions.append({
|
pending_tool_executions.append({
|
||||||
"task": execution_task,
|
"task": execution_task,
|
||||||
"tool_call": tool_call_data,
|
"tool_call": tool_call_data,
|
||||||
"tool_index": tool_execution_index,
|
"tool_index": tool_index,
|
||||||
"context": context
|
"context": context
|
||||||
})
|
})
|
||||||
|
|
||||||
# Increment the tool execution index
|
# Increment the tool index
|
||||||
tool_execution_index += 1
|
tool_index += 1
|
||||||
|
|
||||||
# Immediately continue processing more chunks
|
# Immediately continue processing more chunks
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue