gpt4free/etc
Marcos Vinícius Claudiano 405868c576
feat: add tool_call emulation for OpenAI API (#3352)
* feat: add tool_call emulation for OpenAI API

Avoid forcing PollinationsAI when tools are present, and add an opt-in tool_emulation mode (or G4F_TOOL_EMULATION=1) to emit OpenAI-compatible tool_calls for providers that ignore tools.

* fix: avoid duplicate stream kwarg in tool emulation

Tool emulation calls the upstream provider with stream=False; remove stream/stream_timeout from forwarded kwargs to prevent conflicts.

* fix: prefer non-auth providers when api_key missing

When routing via AnyProvider without an api_key, try providers with needs_auth=false first to reduce MissingAuthError for tool-enabled clients like MarksCode.

* test: cover tool call emulation

Route tool_emulation through ToolSupportProvider (avoid circular imports) and add unittest coverage for multi-tool JSON plans and run_tools integration.
2026-02-09 12:01:52 +01:00
..
examples feat: add AI Badgr as OpenAI-compatible provider 2025-12-11 08:26:45 +10:00
testing Refactor API base URL references across providers 2025-12-25 22:09:20 +01:00
tool Enhance template.html with improved structure and styling; add table of contents, translation button, and accessibility features. 2025-10-04 15:15:23 +02:00
unittest feat: add tool_call emulation for OpenAI API (#3352) 2026-02-09 12:01:52 +01:00