@@ -114,7 +114,8 @@ async def _identify_language(
114
114
litellm_model = LITELLM_MODEL_LANGUAGE_DETECT ,
115
115
metadata = metadata ,
116
116
system_message = LANGUAGE_ID_PROMPT ,
117
- user_message = query_refined .query_text ,
117
+ # Always use the original query text for language and script detection
118
+ user_message = query_refined .query_text_original ,
118
119
)
119
120
120
121
cleaned_json_str = remove_json_markdown (text = json_str )
@@ -256,9 +257,10 @@ async def wrapper(
256
257
The appropriate response object.
257
258
"""
258
259
259
- query_refined , response = await _translate_question (
260
- query_refined = query_refined , response = response
261
- )
260
+ if not query_refined .chat_query_params :
261
+ query_refined , response = await _translate_question (
262
+ query_refined = query_refined , response = response
263
+ )
262
264
response = await func (query_refined , response , * args , ** kwargs )
263
265
264
266
return response
@@ -492,9 +494,11 @@ async def wrapper(
492
494
The appropriate response object.
493
495
"""
494
496
495
- query_refined , response = await _paraphrase_question (
496
- query_refined = query_refined , response = response
497
- )
497
+ if not query_refined .chat_query_params :
498
+ query_refined , response = await _paraphrase_question (
499
+ query_refined = query_refined , response = response
500
+ )
501
+
498
502
response = await func (query_refined , response , * args , ** kwargs )
499
503
500
504
return response
0 commit comments