fix(chat): preserve provider tool-call metadata
This commit is contained in:
@@ -176,12 +176,13 @@ type ToolResult struct {
|
||||
|
||||
// ToolCall represents a single tool invocation within an agent step
|
||||
type ToolCall struct {
|
||||
ID string `json:"id"` // Function call ID from LLM
|
||||
Name string `json:"name"` // Tool name
|
||||
Args map[string]interface{} `json:"args"` // Tool arguments
|
||||
Result *ToolResult `json:"result"` // Execution result (contains Output)
|
||||
Reflection string `json:"reflection,omitempty"` // Agent's reflection on this tool call result (if enabled)
|
||||
Duration int64 `json:"duration"` // Execution time in milliseconds
|
||||
ID string `json:"id"` // Function call ID from LLM
|
||||
Name string `json:"name"` // Tool name
|
||||
Args map[string]interface{} `json:"args"` // Tool arguments
|
||||
Result *ToolResult `json:"result"` // Execution result (contains Output)
|
||||
Reflection string `json:"reflection,omitempty"` // Agent's reflection on this tool call result (if enabled)
|
||||
Duration int64 `json:"duration"` // Execution time in milliseconds
|
||||
ProviderMetadata ToolCallMetadata `json:"provider_metadata,omitempty"` // Provider-specific tool-call state for replay
|
||||
}
|
||||
|
||||
// AgentStep represents one iteration of the ReAct loop
|
||||
|
||||
@@ -34,11 +34,16 @@ type TokenUsage struct {
|
||||
|
||||
// LLMToolCall represents a function/tool call from the LLM
|
||||
type LLMToolCall struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"` // "function"
|
||||
Function FunctionCall `json:"function"`
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"` // "function"
|
||||
Function FunctionCall `json:"function"`
|
||||
ProviderMetadata ToolCallMetadata `json:"provider_metadata,omitempty"`
|
||||
}
|
||||
|
||||
// ToolCallMetadata carries provider-specific tool-call state that must round-trip
|
||||
// with the assistant tool call, without teaching core agent code vendor fields.
|
||||
type ToolCallMetadata map[string]json.RawMessage
|
||||
|
||||
// FunctionCall represents the function details
|
||||
type FunctionCall struct {
|
||||
Name string `json:"name"`
|
||||
|
||||
Reference in New Issue
Block a user