chore(wren-ai-service): allow generating rephrased question and intent reasoning using user's preferred language#1325
Conversation
WalkthroughThe intent classification process now requires that both the reasoning behind the classification and the rephrased user question are expressed in the user-specified output language. The prompt template is updated to include the output language, and the function now accepts a new parameter Changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
wren-ai-service/src/pipelines/generation/intent_classification.py(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Analyze (python)
- GitHub Check: pytest
- GitHub Check: pytest
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (go)
🔇 Additional comments (2)
wren-ai-service/src/pipelines/generation/intent_classification.py (2)
40-41: LGTM! Clear language requirements added to system prompt.The new requirements effectively mandate that both the intent classification reasoning and rephrased question must use the user's preferred language.
110-110: LGTM! Language parameter correctly added to user prompt template.The language parameter is properly integrated into the INPUT section using correct Jinja2 syntax.
| ) -> dict: | ||
| return prompt_builder.run( | ||
| query=query, | ||
| language=configuration.language, |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Add validation for language parameter.
Consider validating that configuration.language is not None before passing it to the prompt builder to prevent potential runtime errors.
Run this script to check if language is a required field in the Configuration class:
🏁 Script executed:
#!/bin/bash
# Description: Check if language is a required field in Configuration class
rg -A 5 'class Configuration' src/web/v1/services/Length of output: 113
I'll run a broader search for the Configuration class to locate where it is defined and to verify if a validation for the language field is necessary.
🏁 Script executed:
#!/bin/bash
# Search entire repository for the definition of the Configuration class
rg -A 10 'class Configuration' .Length of output: 1695
Validation of configuration.language Parameter Required
Please add explicit validation to ensure that configuration.language is not None before it is passed to the prompt builder. This change will help prevent potential runtime errors if the configuration does not include a valid language value. You might consider either enforcing a default value within the Configuration class or adding a guard clause right before the prompt builder invocation in wren-ai-service/src/pipelines/generation/intent_classification.py (around line 230).
Summary by CodeRabbit