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: ...@@ -586,8 +586,8 @@ class OpenAIFormatter:
total_tokens=prompt_tokens + completion_tokens total_tokens=prompt_tokens + completion_tokens
) )
).model_dump() ).model_dump()
except Exception: except Exception as e:
pass print(f"DEBUG formatter: litellm fallback failed: {e}")
# Fallback to plain dict if litellm fails # Fallback to plain dict if litellm fails
message = { message = {
......
...@@ -2456,7 +2456,10 @@ async def chat_completions(request: ChatCompletionRequest, http_request: Request ...@@ -2456,7 +2456,10 @@ async def chat_completions(request: ChatCompletionRequest, http_request: Request
) )
if global_debug: if global_debug:
if formatted_response:
print(f"RAW: Passed through formatter, got: {formatted_response.get('choices', [{}])[0].get('message', {}).get('content', '')[:100]}...") 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 # Add mock reasoning stats if 'mock' is in force_reasoning_args
# But only if we DON'T already have real reasoning from extraction # 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