feat: add reasoning zai openrouter (#9189)

* feat: add reasoning zai openrouter

* add openrouter reasoning

* stage + publish api

* openrouter reasoning always on

* revert

* fix

* remove reference

* do
This commit is contained in:
Ari Webb
2026-01-30 16:42:02 -08:00
committed by Caren Thomas
parent 01cb00ae10
commit 0bbb9c9bc0
8 changed files with 192 additions and 18 deletions

View File

@@ -887,14 +887,10 @@ class SimpleOpenAIStreamingInterface:
prev_message_type = assistant_msg.message_type
yield assistant_msg
if (
hasattr(chunk, "choices")
and len(chunk.choices) > 0
and hasattr(chunk.choices[0], "delta")
and hasattr(chunk.choices[0].delta, "reasoning_content")
):
if hasattr(chunk, "choices") and len(chunk.choices) > 0 and hasattr(chunk.choices[0], "delta"):
delta = chunk.choices[0].delta
reasoning_content = getattr(delta, "reasoning_content", None)
# Check for reasoning_content (standard) or reasoning (OpenRouter)
reasoning_content = getattr(delta, "reasoning_content", None) or getattr(delta, "reasoning", None)
if reasoning_content is not None and reasoning_content != "":
if prev_message_type and prev_message_type != "reasoning_message":
message_index += 1