Skip to content

feat: add polling-based LLM support#333

Merged
WH-2099 merged 6 commits into
mainfrom
feat/llm-polling-protocol
May 20, 2026
Merged

feat: add polling-based LLM support#333
WH-2099 merged 6 commits into
mainfrom
feat/llm-polling-protocol

Conversation

@WH-2099
Copy link
Copy Markdown
Member

@WH-2099 WH-2099 commented May 19, 2026

Summary

Add SDK support for polling-based LLM invocations.

What Changed

  • Added model actions and request models for start_polling and check_polling.
  • Added executor routes that dispatch polling calls to LLM implementations.
  • Added ModelFeature.POLLING and explicit support checks before polling dispatch.
  • Added LLMPollingResult with state-specific payload validation.
  • Added tests for request parsing, executor dispatch, unsupported models, and result validation.
  • Bumped package version to 0.9.0 and documented polling-based LLM invocation support in README.md.

Validation

  • just check
  • uv run pytest tests/test_model_polling.py

Closes #332

@WH-2099 WH-2099 self-assigned this May 19, 2026
@WH-2099 WH-2099 marked this pull request as ready for review May 19, 2026 10:29
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for polling-based Large Language Model (LLM) invocations. Key changes include the addition of StartPolling and CheckPolling actions to the ModelActions enum, new request and result entities (ModelStartPollingRequest, ModelCheckPollingRequest, and LLMPollingResult), and the implementation of start_llm_polling and check_llm_polling methods within the PluginExecutor. The LargeLanguageModel interface has also been updated with internal methods and a supports_polling check to facilitate this new feature. Feedback provided suggests using value equality (==) instead of identity comparison (is) for StrEnum status checks in the LLMPollingResult validator to ensure more robust logic.

Comment thread src/dify_plugin/entities/model/llm.py Outdated
@WH-2099 WH-2099 marked this pull request as draft May 19, 2026 10:31
@WH-2099 WH-2099 changed the title feat: add LLM polling protocol hooks feat: add polling-based LLM support May 19, 2026
@WH-2099 WH-2099 marked this pull request as ready for review May 19, 2026 10:38
@WH-2099 WH-2099 enabled auto-merge (squash) May 19, 2026 10:38
Comment thread tests/test_model_polling.py Outdated
Comment thread src/dify_plugin/core/entities/plugin/request.py Outdated
Comment thread src/dify_plugin/core/entities/plugin/request.py Outdated
Comment thread src/dify_plugin/core/entities/plugin/request.py Outdated
Comment thread src/dify_plugin/core/plugin_executor.py Outdated
Comment thread src/dify_plugin/core/plugin_executor.py Outdated
Comment thread src/dify_plugin/entities/model/llm.py Outdated
Comment thread src/dify_plugin/entities/model/llm.py Outdated
@WH-2099 WH-2099 merged commit 4577490 into main May 20, 2026
4 checks passed
@WH-2099 WH-2099 deleted the feat/llm-polling-protocol branch May 20, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add polling-based LLM support

3 participants