Add multilingual response support for Generate Instructions#5397
Add multilingual response support for Generate Instructions#5397HenryHengZJ merged 1 commit intoFlowiseAI:mainfrom
Conversation
Emphasize the importance of responding in the same language as the task description and clarify guidelines for reasoning and conclusions.
WalkthroughThe 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 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! |
There was a problem hiding this comment.
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.
| - 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!"
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