feat: add LiteLLM as provider for 100+ LLM backends#299
Open
RheagalFire wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new LiteLLM-backed LLM provider intended to route scans through many LiteLLM-supported backends via the existing provider abstraction and factory.
Changes:
- Introduces
LiteLLMProviderwith sync/asyncgenerateandchatimplementations. - Registers and exports the provider through the LLM provider package and factory.
- Adds unit tests for initialization, request kwargs, response parsing, errors, and factory behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
agentic_security/llm_providers/litellm_provider.py |
Adds the LiteLLM provider implementation. |
agentic_security/llm_providers/factory.py |
Registers litellm as a built-in provider. |
agentic_security/llm_providers/__init__.py |
Exports LiteLLMProvider from the provider package. |
tests/unit/llm_providers/test_litellm_provider.py |
Adds unit coverage for the new provider. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| from typing import Any | ||
|
|
||
| import litellm |
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.
cc @msoedov
Summary
Adds LiteLLM as a provider, enabling vulnerability scanning against any of LiteLLM's 100+ supported LLM backends (OpenAI, Anthropic, Google, Groq, Together AI, AWS Bedrock, Azure, Mistral, etc.) through a single provider class.
Changes
agentic_security/llm_providers/litellm_provider.pyLiteLLMProvider(BaseLLMProvider)with async/syncgenerate()andchat(). Usesdrop_params=Truefor cross-provider compat. Mapslitellm.exceptions.RateLimitErrortoLLMRateLimitError.agentic_security/llm_providers/factory.py"litellm"in_PROVIDERSdict.agentic_security/llm_providers/__init__.pyLiteLLMProvider.tests/unit/llm_providers/test_litellm_provider.pyTests
LiteLLM provider tests -- 29 passed:
Full unit suite -- 317 passed, 0 failures:
Lint:
Edge cases covered:
drop_params=Truealways setLLMRateLimitErrorLLMProviderErrorExample usage
Any LiteLLM model string works. See LiteLLM provider docs for the full list.