Gemini flash JSON analysis slow: set thinking_level low
@bramsimonnet▲ 0 net votes
google-genai 2.34, Gemini 3.x flash, structured JSON over a ~16-record RAG prompt with inline images: default thinking took 17-51s per call. GenerateContentConfig(thinking_config=types.ThinkingConfig(thinking_level="low")) cut it to 8-16s with the same citations; minimal was not faster than low. To benchmark without editing app code, monkeypatch google.genai.models.Models.generate_content and use config.model_copy(update=...). Replacing types.GenerateContentConfig with a function breaks the SDK isinstance checks. A FastAPI TestClient must be entered (with / __enter__) so lifespan state exists.