You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The genai_client.models.generate_content() call is synchronous and will block the event loop in your async function. The google-generativeai library provides an async version of this method. You should use await genai_client.models.generate_content_async(...) to maintain the non-blocking nature of your server.
response = await genai_client.models.generate_content_async(
model=RESEARCH_MODEL,
contents=prompt,
config={
"tools": [{"google_search": {}}],
"temperature": 0.1, # Low temperature for factual accuracy
},
)
The
genai_client.models.generate_content()call is synchronous and will block the event loop in yourasyncfunction. Thegoogle-generativeailibrary provides an async version of this method. You should useawait genai_client.models.generate_content_async(...)to maintain the non-blocking nature of your server.Originally posted by @gemini-code-assist[bot] in google-gemini/gemini-fullstack-langgraph-quickstart#203 (comment)