Feat/add litellm provider - #384
Open
RheagalFire wants to merge 2 commits into
Open
Conversation
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pip install mobilerun[litellm]), keeping the base install unaffected.import litellm/litellm.completion()) with a customMobilerunLiteLLMwrapper extending llama-index'sCustomLLM.Changes
pyproject.toml- Addedlitellmoptional dependency group withlitellm>=1.83.0,<2.0.0mobilerun/agent/providers/registry.py- Added LiteLLM provider family with API key auth mode and env key slotmobilerun/agent/utils/llm_picker.py- AddedMobilerunLiteLLMclass (extendsCustomLLM, callslitellm.completion()/litellm.acompletion()directly withdrop_params=True), registered inSUPPORTED_PROVIDERS,PROVIDER_ALIASES, andload_llm()dispatchmobilerun/agent/usage.py- Added LiteLLM to supported providers list, alias map, and usage extraction (prompt_tokens, completion_tokens, total_tokens)mobilerun/cli/main.py- Updated CLI--providerhelp text to include LiteLLMREADME.md- Added LiteLLM to feature list and installation instructionstests/test_llm_picker.py- 9 tests: alias resolution, class loading, base_url translation, provider/model format, bare model name, API key forwarding, temperature forwarding, max_tokens forwarding, unsupported provider errortests/test_provider_registry.py- 1 test: provider family variant resolutiontests/test_usage.py- 6 tests: usage extraction, tracker support, null usage fallback, dict raw response, total computation from parts, no-raw-response errorTests
1. Unit tests (71/71 passing):
2. Lint:
ruff check mobilerun/ tests/-> All checks passed.3. Live E2E against Anthropic (via Azure Foundry):
4. Pin resolution verified:
pip install -e '.[litellm]'resolves cleanly againstlitellm>=1.83.0,<2.0.0.Risk / Compatibility
litellmis an optional extra - base install and all existing providers remain unaffected.import litellm) - no additional wrapper packages needed.mobilerun configurewizard automatically via the provider family registry.Example usage
CLI:
Python SDK: