150
150
from .llms .custom_llm import CustomLLM , custom_chat_llm_router
151
151
from .llms .databricks .embed .handler import DatabricksEmbeddingHandler
152
152
from .llms .deprecated_providers import aleph_alpha , palm
153
+ from .llms .gemini .common_utils import get_api_key_from_env
153
154
from .llms .groq .chat .handler import GroqChatCompletion
154
155
from .llms .heroku .chat .transformation import HerokuChatConfig
155
- from .llms .gemini .common_utils import get_api_key_from_env
156
156
from .llms .huggingface .embedding .handler import HuggingFaceEmbedding
157
157
from .llms .nlp_cloud .chat .handler import completion as nlp_cloud_chat_completion
158
158
from .llms .oci .chat .transformation import OCIChatConfig
@@ -358,7 +358,9 @@ async def acompletion(
358
358
logprobs : Optional [bool ] = None ,
359
359
top_logprobs : Optional [int ] = None ,
360
360
deployment_id = None ,
361
- reasoning_effort : Optional [Literal ["none" , "minimal" , "low" , "medium" , "high" , "default" ]] = None ,
361
+ reasoning_effort : Optional [
362
+ Literal ["none" , "minimal" , "low" , "medium" , "high" , "default" ]
363
+ ] = None ,
362
364
safety_identifier : Optional [str ] = None ,
363
365
# set api_base, api_version, api_key
364
366
base_url : Optional [str ] = None ,
@@ -504,7 +506,9 @@ async def acompletion(
504
506
}
505
507
if custom_llm_provider is None :
506
508
_ , custom_llm_provider , _ , _ = get_llm_provider (
507
- model = model , custom_llm_provider = custom_llm_provider , api_base = completion_kwargs .get ("base_url" , None )
509
+ model = model ,
510
+ custom_llm_provider = custom_llm_provider ,
511
+ api_base = completion_kwargs .get ("base_url" , None ),
508
512
)
509
513
510
514
fallbacks = fallbacks or litellm .model_fallbacks
@@ -899,7 +903,9 @@ def completion( # type: ignore # noqa: PLR0915
899
903
logit_bias : Optional [dict ] = None ,
900
904
user : Optional [str ] = None ,
901
905
# openai v1.0+ new params
902
- reasoning_effort : Optional [Literal ["none" , "minimal" , "low" , "medium" , "high" , "default" ]] = None ,
906
+ reasoning_effort : Optional [
907
+ Literal ["none" , "minimal" , "low" , "medium" , "high" , "default" ]
908
+ ] = None ,
903
909
response_format : Optional [Union [dict , Type [BaseModel ]]] = None ,
904
910
seed : Optional [int ] = None ,
905
911
tools : Optional [List ] = None ,
@@ -1116,10 +1122,12 @@ def completion( # type: ignore # noqa: PLR0915
1116
1122
)
1117
1123
1118
1124
if provider_specific_header is not None :
1119
- headers .update (ProviderSpecificHeaderUtils .get_provider_specific_headers (
1120
- provider_specific_header = provider_specific_header ,
1121
- custom_llm_provider = custom_llm_provider ,
1122
- ))
1125
+ headers .update (
1126
+ ProviderSpecificHeaderUtils .get_provider_specific_headers (
1127
+ provider_specific_header = provider_specific_header ,
1128
+ custom_llm_provider = custom_llm_provider ,
1129
+ )
1130
+ )
1123
1131
1124
1132
if model_response is not None and hasattr (model_response , "_hidden_params" ):
1125
1133
model_response ._hidden_params ["custom_llm_provider" ] = custom_llm_provider
@@ -1325,6 +1333,7 @@ def completion( # type: ignore # noqa: PLR0915
1325
1333
azure_scope = kwargs .get ("azure_scope" ),
1326
1334
max_retries = max_retries ,
1327
1335
timeout = timeout ,
1336
+ litellm_request_debug = kwargs .get ("litellm_request_debug" , False ),
1328
1337
)
1329
1338
cast (LiteLLMLoggingObj , logging ).update_environment_variables (
1330
1339
model = model ,
@@ -2712,9 +2721,7 @@ def completion( # type: ignore # noqa: PLR0915
2712
2721
)
2713
2722
2714
2723
api_key = (
2715
- api_key
2716
- or litellm .api_key
2717
- or get_secret ("VERCEL_AI_GATEWAY_API_KEY" )
2724
+ api_key or litellm .api_key or get_secret ("VERCEL_AI_GATEWAY_API_KEY" )
2718
2725
)
2719
2726
2720
2727
vercel_site_url = get_secret ("VERCEL_SITE_URL" ) or "https://litellm.ai"
@@ -2730,7 +2737,7 @@ def completion( # type: ignore # noqa: PLR0915
2730
2737
vercel_headers .update (_headers )
2731
2738
2732
2739
headers = vercel_headers
2733
-
2740
+
2734
2741
## Load Config
2735
2742
config = litellm .VercelAIGatewayConfig .get_config ()
2736
2743
for k , v in config .items ():
@@ -3712,7 +3719,9 @@ async def aembedding(*args, **kwargs) -> EmbeddingResponse:
3712
3719
func_with_context = partial (ctx .run , func )
3713
3720
3714
3721
_ , custom_llm_provider , _ , _ = get_llm_provider (
3715
- model = model , custom_llm_provider = custom_llm_provider , api_base = kwargs .get ("api_base" , None )
3722
+ model = model ,
3723
+ custom_llm_provider = custom_llm_provider ,
3724
+ api_base = kwargs .get ("api_base" , None ),
3716
3725
)
3717
3726
3718
3727
# Await normally
@@ -5780,7 +5789,14 @@ async def ahealth_check(
5780
5789
input = input or ["test" ],
5781
5790
),
5782
5791
"audio_speech" : lambda : litellm .aspeech (
5783
- ** {** _filter_model_params (model_params ), ** ({"voice" : "alloy" } if "voice" not in _filter_model_params (model_params ) else {})},
5792
+ ** {
5793
+ ** _filter_model_params (model_params ),
5794
+ ** (
5795
+ {"voice" : "alloy" }
5796
+ if "voice" not in _filter_model_params (model_params )
5797
+ else {}
5798
+ ),
5799
+ },
5784
5800
input = prompt or "test" ,
5785
5801
),
5786
5802
"audio_transcription" : lambda : litellm .atranscription (
0 commit comments