@@ -1079,7 +1079,6 @@ def completion( # type: ignore # noqa: PLR0915
1079
1079
prompt_id = prompt_id , non_default_params = non_default_params
1080
1080
)
1081
1081
):
1082
-
1083
1082
(
1084
1083
model ,
1085
1084
messages ,
@@ -2034,7 +2033,6 @@ def completion( # type: ignore # noqa: PLR0915
2034
2033
2035
2034
try :
2036
2035
if use_base_llm_http_handler :
2037
-
2038
2036
response = base_llm_http_handler .completion (
2039
2037
model = model ,
2040
2038
messages = messages ,
@@ -2550,15 +2548,10 @@ def completion( # type: ignore # noqa: PLR0915
2550
2548
)
2551
2549
elif custom_llm_provider == "compactifai" :
2552
2550
api_key = (
2553
- api_key
2554
- or get_secret_str ("COMPACTIFAI_API_KEY" )
2555
- or litellm .api_key
2551
+ api_key or get_secret_str ("COMPACTIFAI_API_KEY" ) or litellm .api_key
2556
2552
)
2557
2553
2558
- api_base = (
2559
- api_base
2560
- or "https://api.compactif.ai/v1"
2561
- )
2554
+ api_base = api_base or "https://api.compactif.ai/v1"
2562
2555
2563
2556
## COMPLETION CALL
2564
2557
response = base_llm_http_handler .completion (
@@ -3144,9 +3137,9 @@ def completion( # type: ignore # noqa: PLR0915
3144
3137
"aws_region_name" not in optional_params
3145
3138
or optional_params ["aws_region_name" ] is None
3146
3139
):
3147
- optional_params ["aws_region_name" ] = (
3148
- aws_bedrock_client . meta . region_name
3149
- )
3140
+ optional_params [
3141
+ "aws_region_name"
3142
+ ] = aws_bedrock_client . meta . region_name
3150
3143
3151
3144
bedrock_route = BedrockModelInfo .get_bedrock_route (model )
3152
3145
if bedrock_route == "converse" :
@@ -3488,7 +3481,6 @@ def completion( # type: ignore # noqa: PLR0915
3488
3481
)
3489
3482
raise e
3490
3483
elif custom_llm_provider == "gradient_ai" :
3491
-
3492
3484
api_base = litellm .api_base or api_base
3493
3485
response = base_llm_http_handler .completion (
3494
3486
model = model ,
@@ -3848,7 +3840,7 @@ def embedding(
3848
3840
* ,
3849
3841
aembedding : Literal [True ],
3850
3842
** kwargs ,
3851
- ) -> Coroutine [Any , Any , EmbeddingResponse ]:
3843
+ ) -> Coroutine [Any , Any , EmbeddingResponse ]:
3852
3844
...
3853
3845
3854
3846
@@ -3874,7 +3866,7 @@ def embedding(
3874
3866
* ,
3875
3867
aembedding : Literal [False ] = False ,
3876
3868
** kwargs ,
3877
- ) -> EmbeddingResponse :
3869
+ ) -> EmbeddingResponse :
3878
3870
...
3879
3871
3880
3872
# fmt: on
@@ -5127,9 +5119,9 @@ def adapter_completion(
5127
5119
new_kwargs = translation_obj .translate_completion_input_params (kwargs = kwargs )
5128
5120
5129
5121
response : Union [ModelResponse , CustomStreamWrapper ] = completion (** new_kwargs ) # type: ignore
5130
- translated_response : Optional [Union [ BaseModel , AdapterCompletionStreamWrapper ]] = (
5131
- None
5132
- )
5122
+ translated_response : Optional [
5123
+ Union [ BaseModel , AdapterCompletionStreamWrapper ]
5124
+ ] = None
5133
5125
if isinstance (response , ModelResponse ):
5134
5126
translated_response = translation_obj .translate_completion_output_params (
5135
5127
response = response
@@ -6117,9 +6109,9 @@ def stream_chunk_builder( # noqa: PLR0915
6117
6109
]
6118
6110
6119
6111
if len (content_chunks ) > 0 :
6120
- response ["choices" ][0 ]["message" ]["content" ] = (
6121
- processor . get_combined_content ( content_chunks )
6122
- )
6112
+ response ["choices" ][0 ]["message" ][
6113
+ "content"
6114
+ ] = processor . get_combined_content ( content_chunks )
6123
6115
6124
6116
thinking_blocks = [
6125
6117
chunk
@@ -6130,9 +6122,9 @@ def stream_chunk_builder( # noqa: PLR0915
6130
6122
]
6131
6123
6132
6124
if len (thinking_blocks ) > 0 :
6133
- response ["choices" ][0 ]["message" ]["thinking_blocks" ] = (
6134
- processor . get_combined_thinking_content ( thinking_blocks )
6135
- )
6125
+ response ["choices" ][0 ]["message" ][
6126
+ " thinking_blocks"
6127
+ ] = processor . get_combined_thinking_content ( thinking_blocks )
6136
6128
6137
6129
reasoning_chunks = [
6138
6130
chunk
@@ -6143,9 +6135,9 @@ def stream_chunk_builder( # noqa: PLR0915
6143
6135
]
6144
6136
6145
6137
if len (reasoning_chunks ) > 0 :
6146
- response ["choices" ][0 ]["message" ]["reasoning_content" ] = (
6147
- processor . get_combined_reasoning_content ( reasoning_chunks )
6148
- )
6138
+ response ["choices" ][0 ]["message" ][
6139
+ "reasoning_content"
6140
+ ] = processor . get_combined_reasoning_content ( reasoning_chunks )
6149
6141
6150
6142
audio_chunks = [
6151
6143
chunk
0 commit comments