(Bug Fix) Using LiteLLM Python SDK with model=litellm_proxy/ for embedding, image_generation, transcription, speech, rerank (#8815)

* test_litellm_gateway_from_sdk

* fix embedding check for openai

* test litellm proxy provider

* fix image generation openai compatible models

* fix litellm.transcription

* test_litellm_gateway_from_sdk_rerank

* docs litellm python sdk

* docs litellm python sdk with proxy

* test_litellm_gateway_from_sdk_rerank

* ci/cd run again

* test_litellm_gateway_from_sdk_image_generation

* test_litellm_gateway_from_sdk_embedding

* test_litellm_gateway_from_sdk_embedding
This commit is contained in:
Ishaan Jaff 2025-02-25 16:22:37 -08:00 committed by GitHub
parent ef22209a15
commit f9cee4c46b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 466 additions and 83 deletions

View file

@ -75,7 +75,7 @@ def rerank( # noqa: PLR0915
query: str,
documents: List[Union[str, Dict[str, Any]]],
custom_llm_provider: Optional[
Literal["cohere", "together_ai", "azure_ai", "infinity"]
Literal["cohere", "together_ai", "azure_ai", "infinity", "litellm_proxy"]
] = None,
top_n: Optional[int] = None,
rank_fields: Optional[List[str]] = None,
@ -162,7 +162,7 @@ def rerank( # noqa: PLR0915
)
# Implement rerank logic here based on the custom_llm_provider
if _custom_llm_provider == "cohere":
if _custom_llm_provider == "cohere" or _custom_llm_provider == "litellm_proxy":
# Implement Cohere rerank logic
api_key: Optional[str] = (
dynamic_api_key or optional_params.api_key or litellm.api_key