mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 11:34:13 +00:00
Fix api call for cloudflare API (#467)
This commit is contained in:
@@ -339,19 +339,23 @@ class Provider::Openai < Provider
|
||||
if function_results.any?
|
||||
# Build assistant message with tool_calls
|
||||
tool_calls = function_results.map do |fn_result|
|
||||
# Convert arguments to JSON string if it's not already a string
|
||||
arguments = fn_result[:arguments]
|
||||
arguments_str = arguments.is_a?(String) ? arguments : arguments.to_json
|
||||
|
||||
{
|
||||
id: fn_result[:call_id],
|
||||
type: "function",
|
||||
function: {
|
||||
name: fn_result[:name],
|
||||
arguments: fn_result[:arguments]
|
||||
arguments: arguments_str
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
messages << {
|
||||
role: "assistant",
|
||||
content: nil,
|
||||
content: "", # Some OpenAI-compatible APIs require string, not null
|
||||
tool_calls: tool_calls
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user