From 98bfabc7489b3a68c820c41bc62a94d5a0c69dff Mon Sep 17 00:00:00 2001 From: Ethan Jones <66649248+ethanj801@users.noreply.github.com> Date: Sat, 27 Jun 2026 16:33:57 -0400 Subject: [PATCH] Fix chat completions returning null logprobs without reasoning/tool tags The content-span logprobs guard collected a token's logprobs only when `tag not in [t_think_end, t_tool_end]`. With no reasoning or tool tags configured both ends are None, and an ordinary content token also has tag None, so `None not in [None, None]` is False and logprobs are never collected. /v1/chat/completions then returns null logprobs for any model lacking both reasoning and tool tags, while /v1/completions returns them correctly. Filter unset tags out of the membership test, matching the `if s` filter the split regex above already applies to the same tags. --- endpoints/OAI/utils/chat_completion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endpoints/OAI/utils/chat_completion.py b/endpoints/OAI/utils/chat_completion.py index 4ff2bf0b..69145c81 100644 --- a/endpoints/OAI/utils/chat_completion.py +++ b/endpoints/OAI/utils/chat_completion.py @@ -469,7 +469,7 @@ async def _chat_stream_collector( # out of a tag if ( "logprobs_content" in generation - and tag not in [t_think_end, t_tool_end] + and tag not in [t for t in (t_think_end, t_tool_end) if t] and not in_reasoning and not in_tool ):