mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-07-17 17:05:58 -05:00
[PR #842] [CLOSED] fix: guard against empty choices and None content in memory tutorial apps #15449
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?
📋 Pull Request Information
Original PR: https://github.com/Shubhamsaboo/awesome-llm-apps/pull/842
Author: @zavoryn
Created: 5/25/2026
Status: ❌ Closed
Base:
main← Head:fix/guard-openai-choices-access-memory-tutorials📝 Commits (1)
23e8bd2fix: guard against empty choices and None content in memory tutorial apps📊 Changes
4 files changed (+10 additions, -0 deletions)
View changed files
📝
advanced_llm_apps/llm_apps_with_memory_tutorials/ai_arxiv_agent_memory/ai_arxiv_agent_memory.py(+2 -0)📝
advanced_llm_apps/llm_apps_with_memory_tutorials/ai_travel_agent_memory/travel_agent_memory.py(+2 -0)📝
advanced_llm_apps/llm_apps_with_memory_tutorials/llm_app_personalized_memory/llm_app_memory.py(+2 -0)📝
advanced_llm_apps/llm_apps_with_memory_tutorials/multi_llm_memory/multi_llm_memory.py(+4 -0)📄 Description
Summary
Fixes #841
Four apps in
llm_apps_with_memory_tutorialsaccessedresponse.choices[0].message.contentwithout verifying thatchoicesis non-empty andcontentis notNone. This is the same class of bug fixed in PR #820 (DeepSeek) and PR #840 (beifong).Affected files:
ai_arxiv_agent_memory/ai_arxiv_agent_memory.py— arXiv paper search with GPT-4o-miniai_travel_agent_memory/travel_agent_memory.py— travel agent with OpenAIllm_app_personalized_memory/llm_app_memory.py— personalized memory appmulti_llm_memory/multi_llm_memory.py— multi-LLM app (OpenAI GPT-4o and Claude Sonnet)Root cause: An empty
choiceslist orNonecontent can occur when a content filter is triggered, a quota is exceeded, or a transient API error occurs.Fix: Add an explicit guard before each
choices[0]access in all four files. TheValueErrorpropagates cleanly to any surrounding error handling.Test plan
ValueErroris raised whenchoicesis empty orcontentisNone🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.