File tree Expand file tree Collapse file tree 3 files changed +4
-9
lines changed
anthropic_bridge/providers Expand file tree Collapse file tree 3 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,6 @@ async def _stream_response(
327327 "output_tokens" : resp_usage .get ("output_tokens" , 0 ),
328328 }
329329 break
330- break
331330
332331 except Exception as e :
333332 yield self ._sse (
@@ -370,7 +369,7 @@ async def _stream_response(
370369 {
371370 "type" : "message_delta" ,
372371 "delta" : {
373- "stop_reason" : "end_turn" ,
372+ "stop_reason" : "tool_use" if saw_tool_use else " end_turn" ,
374373 "stop_sequence" : None ,
375374 },
376375 "usage" : usage ,
Original file line number Diff line number Diff line change @@ -182,16 +182,14 @@ async def _stream_openrouter(
182182 lines = buffer .split ("\n " )
183183 buffer = lines .pop ()
184184
185- done = False
186185 for line in lines :
187186 line = line .strip ()
188187 if not line or not line .startswith ("data: " ):
189188 continue
190189
191190 data_str = line [6 :]
192191 if data_str == "[DONE]" :
193- done = True
194- break
192+ continue
195193
196194 try :
197195 data = json .loads (data_str )
@@ -399,8 +397,6 @@ async def _stream_openrouter(
399397 await get_reasoning_cache ().set (
400398 t ["id" ], current_reasoning_details .copy ()
401399 )
402- if done :
403- break
404400
405401 if thinking_started :
406402 yield self ._sse (
@@ -435,7 +431,7 @@ async def _stream_openrouter(
435431 {
436432 "type" : "message_delta" ,
437433 "delta" : {
438- "stop_reason" : "end_turn" ,
434+ "stop_reason" : "tool_use" if saw_tool_use else " end_turn" ,
439435 "stop_sequence" : None ,
440436 },
441437 "usage" : {
Original file line number Diff line number Diff line change 11[project ]
22name = " anthropic-bridge"
3- version = " 0.1.27 "
3+ version = " 0.1.28 "
44description = " Bridge Anthropic API to OpenRouter and OpenAI models."
55license = " MIT"
66requires-python = " >=3.11"
You can’t perform that action at this time.
0 commit comments