XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

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
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
提交于

代码差异

1 个文件 +2 -2
Modified g4f/client/__init__.py +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)