Commit 5b3d49ba authored by Your Name's avatar Your Name

Add debug logging for formatter and handle None response

- Add safety check for None formatted_response in debug output
- Add debug logging when litellm fallback fails
parent 350b2c7f
......@@ -586,8 +586,8 @@ class OpenAIFormatter:
total_tokens=prompt_tokens + completion_tokens
)
).model_dump()
except Exception:
pass
except Exception as e:
print(f"DEBUG formatter: litellm fallback failed: {e}")
# Fallback to plain dict if litellm fails
message = {
......
......@@ -2456,7 +2456,10 @@ async def chat_completions(request: ChatCompletionRequest, http_request: Request
)
if global_debug:
print(f"RAW: Passed through formatter, got: {formatted_response.get('choices', [{}])[0].get('message', {}).get('content', '')[:100]}...")
if formatted_response:
print(f"RAW: Passed through formatter, got: {formatted_response.get('choices', [{}])[0].get('message', {}).get('content', '')[:100]}...")
else:
print(f"RAW: WARNING - formatter returned None!")
# Add mock reasoning stats if 'mock' is in force_reasoning_args
# But only if we DON'T already have real reasoning from extraction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment