Feat/add litellm provider#3257
Open
RheagalFire wants to merge 4 commits into
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.
Related Issues
Proposed Changes:
Adds a new
litellm-haystackintegration package with aLiteLLMChatGeneratorcomponent that routes to 100+ LLM providers vialitellm.completion()andlitellm.acompletion().Haystack has 60+ integrations but no LiteLLM integration. Users who want a single component that works across providers (OpenAI, Anthropic, Google, AWS Bedrock, Azure, Cohere, Mistral, Groq, etc.) currently have
no option. LiteLLM is the most popular AI gateway (45k+ stars) and this integration lets users access any supported provider with one component and standard environment variables.
The component supports:
run) and async (run_async) executiondrop_params=Trueby default for cross-provider compatibilityto_dict/from_dict(including Secret, tools, callbacks)Files added:
integrations/litellm/-- full integration packagesrc/.../litellm/chat/chat_generator.py--LiteLLMChatGeneratorcomponenttests/test_litellm_chat_generator.py-- 21 unit testspyproject.toml,README.mdHow did you test it?
Unit tests (21 passed):
Live E2E (Anthropic via Azure AI Foundry):
=== Live completion ===
Reply: OK
Meta: {'model': 'claude-sonnet-4-6', 'finish_reason': 'stop',
'usage': {'prompt_tokens': 13, 'completion_tokens': 4, 'total_tokens': 17}}
=== Streaming ===
Streamed chunks successfully
Full reply: 1, 2, 3, 4, 5
=== System + user messages ===
Reply: Ahoy there, matey! What brings ye to these here waters?
Notes for the reviewer
__init__.pyat namespace levels)litellm>=1.60.0,<2.0is pinned as a required dependency of this package onlylitellm.completion()/litellm.acompletion()directly (not through the OpenAI SDK)drop_params=Truesilently drops provider-unsupported kwargs for cross-provider compatibilityANTHROPIC_API_KEY,OPENAI_API_KEY)Example usage:
Checklist