Skip to content

Commit 508ed25

Browse files
committed
Improve error handling in singleToolCallRun; return error when no tool calls are observed in tool-calling mode
1 parent 75db6cb commit 508ed25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,9 @@ func singleToolCallRun(ctx context.Context, config ProviderConfig, tke *tiktoken
640640
fullResponse := fullResponseContent.String()
641641
tokenList := tke.Encode(fullResponse, nil, nil)
642642
completionTokens := len(tokenList)
643-
644643
if toolCallChunks == 0 {
645644
providerLogger.Printf("[%s] Warning: no tool calls were observed in tool-calling mode (model returned only text/reasoning)", config.Name)
645+
return 0, 0, 0, 0, fullResponse, fmt.Errorf("no tool calls observed in tool-calling mode")
646646
}
647647

648648
providerLogger.Printf(

0 commit comments

Comments
 (0)