Skip to content

The Tuner runs on OpenAI, Claude or a local Ollama model - #20

Merged
engagepy merged 2 commits into
mainfrom
tuner-any-provider
Oct 1, 2026
Merged

engagepy merged 2 commits into
mainfrom
tuner-any-provider

Conversation

@engagepy

@engagepy engagepy commented Oct 1, 2026

Copy link
Copy Markdown
Owner

SLM_AGENT_PROVIDER now picks the model for every agent, the Tuner and its specialists (DataScout, DataPrep) included. Before, they were OpenAI-only.

Provider Key How the Tuner runs
openai (default) OPENAI_API_KEY gpt-6-luna on the Responses API, unchanged
claude ANTHROPIC_API_KEY claude-fable-5-1 through the Agents SDK's LiteLLM extension (openai-agents[litellm])
ollama (experimental) none Ollama's OpenAI-compatible endpoint, qwen2.5:7b-instruct by default

How: tuner/models.py returns what goes in Agent(model=...): a name for OpenAI, a LitellmModel or an OpenAIChatCompletionsModel otherwise. The SDK's runner, sessions, streaming and structured outputs are untouched.

  • Turn setup: prepare_sdk() replaces the OpenAI-only setup before each turn. If the provider's key is missing, it raises with the exact .env path.
  • The app follows the provider: readiness, the key badge and the Tuner header ("experimental" for Ollama) all reflect the chosen provider.
  • Prompts unchanged, by decision: SOTA models from OpenAI and Anthropic should read the same instructions equally well. A test asserts the instructions, tools and settings are identical for every provider.

Checked live:

  • Small agent run: a tool call, streamed text, session memory and a structured report, on each route.
    • OpenAI gpt-6-luna: ✓
    • Ollama qwen2.5:1.5b: ✓
    • the LiteLLM route (Claude's path), pointed at local Ollama: ✓. LiteLLM had to be set to drop settings a model doesn't support (drop_params).
  • A real Tuner turn on Ollama, in a scratch server with all 33 tools: it answered, started no jobs and logged no errors.
  • Not covered: Anthropic's servers weren't called, because there's no ANTHROPIC_API_KEY on this Mac. Worth one real turn with a key before calling Claude supported.

213 tests pass, ruff clean, web build clean. README, AGENTS.md, .env.example and CHANGELOG updated.

🤖 Generated with Claude Code

engagepy and others added 2 commits October 1, 2026 17:09
SLM_AGENT_PROVIDER now picks the model for every agent, the Tuner and its specialists included.
tuner/models.py hands Agent(model=...) the provider's model: the OpenAI model name as before
(Responses API), a LitellmModel for Claude (the Agents SDK's LiteLLM extension), or an
OpenAIChatCompletionsModel on Ollama's OpenAI-compatible endpoint (experimental). The prompts,
tools and settings are unchanged for all three. prepare_sdk() replaces the OpenAI-only setup before
a turn, raising with the exact .env path when the provider's key is missing; readiness, the key
badge and the Tuner header follow the provider. The default Claude model is claude-fable-5-1.

Checked live: OpenAI (gpt-6-luna) and Ollama (qwen2.5:1.5b) each streamed text, called a tool, kept
session memory and returned a structured report; the LiteLLM route did the same against local
Ollama (with drop_params for unsupported settings); and a real Tuner turn ran on Ollama in a
scratch server. Anthropic itself wasn't called (no key on this Mac).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: engagepy <42845567+engagepy@users.noreply.github.com>
Validating Claude with the owner's new key, the Anthropic account had no credit, and the Tuner
showed "BadRequestError: litellm.BadRequestError: AnthropicException - b'{...}'". readable_error()
pulls out the provider's own message and names the provider ("Anthropic said: Your credit balance
is too low ..."); errors that aren't from a provider keep their text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: engagepy <42845567+engagepy@users.noreply.github.com>
@engagepy

engagepy commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Validated with the owner's Anthropic key. The Claude route is wired end to end: LiteLLM reaches Anthropic, which accepts the key and then refuses with Your credit balance is too low to access the Anthropic API. The Anthropic account has no credit yet, so no Claude model answered. The judge's direct Anthropic SDK path reaches the same billing gate. Also added: the Tuner now shows that kind of failure as one plain line ("Anthropic said: …") instead of LiteLLM's wrapped exception, with a regression test. 214 tests pass. Once credit is added, one Tuner message with SLM_AGENT_PROVIDER=claude completes the check.

@engagepy
engagepy merged commit ea6531e into main Oct 1, 2026
2 checks passed
@engagepy
engagepy deleted the tuner-any-provider branch October 1, 2026 11:45
@engagepy engagepy mentioned this pull request Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant