feat: add LiteLLM as AI gateway engine#191
Open
RheagalFire wants to merge 1 commit into
Open
Conversation
Author
Author
|
@eric-xw do you have any update on this PR? |
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
LMMEngineLiteLLMas a new engine type across all Agent-S versions (s2, s2_5, s3)LMMEnginepattern used by the existing 8 enginesWhat kind of change does this PR introduce? Feature, adds LiteLLM as a new LLM engine
Why was this change needed? Agent-S currently has 8 individual LLM engines (OpenAI, Anthropic, Gemini, Azure, OpenRouter, vLLM, HuggingFace, Parasail), each maintained separately. LiteLLM provides a
unified interface to 100+ LLM providers through a single
completion()call. Users switch providers by changing the model string, no code changes needed.Other information: See sections below.
What Changed
gui_agents/s2/core/engine.pyLMMEngineLiteLLMclassgui_agents/s2/core/mllm.pylitellmengine type +isinstancecheckgui_agents/s2_5/core/engine.pyLMMEngineLiteLLMclassgui_agents/s2_5/core/mllm.pylitellmengine type +isinstancecheckgui_agents/s3/core/engine.pyLMMEngineLiteLLMclassgui_agents/s3/core/mllm.pylitellmengine type +isinstancechecksetup.pylitellm>=1.60.0,<2.0.0requirements.txtlitellm>=1.60.0,<2.0.0tests/test_litellm_engine.pyUsage
Quick Start
Provider API keys are read from standard environment variables automatically (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.), or pass api_key in engine_params.
Any of the https://docs.litellm.ai/docs/providers works.
Direct Engine Usage (Without LMMAgent)
Testing
Unit Tests (15/15 Passing)
Live E2E (Azure AI Foundry, Claude Sonnet via LiteLLM)
Model: azure_ai/claude-sonnet-4-6
LMMEngineLiteLLM.generate() -> "4"
LMMAgent.get_response() -> "1, 2, 3"
Risk / Compatibility