File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -151,12 +151,12 @@ async def handle_proxy(request: Request, path: str):
151
151
if "model" in content_json :
152
152
content_json ["model" ]= get_chat_completion_model_name (model )
153
153
154
- needs_conversion = False
154
+ conversion_target = None
155
155
if not model in known_chat_models :
156
- needs_conversion = True
157
156
# openai messages to vertex contents
158
157
if "anthropic" in model :
159
158
content_json = to_vertex_anthropic (content_json )
159
+ conversion_target = "anthropic"
160
160
161
161
# Build safe target URL
162
162
target_url , headers = get_header (model , request , path )
@@ -171,10 +171,9 @@ async def handle_proxy(request: Request, path: str):
171
171
)
172
172
173
173
content = response .content
174
- if needs_conversion :
174
+ if conversion_target == "anthropic" :
175
175
# convert vertex response to openai format
176
- if "anthropic" in model :
177
- content = from_anthropic_to_openai_response (response .content , model_alias )
176
+ content = from_anthropic_to_openai_response (response .content , model_alias )
178
177
179
178
except httpx .RequestError as e :
180
179
logging .error (f"Proxy request failed: { e } " )
You can’t perform that action at this time.
0 commit comments