mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 10:25:23 -04:00
[PR #82] [MERGED] Fix: handle explicit None values in ToolCall responses from OpenAI-compatible LLMs #129
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/82
Author: @ExenVitor
Created: 4/8/2025
Status: ✅ Merged
Merged: 4/10/2025
Merged by: @Yeuoly
Base:
main← Head:fix-toolcall-fields-may-be-explicit-none📝 Commits (1)
b772d66fix: ensure string fields in ToolCall default to empty string during initialization if set to explicit None📊 Changes
2 files changed (+71 additions, -5 deletions)
View changed files
📝
python/dify_plugin/entities/model/message.py(+12 -5)➕
python/tests/test_tool_call_model_init.py(+59 -0)📄 Description
Certain OpenAI-compatible LLM providers (e.g., SGLang, SiliconFlow) may return explicit
Nonevalues in tool call response fields when operating in streaming mode.To prevent Pydantic validation errors, ensure that string fields in ToolCall instances default to empty string (
"") during initialization.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.