INNER CODE UNIT · Python
get_llm_response
aadya940/autoresume · app/backend/src/ai/main.py:63
async def get_llm_response(prompt: str, runner: Runner) -> str:
"""Get LLM response with improved error handling."""
user_message = types.Content(role="user", parts=[types.Part(text=prompt)])
try:
async for event in runner.run_async(
user_id=USER_ID, session_id=SESSION_ID, new_message=user_message
):
if event.is_final_response() and event.content and event.content.parts:
return event.content.parts[0].text
except Exception as e:
print(f"Error getting LLM response: {e}")
raise
return ""
@lru_cache(maxsize=1)