Skip to content

fix(openai_api_compatible): wire up the orphaned stream_function_calling credential - #4068

Open
warwolf996 wants to merge 2 commits into
langgenius:mainfrom
warwolf996:feat/openai-compat-stream-tool-call
Open

warwolf996 wants to merge 2 commits into
langgenius:mainfrom
warwolf996:feat/openai-compat-stream-tool-call

Conversation

@warwolf996

@warwolf996 warwolf996 commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

  • Wires up the existing stream_function_calling credential in get_customizable_model_schema(): when set to supported, the provider declares ModelFeature.STREAM_TOOL_CALL.
  • No yaml / manifest changes: the field already exists in the credential form and keeps its default (not_supported), so existing behavior is unchanged unless explicitly enabled per credential.

Closes #4067

Root cause

stream_function_calling was introduced in langgenius/dify#3467 for the legacy built-in model runtime, where it appended ModelFeature.STREAM_TOOL_CALL to the model features when enabled. During the plugin migration (langgenius/dify#13836) the credential form field was carried over to this repo's yaml and the Agent-side feature check was carried over to the agent strategy plugin, but the feature-declaration wiring was not ported to the plugin's get_customizable_model_schema() — leaving the setting dead and Agent calls permanently non-streaming. Full timeline in #4067.

Impact of the fix

When the credential is enabled, agent strategies (e.g. Function Calling) stream model invocations. Besides earlier first tokens, streaming bounds the HTTP read timeout to the gap between SSE chunks instead of the full generation time, which prevents ReadTimeout / 504 failures on long generations with reasoning models.

Verification

Automated (schema-level) — tests/test_stream_tool_call_feature.py covers four cases: explicit supported declares STREAM_TOOL_CALL; not_supported and omitted credentials omit it; an existing declaration is not duplicated. The key case fails on unfixed main and passes with the fix.

Manual (end-to-end) — tested on Dify 1.17.1 with langgenius/agent 0.0.50 and a DeepSeek endpoint (function_calling_type = tool_call):

  • credential stream_function_calling = supported → Agent model calls switch to streaming, including full tool-calling chains (streamed tool-call deltas are aggregated by the SDK and parallel tool calls work)
  • credential left at the default → behavior unchanged (non-streaming)

Release Notes

Wire up the orphaned stream_function_calling credential: when set to Support, the provider now declares the stream-tool-call capability so Agent strategies (e.g. Function Calling) stream model invocations instead of blocking on the full response — restoring the behavior introduced in langgenius/dify#3467 that was lost during the plugin migration.

@warwolf996
warwolf996 force-pushed the feat/openai-compat-stream-tool-call branch from 6a2113e to ec5fe50 Compare October 17, 2026 06:07
@warwolf996

Copy link
Copy Markdown
Author

Thanks @dosu — confirming all three points:

  • Extension point: the change sits inside get_customizable_model_schema() (in the credential-driven feature block, next to the vision/audio/document handling), which is exactly the place you identified. I've also corrected the method name in the issue and PR descriptions — they previously referenced the legacy get_model_schema from feat: support configurate openai compatible stream tool call dify#3467.
  • Default: already handled as you suggest — the yaml default (not_supported) is preserved and the feature is declared only on an explicit supported value, so omitted credentials keep the current (non-streaming) behavior.
  • Coverage: happy to add unit tests for the three cases (explicit supported → feature present; not_supported / credential omitted → feature absent). The end-to-end behavior (stream=True from the Function Calling strategy) is what I verified manually on Dify 1.17.1 with a DeepSeek endpoint, as noted in the PR.

@dosubot

dosubot Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thanks for confirming and correcting the method name. Please add the three schema-level unit tests you outlined:

  • supported → STREAM_TOOL_CALL present.
  • not_supported → feature absent.
  • Credential omitted → feature absent.

Keep the manual end-to-end verification in the PR description, clearly distinguished from the automated schema tests.


Leave Feedback Ask Dosu about dify-official-plugins

@warwolf996
warwolf996 force-pushed the feat/openai-compat-stream-tool-call branch from ec5fe50 to 6e7b85b Compare October 17, 2026 06:16
@warwolf996

Copy link
Copy Markdown
Author

Follow-up on the coverage point: added tests/test_stream_tool_call_feature.py (in 6e7b85b) covering all four cases — explicit supported declares the feature, not_supported / credential omitted omit it, and an existing declaration is not duplicated. Verified the test fails on unfixed main and passes with the fix.

@warwolf996

Copy link
Copy Markdown
Author

@crazywoola could you take a look when you have a chance? You reviewed the recent openai_api_compatible changes (#3939, #3700, #3655), and this one restores a credential wiring (stream_function_calling) that was lost during the plugin migration — details in #4067.

@crazywoola

Copy link
Copy Markdown
Member

Hi @warwolf996, thanks for wiring up the orphaned stream_function_calling credential!

Heads-up about models/openai_api_compatible/manifest.yaml: the consolidated dependency refresh (#4106–#4111) bumped it to 0.0.69 on main, and several PRs are currently open for this plugin from different authors (#3795, #3869, #4060, #4066, #4079). Please rebase on latest main and bump the version to the next unused one so the releases don't collide — your PR doesn't update the manifest version yet, so the bump is still needed.

Thanks again! 🙏

warwolf996 and others added 2 commits October 27, 2026 19:39
…ing credential

The stream_function_calling credential has been present in the credential
form since langgenius#3467, where it gated the STREAM_TOOL_CALL feature in the
legacy model runtime, but it was never read after the plugin migration.
Read it again in get_customizable_model_schema so agent strategies (e.g.
Function Calling) stream model invocations instead of blocking on the full
response. Keep the form default (not_supported) so existing behavior is
unchanged unless explicitly enabled per credential.
Bump the plugin version to the next unused one (main is at 0.0.73) so
this fix does not collide with other pending openai_api_compatible PRs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@warwolf996
warwolf996 force-pushed the feat/openai-compat-stream-tool-call branch from 6e7b85b to 4221fd1 Compare October 27, 2026 11:45
@warwolf996

Copy link
Copy Markdown
Author

Hi @crazywoola, thanks for the heads-up!

Done in 4221fd1:

  • Rebased on latest main (9ee7266) — clean, no conflicts.
  • Bumped models/openai_api_compatible/manifest.yaml from 0.0.68 to 0.0.74, the next unused version (main is at 0.0.73; the other open PRs claim at most 0.0.72).

The schema-level unit tests requested earlier are already in place (tests/test_stream_tool_call_feature.py, added in 6e7b85b → now ebd4c9b after rebase). Happy to re-bump again if other PRs land first and take 0.0.74.

This branch has not been deployed

No deployments
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.

openai_api_compatible: stream_function_calling credential is never read — Agent nodes always call models non-streaming

2 participants