mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 10:25:23 -04:00
[PR #103] [MERGED] optimize: replace json.loads with TypeAdapter for JSON unmarshaling #147
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/langgenius/dify-plugin-sdks/pull/103
Author: @Yeuoly
Created: 4/17/2025
Status: ✅ Merged
Merged: 4/17/2025
Merged by: @Yeuoly
Base:
main← Head:optimize/enhance-json-loads📝 Commits (2)
e870c81refactor: replace json.loads with TypeAdapter for JSON validation in request readers and modelbf5b339fix: linter📊 Changes
4 files changed (+14 additions, -13 deletions)
View changed files
📝
python/dify_plugin/core/runtime.py(+3 -4)📝
python/dify_plugin/core/server/stdio/request_reader.py(+3 -2)📝
python/dify_plugin/core/server/tcp/request_reader.py(+3 -3)📝
python/dify_plugin/interfaces/model/openai_compatible/llm.py(+5 -4)📄 Description
Enhancement
It brings 4x faster performance optimization, especially llm invocation with images
Patches
https://github.com/langgenius/dify-plugin-daemon/pull/222
Updated JSON parsing in BackwardsInvocation, StdioRequestReader, and TCPReaderWriter to use TypeAdapter for improved validation.
Enhanced error handling in OAICompatLargeLanguageModel by replacing json.loads with TypeAdapter, ensuring better compliance with expected JSON schema.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.