Skip to content

fix(wren-ai-service): respect user response_format override in intent_classification pipeline#2123

Open
jayvenn21 wants to merge 1 commit intoCanner:mainfrom
jayvenn21:fix/intent-classification-response-format-override
Open

fix(wren-ai-service): respect user response_format override in intent_classification pipeline#2123
jayvenn21 wants to merge 1 commit intoCanner:mainfrom
jayvenn21:fix/intent-classification-response-format-override

Conversation

@jayvenn21
Copy link

@jayvenn21 jayvenn21 commented Feb 4, 2026

Summary

This PR fixes an issue where the intent_classification pipeline always injects
OpenAI-only structured output defaults (json_schema), even when users
override response_format in config.

Details

Qwen-compatible API servers do not support OpenAI structured output and
disconnect when receiving unsupported parameters. The current merge logic
overwrites user-provided kwargs, making it impossible to disable structured
output.

This change ensures user configuration fully overrides defaults, allowing
non-OpenAI providers to function correctly.

Impact

  • Fixes Qwen / LiteLLM compatibility
  • Respects config precedence
  • Preserves backward compatibility for OpenAI users

Closes #2113

Summary by CodeRabbit

Release Notes

  • Refactor
    • Intent classification configuration now supports user and provider-supplied model parameters. Custom settings take priority over hard-coded defaults, enabling more granular control over intent classification behavior. Response format handling has been improved to prevent conflicts between custom and default configurations.

…_classification pipeline

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

The intent classification generator now supports user-configurable model kwargs. A default configuration is defined, and any provider-supplied kwargs are overlaid on top, with special handling for response_format conflicts. The generation process now uses these computed kwargs instead of the static default constant.

Changes

Cohort / File(s) Summary
Intent Classification Configuration
wren-ai-service/src/pipelines/generation/intent_classification.py
Added logic to merge provider-supplied model kwargs with defaults, with conditional response_format adjustment and logging. Changed generator initialization to use computed model_kwargs instead of static constant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 ✨ A rabbit hops with glee,
For defaults now bend willingly!
Override the old, let configs flow,
User choices steal the show! 🎯

🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses issue #2113 by respecting user response_format overrides to fix Qwen compatibility, but does not comprehensively address all diagnostic and verification objectives outlined in the issue. The code fix resolves the immediate response_format override issue, but the PR does not address network verification, timeout tuning, detailed logging, or reproducible connectivity tests mentioned in issue #2113.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: respecting user response_format override in the intent_classification pipeline, which directly matches the code modification.
Out of Scope Changes check ✅ Passed The changes are narrowly focused on configurable model_kwargs and response_format override handling in the intent_classification pipeline, directly aligned with the stated objective of fixing user configuration precedence.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

litellm.InternalServerError with Qwen3

1 participant