Fix: Complete Multi-Language Support for React-to-Me (#104)#140
Open
bleedblack1 wants to merge 1 commit intoreactome:mainfrom
Open
Fix: Complete Multi-Language Support for React-to-Me (#104)#140bleedblack1 wants to merge 1 commit intoreactome:mainfrom
bleedblack1 wants to merge 1 commit intoreactome:mainfrom
Conversation
f30911e to
7206ada
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolves an issue where the React-to-Me chatbot always responded in English, even when users submitted questions in other languages.
The root cause was that the detected language from the language detection pipeline was never passed to the final generation step. As a result, the LLM only received English inputs and produced English outputs.
This change ensures the chatbot:
The fix maintains retrieval quality while enabling full multilingual response support.
Problem
The chatbot pipeline already contained language detection and query rephrasing, but the information flow stopped before the generation stage.
Current behavior:
Because the model receives English queries and English context, responses are always generated in English.
Solution
The fix introduces an English-for-Search, Native-for-Response strategy.
Pipeline after this change:
Retrieval continues to use English queries for optimal embedding similarity, while the response language follows the detected language.
Implementation Details
1. React-to-Me Profile Fix
File updated:
The generation step now retrieves the detected language and injects a response instruction when the language is not English.
Example logic:
This instruction is appended to the query before invoking the RAG chain.
This approach avoids modifying the RAG chain architecture while ensuring the LLM follows the correct output language.
2. Prompt Reinforcement
File updated:
The system prompt now explicitly acknowledges that language instructions may appear in the query and must be followed.
This acts as a secondary safeguard to ensure consistent multilingual responses.
3. Rephrase Task Clarification
File updated:
The prompt documentation now explains the rationale behind always returning English queries.
This clarification helps future contributors understand that English queries are required because:
4. Cross-Database Summarization Improvements
File updated:
Updates include:
The updated prompt enforces consistent language output while preserving scientific terminology.
Scientific Terminology Preservation
The LLM is instructed not to translate scientific identifiers, including:
Examples remain unchanged:
This ensures scientific accuracy across languages.
Impact
English users
Non-English users
Retrieval system
Streaming responses
Result
This change enables true multilingual responses in the React-to-Me chatbot while preserving the existing RAG retrieval architecture and maintaining search accuracy.
Fix: #104