[PR #2310] [MERGED] fix(gemini): ensure consistent response format to fix 'str' object has no attribute 'get' error #2395

Closed
opened 2026-02-16 11:16:52 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-official-plugins/pull/2310
Author: @majiayu000
Created: 12/22/2025
Status: Merged
Merged: 12/22/2025
Merged by: @crazywoola

Base: mainHead: fix/gemini-str-object-error-29977


📝 Commits (2)

  • 6e5021a fix(gemini): ensure consistent response format to fix 'str' object has no attribute 'get' error
  • e848277 fix: ci

📊 Changes

3 files changed (+167 additions, -8 deletions)

View changed files

📝 models/gemini/manifest.yaml (+4 -4)
📝 models/gemini/models/llm/llm.py (+4 -4)
📝 models/gemini/models/tests/test_llm.py (+159 -0)

📄 Description

Summary

  • Use _parse_parts for all models in non-streaming response handling
  • Previously non-image models returned AssistantPromptMessage(content=response.text) where content is a string
  • Now all models return content as a structured list of PromptMessageContent

Test plan

  • Added unit tests for _handle_generate_response method
  • CI tests pass

Fixes langgenius/dify#29977


🔄 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/langgenius/dify-official-plugins/pull/2310 **Author:** [@majiayu000](https://github.com/majiayu000) **Created:** 12/22/2025 **Status:** ✅ Merged **Merged:** 12/22/2025 **Merged by:** [@crazywoola](https://github.com/crazywoola) **Base:** `main` ← **Head:** `fix/gemini-str-object-error-29977` --- ### 📝 Commits (2) - [`6e5021a`](https://github.com/langgenius/dify-official-plugins/commit/6e5021a0a6e6952e770a73a4d9796b12fcafda7d) fix(gemini): ensure consistent response format to fix 'str' object has no attribute 'get' error - [`e848277`](https://github.com/langgenius/dify-official-plugins/commit/e8482774b2f5691afecce3ebed49ed12b2840f99) fix: ci ### 📊 Changes **3 files changed** (+167 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `models/gemini/manifest.yaml` (+4 -4) 📝 `models/gemini/models/llm/llm.py` (+4 -4) 📝 `models/gemini/models/tests/test_llm.py` (+159 -0) </details> ### 📄 Description ## Summary - Use `_parse_parts` for all models in non-streaming response handling - Previously non-image models returned `AssistantPromptMessage(content=response.text)` where content is a string - Now all models return content as a structured list of `PromptMessageContent` ## Test plan - [x] Added unit tests for `_handle_generate_response` method - [ ] CI tests pass Fixes langgenius/dify#29977 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 11:16:52 -05:00
yindo closed this issue 2026-02-16 11:16:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#2395