Add full traceback and SDK version logging for AssertionError debug

This will help identify where exactly the AssertionError is occurring
in the google-genai SDK and what version is installed on the server.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
michael 2026-01-07 13:49:47 -06:00
parent 5a825934f8
commit c9848210bb

View file

@ -10,6 +10,7 @@ import json
import asyncio
import logging
import base64
import traceback
from google import genai
from google.genai import errors as genai_errors
from openai import AsyncOpenAI
@ -30,6 +31,10 @@ def get_gemini_client():
when caching clients in ASGI environments where requests may come on different
event loops. The overhead is minimal compared to the LLM API call.
"""
# Log SDK version on first call for debugging
import google.genai as genai_pkg
if hasattr(genai_pkg, '__version__'):
logger.info(f"google-genai SDK version: {genai_pkg.__version__}")
return genai.Client(api_key=GEMINI_API_KEY)
@ -307,8 +312,10 @@ class LLMService:
exc_repr = repr(e)
exc_args = getattr(e, 'args', ())
exc_dict = getattr(e, '__dict__', {})
exc_tb = traceback.format_exc()
logger.warning(f"LLM attempt {attempt_num}/{max_retries} failed - Type: {exc_module}.{exc_type}, str: '{exc_str}', repr: {exc_repr}, args: {exc_args}, dict: {exc_dict}")
logger.warning(f"Full traceback:\n{exc_tb}")
error_message = exc_str.lower() if exc_str else exc_repr.lower()