fix(tools): handle json.Marshal error in toolloop tool call arguments
This commit is contained in:
parent
d153952c15
commit
1719067aca
1 changed files with 5 additions and 1 deletions
|
|
@ -132,7 +132,11 @@ func RunToolLoop(
|
||||||
Content: response.Content,
|
Content: response.Content,
|
||||||
}
|
}
|
||||||
for _, tc := range normalizedToolCalls {
|
for _, tc := range normalizedToolCalls {
|
||||||
argumentsJSON, _ := json.Marshal(tc.Arguments)
|
argumentsJSON, err := json.Marshal(tc.Arguments)
|
||||||
|
if err != nil {
|
||||||
|
logger.Warnf("toolloop: failed to marshal tool call arguments for %s: %v", tc.Name, err)
|
||||||
|
argumentsJSON = []byte("{}")
|
||||||
|
}
|
||||||
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
|
assistantMsg.ToolCalls = append(assistantMsg.ToolCalls, providers.ToolCall{
|
||||||
ID: tc.ID,
|
ID: tc.ID,
|
||||||
Type: "function",
|
Type: "function",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue