Skip to content

refactor: replace LiteLLM with OpenAI mixin for WatsonX provider (backport #5133) - #6329

Open
are-ces wants to merge 3 commits into
ogx-ai:release-0.6.xfrom
are-ces:backport/pr-5133-release-0.6.x
Open

refactor: replace LiteLLM with OpenAI mixin for WatsonX provider (backport #5133)#6329
are-ces wants to merge 3 commits into
ogx-ai:release-0.6.xfrom
are-ces:backport/pr-5133-release-0.6.x

Conversation

@are-ces

@are-ces are-ces commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport of #5133 to release-0.6.x.

This cherry-picks the refactor that replaces LiteLLM with the OpenAI mixin for the WatsonX inference provider.

Why this backport is needed: We are shipping llama-stack 0.6 and need WatsonX as an inference provider. The current WatsonX provider (via LiteLLM) does not work with the Responses API due to a mismatch between how LiteLLM returns packets and how Llama Stack expects them. LCORE needs WatsonX support with a working Responses API, which this refactor fixes by removing the LiteLLM dependency.

Merge conflicts were resolved during cherry-pick — all resolutions accept the incoming PR changes in full.

Changes

  • Replaces LiteLLM-based WatsonX provider with OpenAI mixin-based implementation
  • Adds WatsonX provider configuration to CI test distributions
  • Adds WatsonX and Azure test setups and model registrations
  • Adds WatsonX-specific test skips where features are unsupported
  • Adds service_tier, stream_options, and usage tests for responses API

Test plan

  • CI passes on the release-0.6.x branch
  • WatsonX inference provider works with Responses API (streaming + non-streaming)

…-ai#5133)

- Replace `LiteLLMOpenAIMixin` with `OpenAIMixin` for the WatsonX
inference provider — WatsonX has an OpenAI-compatible
`/v1/chat/completions` endpoint, making LiteLLM unnecessary
- Use `AsyncOpenAI` client directly with IAM token authentication (API
key → IAM token exchange with caching)
- Inject `project_id` via `extra_body` on every request (WatsonX
requires it in the request body)
- Remove `litellm` from `pip_packages` in provider registry
- Raise `NotImplementedError` for `/v1/completions` (unsupported by
WatsonX)
- Add watsonx provider + model (`meta-llama/llama-3-3-70b-instruct`) to
ci-tests distribution
- Add watsonx-specific test skips for unsupported features
- Remove false file search filter skips (those failures were due to
missing local `sentence_transformers`, not WatsonX)

This removes ~130 lines of LiteLLM workarounds (stream normalization,
usage injection, missing attribute patching).

- [x] Run responses suite with `--setup watsonx --inference-mode live`:
77 passed, 0 failures
- [x] Run base suite with `--setup watsonx --inference-mode live`: 187
passed, all failures unrelated to WatsonX (missing local deps, missing
providers)
- [x] Verify IAM token exchange and caching works
- [x] Verify `project_id` injection via `extra_body` reaches WatsonX API
- [x] Verify tool calling works with `llama-3-3-70b-instruct`
- [ ] CI passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
are-ces and others added 2 commits July 21, 2026 14:42
The cherry-pick from main brought in the inline::transformers provider
entry which does not exist on the release-0.6.x branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These tests were part of the cherry-pick but test server-side features
(service_tier, stream_options) that are not available on release-0.6.x.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants