[PR #88] [MERGED] enhancement: remove prompt_messages from LLMResult and LLMResultChunk #134

Closed
opened 2026-02-15 21:15:55 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-sdks/pull/88
Author: @Yeuoly
Created: 4/11/2025
Status: Merged
Merged: 4/11/2025
Merged by: @Yeuoly

Base: mainHead: fix/remove-prompt_messages-from-llm-result


📝 Commits (5)

  • f7f6552 refactor: remove prompt_messages from LLMResult and LLMResultChunk
  • 1f2b715 fix: add backward compatibility for deprecated prompt_messages field in LLMResult and LLMResultChunk
  • ae38642 fix: set default value for prompt_messages field to an empty list in LLMResult and LLMResultChunk for backward compatibility
  • 4ae8019 feat: add test for LLMResult to validate prompt_messages field and ensure backward compatibility
  • dccfcb0 apply ruff

📊 Changes

10 files changed (+81 additions, -32 deletions)

View changed files

📝 python/dify_plugin/entities/model/llm.py (+31 -4)
📝 python/dify_plugin/entities/model/message.py (+1 -0)
📝 python/dify_plugin/interfaces/model/large_language_model.py (+0 -2)
📝 python/dify_plugin/interfaces/model/openai_compatible/llm.py (+2 -6)
📝 python/dify_plugin/invocations/model/llm.py (+0 -1)
📝 python/examples/agent/output_parser/cot_output_parser.py (+1 -3)
📝 python/examples/jina/models/text_embedding/text_embedding.py (+1 -1)
📝 python/examples/openai/models/llm/llm.py (+0 -8)
python/tests/test_llm_result.py (+43 -0)
📝 python/tests/test_tool_call_model_init.py (+2 -7)

📄 Description

Solves high CPU usage of dify-api container caused by LLMResultChunk decoding

Related:


🔄 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-plugin-sdks/pull/88 **Author:** [@Yeuoly](https://github.com/Yeuoly) **Created:** 4/11/2025 **Status:** ✅ Merged **Merged:** 4/11/2025 **Merged by:** [@Yeuoly](https://github.com/Yeuoly) **Base:** `main` ← **Head:** `fix/remove-prompt_messages-from-llm-result` --- ### 📝 Commits (5) - [`f7f6552`](https://github.com/langgenius/dify-plugin-sdks/commit/f7f65520c899ed16bec301fddec8e1f6b98e1405) refactor: remove prompt_messages from LLMResult and LLMResultChunk - [`1f2b715`](https://github.com/langgenius/dify-plugin-sdks/commit/1f2b71513a7f977fbd7e478388c86afe1928fb74) fix: add backward compatibility for deprecated prompt_messages field in LLMResult and LLMResultChunk - [`ae38642`](https://github.com/langgenius/dify-plugin-sdks/commit/ae38642775305bacf59c4a0cb7b7566315d578b8) fix: set default value for prompt_messages field to an empty list in LLMResult and LLMResultChunk for backward compatibility - [`4ae8019`](https://github.com/langgenius/dify-plugin-sdks/commit/4ae8019bdab55ad2a51080c08014d3a0107b2185) feat: add test for LLMResult to validate prompt_messages field and ensure backward compatibility - [`dccfcb0`](https://github.com/langgenius/dify-plugin-sdks/commit/dccfcb02c9aea83ac65ed142b763349c6a8495d7) apply ruff ### 📊 Changes **10 files changed** (+81 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `python/dify_plugin/entities/model/llm.py` (+31 -4) 📝 `python/dify_plugin/entities/model/message.py` (+1 -0) 📝 `python/dify_plugin/interfaces/model/large_language_model.py` (+0 -2) 📝 `python/dify_plugin/interfaces/model/openai_compatible/llm.py` (+2 -6) 📝 `python/dify_plugin/invocations/model/llm.py` (+0 -1) 📝 `python/examples/agent/output_parser/cot_output_parser.py` (+1 -3) 📝 `python/examples/jina/models/text_embedding/text_embedding.py` (+1 -1) 📝 `python/examples/openai/models/llm/llm.py` (+0 -8) ➕ `python/tests/test_llm_result.py` (+43 -0) 📝 `python/tests/test_tool_call_model_init.py` (+2 -7) </details> ### 📄 Description Solves high CPU usage of dify-api container caused by LLMResultChunk decoding Related: - https://github.com/langgenius/dify/issues/17799 - https://github.com/langgenius/dify-official-plugins/issues/648 --- <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-15 21:15:55 -05:00
yindo closed this issue 2026-02-15 21:15:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-sdks#134