Feat/add litellm provider#222
Open
RheagalFire wants to merge 2 commits intoTHUDM:mainfrom
Open
Conversation
Author
|
cc @Xiao9905 |
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
LiteLLMAgentextendingAgentClient, routing to 100+ LLM providers vialitellm.completion()InstanceFactorysystem out of the boxMotivation
AgentBench currently supports OpenAI-compatible HTTP endpoints, Claude (legacy completions API), and FastChat. Researchers who want to benchmark against Groq, Mistral, AWS Bedrock, Azure, Together, Fireworks, or
any of 100+ other providers must set up a separate HTTP proxy. LiteLLM handles provider routing natively, letting researchers benchmark any model with a single config change.
Changes
src/client/agents/litellm_agent.py-- newLiteLLMAgent(AgentClient)withinference()methodsrc/client/agents/__init__.py-- registered importrequirements.txt-- addedlitellm>=1.60.0,<2.0tests/test_litellm_agent.py-- 21 unit testsImplementation details
"agent"role to LiteLLM's"assistant"rolecheck_context_limit()fromhttp_agent.pyfor context-limit detection (same AND-rule as HTTPAgent, avoids false positives on rate-limit/auth errors)Nonecontent from providers (returns""instead of crashingAgentOutputvalidator)AgentClientExceptionand re-raises immediately (matches HTTPAgent pattern)AuthenticationError,BadRequestError,NotFoundError) fail immediately without retryingdrop_params=Truefor cross-provider compatibilityimport litellminsideinference()so the base install works without litellmmodel_nameattribute fortask.pyerror reportingTesting
Unit tests (21 passed):
Example usage
YAML config (
configs/agents/litellm.yaml):Python:
Risk / Compatibility