Update app.py
Browse files140 unmodified lines14114214314414414514614712 unmodified lines160161162163164165166167168169170140 unmodified lines {"role": "user", "content": user_message} ], "temperature": 0.0, "max_tokens": 256 "max_tokens": 2000 # Increased for models with extended reasoning/thinking }
try:12 unmodified lines reply = result.get("choices", [{}])[0].get("message", {}).get("content", "").strip() if not reply: logger.warning(f"Empty content in response. Finish reason: {result.get('choices', [{}])[0].get('finish_reason')}") # If content is empty, try to extract from reasoning or log for debugging reasoning = result.get("choices", [{}])[0].get("message", {}).get("reasoning", "") if reasoning: logger.warning(f"Model has reasoning but no content. This may indicate truncation.") logger.error(f"OpenRouter returned empty response in /classify. Full result: {result}") raise HTTPException(status_code=500, detail="No response from OpenRouter") app.py+6-1