fix(llm): correct LiteLLM embed() model override + finish #1593 review items#1626
Conversation
embed() raised TypeError when a caller overrode the model: model was passed both explicitly and via **call_kwargs. Pop model before building call_kwargs, and add embed() tests (default + override) — the override case reproduces the crash. Also addresses the remaining #1593 review items: - Drop the redundant global litellm.drop_params mutation; default drop_params per-call via setdefault so callers can override it. - Validate the optional litellm dependency at construction with an actionable ImportError. - Document the litellm provider in the Cloud Providers guide. - List litellm in the create_client docstring. Refs #1625
Real-world validationVerified end-to-end on an AMD Strix Halo (Ryzen AI) box against a live Lemonade backend (OpenAI-compatible), installed via
Unit: |
SummaryClean, focused fix that closes out the remaining #1593 review items. The headline change is a real bug: Issues Found🟢 Minor — shell-globbing in install hints ( In the docs: And in Strengths
VerdictApprove with suggestions — the embed fix is correct and tested, and the rest is tidy cleanup. The only items are the optional zsh-quoting nits in the install hints; safe to merge once those are applied (or consciously skipped). |
zsh (default macOS shell) globs the brackets in an unquoted gaia[litellm], failing with 'no matches found'. Quote the install hint in the docs and the ImportError message so it copy-pastes in bash and zsh alike.
|
Applied the zsh-quoting suggestion in |
The fail-fast 'import litellm' in __init__ was unused, so pylint flagged W0611 (unused-import); the # noqa: F401 only silenced flake8, not pylint. Keep a reference (self._litellm) and use it from chat()/embed() instead of re-importing per call — the import is now genuinely used, no suppressions.
Closes #1625
Why this matters
After #1593 added the LiteLLM provider,
LiteLLMProvider.embed()crashed withTypeError: embedding() got multiple values for keyword argument 'model'the moment a caller overrode the model —modelwas passed both explicitly and inside the spread**call_kwargs, and that path had zero test coverage. Nowembed()works with and without a model override, and the rest of the #1593 review is closed out: the provider is documented, thecreate_clientdocstring lists it, and the redundantdrop_paramshandling is collapsed to a single per-call default callers can override.Test plan
pytest tests/unit/test_litellm_provider.py→ 12 passed (incl. 2 newembed()tests; the override test reproduced theTypeErrorbefore the fix)util/lint.py --black --isort --flake8→ all PASS