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

XFEstudio/gpt4free

Update tool support with puter

308d1117
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +12 -0
Modified g4f/Provider/needs_auth/PuterJS.py +12 -0
@@ -350,12 +350,24 @@ class PuterJS(AsyncGeneratorProvider, ProviderModelMixin):
350 350 if finish_reason:
351 351 yield FinishReason(finish_reason)
352 352 elif mime_type.startswith("application/x-ndjson"):
353 tools_idx = 0
353 354 async for line in response.content:
354 355 data = json.loads(line)
355 356 if data.get("type") == "text":
356 357 yield data.get("text", "")
357 358 elif data.get("type") == "reasoning":
358 359 yield Reasoning(data.get("reasoning", ""))
360 elif data.get("type") == "tool_use":
361 yield ToolCalls([{
362 "id": tools_idx,
363 "type": "function",
364 "id": data.get("id"),
365 "function": {
366 "name": data.get("name"),
367 "arguments": data.get("input")
368 }}
369 ])
370 tools_idx += 1
359 371 elif data.get("type") == "tool_calls":
360 372 yield ToolCalls(data.get("tool_calls", []))
361 373 elif data.get("type") == "usage":