Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(wren-ai-service): allow generating rephrased question and intent reasoning using user's preferred language #1325

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
- MUST put the rephrased user's question in the rephrased_question output.
- REASONING MUST be within 20 words.
- If the rephrased user's question is vague and doesn't specify which table or property to analyze, classify it as MISLEADING_QUERY.
- The reasoning of the intent classification MUST use the same language as the Output Language from the user input.
- The rephrased user's question MUST use the same language as the Output Language from the user input.

### INTENT DEFINITIONS ###
- TEXT_TO_SQL
Expand Down Expand Up @@ -105,6 +107,7 @@
{% endif %}
User's question: {{query}}
Current Time: {{ current_time }}
Output Language: {{ language }}

Let's think step by step
"""
Expand Down Expand Up @@ -224,6 +227,7 @@ def prompt(
) -> dict:
return prompt_builder.run(
query=query,
language=configuration.language,
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 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).

db_schemas=construct_db_schemas,
query_history=history.sql if history else [],
current_time=configuration.show_current_time(),
Expand Down
Loading