Repository navigation
fix(llm): retire providers that discard tool calls - #3899
Conversation
Verdict: Approve with suggestionsThis removes the direct OpenAI and LiteLLM backends — which dropped tool calls and made capable models look unable to act — and turns every legacy way of asking for them into a loud, actionable error instead of a quiet switch to some other backend. The retained Lemonade and Claude paths are untouched, and the migration error is wired into all four entry points a user can reach it from (factory, SDK config, base agent, CLI). Two things worth your attention before merge, neither of which breaks anything at runtime:
Real-world evidenceNo The description does carry CLI evidence matched to the changed surface — The default Lemonade inference path is unchanged by this diff, so the missing agent-eval judge run noted in the description does not look like a gap for this change specifically — but that is a judgement from reading the diff, not from a scorecard. 🔍 Technical detailsIssues🟡 Spec rewrite deletes content unrelated to the removed adapters ( The file goes 1361 → 119 lines. Beyond the OpenAI/LiteLLM material, it removes: the per-provider capability matrix, usage examples 1–10 (streaming, embeddings, vision, model lifecycle, remote server, system prompts), the entire "Third-Party LLM Integration" section (required OpenAI-compatible endpoints, 🟢 Stale OpenAI key guidance in two docs
🟢 Dead Now that 🟢 Subprocess CLI test overrides The root Strengths
|
# Conflicts: # .github/workflows/test_chat_agent.yml
The provider-removal trim had cut the LLM client spec from ~1,360 lines to ~120, taking the Lemonade/Claude reference, capability table, usage examples and troubleshooting with it. Restore that material, removing only what described the retired OpenAI/LiteLLM providers, and correct the third-party section: a generic OpenAI-compatible server is not a drop-in for Lemonade. Also stop documenting OPENAI_API_KEY (nothing reads it), remove use_chatgpt checks that can no longer be true after the migration error, and let the real-CLI regression inherit the full test PYTHONPATH.
|
The LLM client spec is back to full length: the Lemonade/Claude reference, capability table, examples, and troubleshooting are restored, with only the retired OpenAI/LiteLLM material removed. The branch is merged with current One restored section needed a correction. The old third-party page said any OpenAI-compatible server works as a drop-in. The current client also calls Lemonade's model-load API before a local request, so a plain OpenAI-compatible server fails there. The restored section keeps the endpoint shapes, 🔍 Technical detailsMerge Fixes in
Tests: 130 passed / 1 skipped across the removed-provider, factory, Claude, cloud-model, parallel-tool-call, packaged-chat migration, email local-LLM and URL-guard suites. 1026 passed / 50 skipped across |
|
Refreshed this branch against current The update was a clean merge: nothing was resolved by hand, and no commit on this branch was rewritten. CI now runs against an up-to-date base. |
# Conflicts: # setup.py
…st (amd#4183) `main`'s Unit Tests lane is red on py3.10, py3.12 and macOS, and has been since amd#3899 merged. That PR retired the OpenAI provider and deleted `src/gaia/llm/providers/openai_provider.py`, but left a test importing it. The import sits inside the test function and runs for *both* parameters, so the Claude case fails too — it is two failures, not one. Every PR opened against `main` since then inherits a red lane that has nothing to do with its own change. This keeps the Claude case (the only cloud provider left) and drops the OpenAI half, and clears the same retirement's leftover file references in `CLAUDE.md` and three agent docs so they stop pointing at a file that no longer exists. ## Test plan - [x] `python -m pytest tests/unit/test_chat_system_prompt_owner.py -q` — 15 pass. On `origin/main` the same command gives 2 failed / 14 passed: ``` FAILED test_cloud_provider_receives_native_system_prompt[openai] - ModuleNotFoundError: No module named 'gaia.llm.providers.openai_provider' FAILED test_cloud_provider_receives_native_system_prompt[claude] - (same) ``` - [x] `python util/lint.py --black --isort` — pass. - [x] `grep -rn openai_provider CLAUDE.md .claude/agents/ tests/ src/` — no remaining references.
main is broken: `test_chat_system_prompt_owner.py` (added by amd#3864) still imports `OpenAIProvider` directly, which amd#3899 deleted as an intentional API break. amd#3899's own validation command never ran this file, so the collision only showed up once both merged. Every non-Claude cloud model now goes through `LemonadeProvider` — its wire shape (system prompt folded into `messages[0]`) is exactly what this test needs to exercise, so the fix swaps the mock target from a raw OpenAI SDK client to `LemonadeProvider._backend` instead of reintroducing the deleted class. ## Test plan - [x] `python -m pytest tests/unit/test_chat_system_prompt_owner.py -q` — 16 passed - [x] `python -m pytest tests/unit/ -k "chat_sdk or system_prompt or lemonade_provider or test_claude_provider or test_removed_llm_providers"` — 134 passed - [x] `git grep` confirms no other references to the removed `OpenAIProvider`/`openai_provider` module remain Co-authored-by: f <f@f>
Replicates amd#4063 (kovtcharov/gaia fork, push access blocked) onto a branch this session can push to. Cloud reasoning models such as `fireworks.deepseek-v4p1-flash` count their thinking against the agent's per-reply output cap. That cap was fixed at 8,192 tokens, which was sized for a local 32K context. On TheRock coding tasks, all three failed runs ended with a reply at exactly 8,192 tokens. Lemonade cloud models now get 32,768 output tokens, the same default Claude Code uses. Local models keep 8,192. Callers can set their own cap with a new optional `max_output_tokens` on the agent. - Replies that got cut off already continue since amd#4054, but each cut-off costs an extra round trip and drops thinking. This cuts off far fewer replies. - Claude keeps its current default. An explicit cap now reaches it, with one exception: Claude's existing 8,192 minimum still raises any smaller explicit value. One change beyond the original: `main` removed the openai/litellm providers (amd#3899), so `use_chatgpt` now raises a migration error at construction. The original PR's OpenAI request-cap test exercised that removed provider and has been dropped, along with a `use_chatgpt` term in the cap expression that can never be True. No other content changes beyond conflict resolution against current main. ## Test plan - [x] `pytest tests/unit/test_agent_max_output_tokens.py tests/unit/test_tool_call_priority.py` — 43 passed. These check the JSON body sent to Lemonade and expect `max_completion_tokens` 32768 for a cloud model and 8192 for a local model, plus an explicit override, a model switch mid-session, a custom provider flagged by catalog metadata, and the Claude request kwargs. - [x] `pytest tests/unit/agents` — 1422 passed, 50 skipped; identical on unmodified `main`. - [x] `python util/lint.py --black --isort` clean. - [ ] `gaia eval agent --category tool_selection` Carried over from the review on amd#4063, not addressed here: the cap is computed twice (once into `AgentConfig.max_tokens` at init, once per call in `_max_output_tokens()`), so memory-distillation and builder paths can disagree with the main loop for a catalog-flagged custom provider; and the streaming call sites have no test. --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
`8e959ee62` dropped `maxsize=100` from `process_voice_input`'s TTS queue while leaving the docstring saying the queue is bounded and the `except queue.Full` branch below it in place. Without a maxsize that branch cannot fire, so the drop-on-full guard was retired silently — `speak_text`, the path `gaia talk` takes, kept its bound and its inline reason, which is what makes this read as an oversight. Bound restored. The test that pinned the guard could not catch this: it asserts the latch variable appears in the method's source, which stayed true. It now also asserts the queue is constructed with a maxsize, and fails when the bound is removed. `process_voice_input` is the processor the audio-client spec tells integrators to pass to `start_voice_chat`, so the docstring being true is not academic. Merge resolution in `talk/sdk.py`: main retired the openai/litellm providers (amd#3899) and reworded `use_chatgpt`'s comment; this branch added `claude_model` and `base_url`, which main does not have. Kept all three. That retirement also made two talk-flag tests wrong: `--use-chatgpt` no longer reaches any client, it exits with migration guidance. The flag is out of the wiring table, and its own test now asserts the refusal names both the removal and Lemonade as the way forward, with and without `--model`. The talk guide and CLI reference still advertised the flag as working, contradicting `docs/sdk/sdks/llm.mdx`; both now describe it as removed.
…d parsers `main` moved `--use-claude`/`--claude-model` off `parent_parser` onto a dedicated `claude_parser` while this branch was making every talk flag reach the client that uses it. The merge keeps `main`'s parser split and re-applies this branch's single source for the Claude default, so `gaia talk --use-claude` and `TalkSDK(TalkConfig(use_claude=True))` still land on the same model and the CLI reference matches what `--help` prints. Also drops the `gaia talk --use-chatgpt needs --model` guard: amd#3899 retired the provider, so `main()` refuses the flag before that branch can run and its advice ("pass --model") names a fix that no longer exists.
The direct OpenAI and LiteLLM adapters silently discarded tool calls, making capable models appear unable to act. Remove those adapters and route local/on-prem model configuration through Lemonade. Legacy provider names and
use_openai/use_chatgptflags now fail with migration guidance before inference; they never silently select another backend. The OpenAI HTTP-client dependency stays.Closes #3811. Related to #3630. Direct imports of the removed classes are an intentional API break. The docs and packaged chat changelog explain migration.
Test plan
python -m gaia.cli llm --use-chatgpt helloexits 2 with “providers … were removed because they discarded tool calls” and the gateway-migration link.🔍 Technical details
Validation command (with flagship source available):
The broad legacy
tests/test_sdk.pysuite has 17 failures reproduced identically on base481a0972; these are not counted as passes. Its separate real-server SDK suite skipped because it hardcodes unavailable port 13305. No live model-quality claim is made. The context-retention judge is currently blocked by its weekly usage limit.