mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-07-18 02:09:32 -05:00
[GH-ISSUE #841] bug: unguarded OpenAI API response access crashes memory tutorial apps #6487
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zavoryn on GitHub (May 25, 2026).
Original GitHub issue: https://github.com/Shubhamsaboo/awesome-llm-apps/issues/841
Bug Description
Four apps in
advanced_llm_apps/llm_apps_with_memory_tutorials/accessresponse.choices[0].message.contentwithout first checking thatchoicesis non-empty andcontentis notNone.This can cause:
IndexErrorwhen the API returns an emptychoiceslist (content filter, quota exceeded, or transient error)Nonebeing passed to downstream code whenmessage.contentisNoneAffected Files
ai_arxiv_agent_memory/ai_arxiv_agent_memory.pyresponse.choices[0].message.contentai_travel_agent_memory/travel_agent_memory.pyresponse.choices[0].message.contentllm_app_personalized_memory/llm_app_memory.pyresponse.choices[0].message.contentmulti_llm_memory/multi_llm_memory.pyresponse.choices[0].message.contentFix
Add the same guard applied in PR #820 and PR #840 before each access:
I have a PR ready fixing all four files.