From 01ec67a98cddbd759ca8a9e95657d89aaf72d736 Mon Sep 17 00:00:00 2001 From: Yeuoly <45712896+Yeuoly@users.noreply.github.com> Date: Mon, 22 Dec 2025 19:03:02 +0800 Subject: [PATCH 1/2] Bump SDK version to 0.7.1 --- .../interfaces/model/openai_compatible/llm.py | 11 +++++++++-- python/pdm.lock | 2 +- python/pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/python/dify_plugin/interfaces/model/openai_compatible/llm.py b/python/dify_plugin/interfaces/model/openai_compatible/llm.py index dcff5ffd..92c02924 100644 --- a/python/dify_plugin/interfaces/model/openai_compatible/llm.py +++ b/python/dify_plugin/interfaces/model/openai_compatible/llm.py @@ -183,7 +183,11 @@ def validate_credentials(self, model: str, credentials: dict) -> None: endpoint_url += "/" # prepare the payload for a simple ping to the model - data = {"model": credentials.get("endpoint_model_name", model), "max_tokens": 5} + validate_credentials_max_tokens = credentials.get("validate_credentials_max_tokens", 5) or 5 + data = { + "model": credentials.get("endpoint_model_name", model), + "max_tokens": validate_credentials_max_tokens, + } completion_type = LLMMode.value_of(credentials["mode"]) @@ -201,8 +205,11 @@ def validate_credentials(self, model: str, credentials: dict) -> None: # ADD stream validate_credentials stream_mode_auth = credentials.get("stream_mode_auth", "not_use") if stream_mode_auth == "use": + stream_validate_max_tokens = credentials.get("validate_credentials_max_tokens", None) or 10 data["stream"] = True - data["max_tokens"] = 10 + # default 10 (introduced in PR #93) to ensure streaming endpoints emit a token chunk; + # allow overriding via credentials when explicitly provided. + data["max_tokens"] = stream_validate_max_tokens response = requests.post(endpoint_url, headers=headers, json=data, timeout=(10, 300), stream=True) if response.status_code != 200: raise CredentialsValidateFailedError( diff --git a/python/pdm.lock b/python/pdm.lock index 006cbbe2..a4d8df11 100644 --- a/python/pdm.lock +++ b/python/pdm.lock @@ -12,7 +12,7 @@ requires_python = ">=3.11" [[package]] name = "annotated-types" -version = "0.7.0" +version = "0.7.1" requires_python = ">=3.8" summary = "Reusable constraint types to use with typing.Annotated" groups = ["default"] diff --git a/python/pyproject.toml b/python/pyproject.toml index c39c85e0..958e2e2d 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "dify_plugin" -version = "0.7.0" +version = "0.7.1" description = "Dify Plugin SDK" authors = [{ name = "langgenius", email = "hello@dify.ai" }] dependencies = [ From a6d965f41a6bf714154037b3cc869bf486a31b58 Mon Sep 17 00:00:00 2001 From: Yeuoly <45712896+Yeuoly@users.noreply.github.com> Date: Thu, 25 Dec 2025 00:12:55 +0800 Subject: [PATCH 2/2] Revert annotated-types lock version change --- python/pdm.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pdm.lock b/python/pdm.lock index a4d8df11..006cbbe2 100644 --- a/python/pdm.lock +++ b/python/pdm.lock @@ -12,7 +12,7 @@ requires_python = ">=3.11" [[package]] name = "annotated-types" -version = "0.7.1" +version = "0.7.0" requires_python = ">=3.8" summary = "Reusable constraint types to use with typing.Annotated" groups = ["default"]