返回提交历史
Modified
g4f/client/__init__.py
+2
-2
XFEstudio/gpt4free
Fix finish_reason to return tool_calls when tool calls are present
Agent-Logs-Url: https://github.com/xtekky/gpt4free/sessions/c0d4d1fc-0e31-4a63-8aa1-79132a731019 Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>
90fb39a4
代码差异
1 个文件
+2
-2
@@ -136,7 +136,7 @@ def iter_response(
136
136
else:
137
137
usage = UsageModel.model_construct(**usage.get_dict())
138
138
139
finish_reason = "stop" if finish_reason is None else finish_reason
139
finish_reason = "tool_calls" if tool_calls else ("stop" if finish_reason is None else finish_reason)
140
140
141
141
if stream:
142
142
chat_completion = ChatCompletionChunk.model_construct(
@@ -222,7 +222,7 @@ async def async_iter_response(
222
222
if finish_reason is not None:
223
223
break
224
224
225
finish_reason = "stop" if finish_reason is None else finish_reason
225
finish_reason = "tool_calls" if tool_calls else ("stop" if finish_reason is None else finish_reason)
226
226
227
227
if usage is None:
228
228
usage = UsageModel.model_construct(completion_tokens=idx, total_tokens=idx)