Feat/add litellm provider#91
Open
RheagalFire wants to merge 3 commits intoSkyworkAI:mainfrom
Open
Conversation
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
ChatLiteLLMclient usinglitellm.acompletion()directly, follows the same Pydantic BaseModel + async__call__pattern asChatOpenAI,ChatOpenRouter,ChatAnthropic, andChatGoogleMotivation
DeepResearchAgent currently supports OpenAI, OpenRouter, Anthropic, and Google as LLM providers, each with its own dedicated client class using raw provider SDKs. Adding LiteLLM gives users access to 100+
additional providers (Azure, Bedrock, Vertex, Groq, Together, Ollama, etc.) through the same pattern. Since every existing provider uses raw SDKs (not LangChain),
ChatLiteLLMfollows the same approach bycalling
litellm.acompletion()directly.Changes
src/model/litellm/__init__.py- module initsrc/model/litellm/chat.py-ChatLiteLLMclient class with:litellm.acompletion()for async completion (lazy-imported)drop_params=Truefor cross-provider kwargs compatibilityOpenAIChatSerializerfor message/tool formatting (same as OpenAI/OpenRouter)ChatOpenAIsrc/model/manager.py- registeredlitellmprovider:ChatLiteLLMimport_initialize_litellm_models()(auto-registers whenLITELLM_MODELenv var is set)_create_client()with litellm branchregister_model()validation to accept"litellm"requirements.txt- addedlitellm>=1.60.0,<2.0.0tests/test_litellm.py- unit tests covering instantiation, properties,drop_params=True, tool calls, import error handling, manager registrationTests
1. Code verification (AST parse):
$ python -c "import ast; ..."
Classes: ['ChatLiteLLM']
Async methods: ['call', '_format_response']
PASS: AST parse valid, all required methods and patterns present
PASS: manager.py correctly imports and registers litellm
2. Lint (ruff):
$ ruff check src/model/litellm/
All checks passed!
$ ruff format --check src/model/litellm/
2 files already formatted
3. Tests (mocked litellm):
test_call_dispatches_to_litellm_acompletion- verifies model, drop_params, api_key forwardedtest_call_includes_drop_params_true- ensures cross-provider compat defaulttest_call_handles_tool_calls- verifies function calling response parsingtest_call_returns_failure_on_import_error- graceful ImportError when litellm not installedtest_litellm_in_allowed_providers- manager accepts litellm providerExample usage
See https://docs.litellm.ai/docs/providers for 100+ supported model strings.
Risk / Compatibility