Skip to content

Add multilingual response support for Generate Instructions#5397

Merged
HenryHengZJ merged 1 commit intoFlowiseAI:mainfrom
sean2121:main
Oct 31, 2025
Merged

Add multilingual response support for Generate Instructions#5397
HenryHengZJ merged 1 commit intoFlowiseAI:mainfrom
sean2121:main

Conversation

@sean2121
Copy link
Contributor

@sean2121 sean2121 commented Oct 31, 2025

Currently, when you use Generate Instructions, any input in a language other than English is returned in English. This can be inconvenient for no-native-English speakers, so I want the output to be returned in the same language as the input.

To achieve this, I’ve added a note in the prompt specifying this behavior.

Summary by CodeRabbit

  • Improvements
    • Enhanced AI assistant response guidelines to ensure responses match the input language consistently.
    • Improved response structure with explicit ordering of reasoning and conclusions.
    • Refined guidance for clarity, formatting, and content preservation in AI-generated responses.

Emphasize the importance of responding in the same language as the task description and clarify guidelines for reasoning and conclusions.
@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Walkthrough

The ASSISTANT_PROMPT_GENERATOR constant in the prompt utilities was enhanced with language consistency requirements, reasoning order directives, and expanded guidance sections for clarity, formatting, and content preservation.

Changes

Cohort / File(s) Summary
Prompt Template Enhancement
packages/server/src/utils/prompt.ts
Updated ASSISTANT_PROMPT_GENERATOR string constant with new language-matching guidelines, "Reasoning Order" directive requiring explicit identification of reasoning vs. conclusions ordering, new "Examples" subsection, and expanded guidance on clarity, formatting, and user content preservation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Reasoning Order directive: Verify that the ordering requirements are unambiguous and won't conflict with existing use cases or downstream parsing logic.
  • Language consistency rule: Ensure the language-matching guideline is clear and comprehensive, accounting for multilingual edge cases.
  • Expanded guidance sections: Review newly added "Examples," "Clarity and Conciseness," "Formatting," and "Preserve User Content" sections for coherence and consistency with existing prompting patterns.

Poem

🐰 Our prompts now speak in tongue so true,
Matching words in every hue—
Reasoning first, then conclusions bright,
Ordered thoughts in perfect light!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Add multilingual response support for Generate Instructions" directly aligns with the main objective of the changeset, which is to make the Generate Instructions feature return outputs in the same language as the input task description rather than always in English. The title accurately reflects this primary purpose and is specific enough for a teammate scanning history to understand that the change enables language-aware responses. While the changeset also includes additional enhancements like a new "Reasoning Order" directive and expanded guidance sections, the title appropriately focuses on the main driver of the PR, which aligns with the principle that titles don't need to cover every detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/server/src/utils/prompt.ts (2)

46-46: Fix typo: "User placeholders" should be "Use placeholders".

Apply this diff:

-[If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]
+[If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS!]

Actually, the main issue is "User" should be "Use":

-[If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]
+[If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS!]

Wait, let me re-read line 46. It says "User placeholders as necessary" on line 45, and line 46 continues with the guidance about realistic examples. Let me check the actual line numbers again.

Looking at the annotated code:

  • Line 45: [Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
  • Line 46: [If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]

So line 45 has "User placeholders" which should be "Use placeholders", not line 46. Line 46 correctly says "USE PLACEHOLDERS".

Let me correct my observation.
[scratchpad_end] -->


45-45: Fix typo: "User placeholders" should be "Use placeholders".

Apply this diff:

-[Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
+[Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. Use placeholders as necessary.]
🧹 Nitpick comments (1)
packages/server/src/utils/prompt.ts (1)

17-18: Consider rephrasing for clarity.

The phrasing on line 18 reads like a question but isn't formatted as one. Consider making it more directive.

Suggested improvement:

 - Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
-   - What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from placeholders.
+   - Determine what kinds of examples to include, how many are needed, and whether they are complex enough to benefit from placeholders.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3d5b77 and b516261.

📒 Files selected for processing (1)
  • packages/server/src/utils/prompt.ts (1 hunks)
🔇 Additional comments (1)
packages/server/src/utils/prompt.ts (1)

9-11: LGTM! Language directive addresses PR objective.

The language consistency requirement directly addresses the PR objective of supporting non-native English speakers. The directive is clear, explicit, and includes helpful examples.

- DO NOT translate the task language into English.
- Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
- Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
- Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdown formatting error.

The line contains a stray bold marker: Conclusions** should either be Conclusions: or properly wrapped as **Reasoning Before Conclusions**:.

Apply this diff:

-- Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
+- **Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
- **Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
🤖 Prompt for AI Agents
In packages/server/src/utils/prompt.ts around line 14, the markdown has a stray
bold marker "Conclusions**" — replace that fragment so the heading is properly
formatted; change it to "**Reasoning Before Conclusions**:" (i.e., wrap the
whole heading in bold and add a colon) so the line reads: "**Reasoning Before
Conclusions**: Encourage reasoning steps before any conclusions are reached.
ATTENTION! If the user provides examples where the reasoning happens afterward,
REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!"

@sean2121 sean2121 changed the title Update guidelines for task response language and reasoning Add multilingual response support for Generate Instructions Oct 31, 2025
Copy link
Contributor

@HenryHengZJ HenryHengZJ left a comment

Choose a reason for hiding this comment

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

thanks!

@HenryHengZJ HenryHengZJ merged commit 0149688 into FlowiseAI:main Oct 31, 2025
3 checks passed
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.

2 participants