[PR #820] [MERGED] fix: guard against empty choices and None message in DeepSeek API responses #10282

Closed
opened 2026-06-12 10:52:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Shubhamsaboo/awesome-llm-apps/pull/820
Author: @zavoryn
Created: 5/18/2026
Status: Merged
Merged: 5/21/2026
Merged by: @Shubhamsaboo

Base: mainHead: fix/deepseek-empty-response-guard


📝 Commits (1)

  • 1c0a5b7 fix: guard against empty choices and None message in DeepSeek API responses

📊 Changes

2 files changed (+4 additions, -0 deletions)

View changed files

📝 advanced_ai_agents/autonomous_game_playing_agent_apps/ai_3dpygame_r1/ai_3dpygame_r1.py (+2 -0)
📝 advanced_ai_agents/single_agent_apps/ai_system_architect_r1/ai_system_architect_r1.py (+2 -0)

📄 Description

Summary

Add safety checks before accessing deepseek_response.choices[0].message to prevent crashes when the DeepSeek API returns empty or filtered responses.

Changes

  • ai_3dpygame_r1.py — Guard choices[0].message.reasoning_content access
  • ai_system_architect_r1.py — Guard both reasoning_content and content access

Both files now raise ValueError("DeepSeek returned an empty or filtered response") instead of crashing with IndexError or AttributeError.

Closes #817


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Shubhamsaboo/awesome-llm-apps/pull/820 **Author:** [@zavoryn](https://github.com/zavoryn) **Created:** 5/18/2026 **Status:** ✅ Merged **Merged:** 5/21/2026 **Merged by:** [@Shubhamsaboo](https://github.com/Shubhamsaboo) **Base:** `main` ← **Head:** `fix/deepseek-empty-response-guard` --- ### 📝 Commits (1) - [`1c0a5b7`](https://github.com/Shubhamsaboo/awesome-llm-apps/commit/1c0a5b74501d0ea6c0e8b1f7c71d9b038a146f86) fix: guard against empty choices and None message in DeepSeek API responses ### 📊 Changes **2 files changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `advanced_ai_agents/autonomous_game_playing_agent_apps/ai_3dpygame_r1/ai_3dpygame_r1.py` (+2 -0) 📝 `advanced_ai_agents/single_agent_apps/ai_system_architect_r1/ai_system_architect_r1.py` (+2 -0) </details> ### 📄 Description ## Summary Add safety checks before accessing `deepseek_response.choices[0].message` to prevent crashes when the DeepSeek API returns empty or filtered responses. ## Changes - `ai_3dpygame_r1.py` — Guard `choices[0].message.reasoning_content` access - `ai_system_architect_r1.py` — Guard both `reasoning_content` and `content` access Both files now raise `ValueError("DeepSeek returned an empty or filtered response")` instead of crashing with `IndexError` or `AttributeError`. Closes #817 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-12 10:52:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-llm-apps#10282