Open tzuhsin0329 opened 1 year ago
I didn't do any changes but it seems mine can read both. May I know what is the respond you got when you ask the Chinese question?
You can try modifying the prompt of app\backend\approvals\chateadretrieveread.py by changing "If the question is not in English, translate the question to English before generating the search query." to "Please search in the language of the original input of the question, never try to translate it into English."
I added the following function to chatreadretrieveread.py
def is_chinese_query(q): for char in q: category = unicodedata.category(char) if category == 'Lo' or 'CJK' in category: return True return False
and then in Step 2 in the same file I changed the self.search_client.search parameters to check for chinese within the query_language and query_speller parameters. This should cover Korean and Japanese since it's checking CJK but I still need to test but it is working for Chinese documents now. However, it returns answers in English so I am updating the prompt to tell it to return in the original input language. Need to confirm this.
r = self.search_client.search(q, filter=filter, query_type=QueryType.SEMANTIC, query_language="zh-cn" if is_chinese else "en-us", query_speller="lexicon" if not is_chinese else None, semantic_configuration_name="default", top=top, query_caption="extractive|highlight-false" if use_semantic_captions else None)
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.
This issue is for a: (mark with an
x
)Minimal steps to reproduce
Any log messages given by the failure
Expected/desired behavior
OS and Version?
Versions
Mention any other details that might be useful
Try to change the analyzer in cognitive search service to Chinese, but the app still can't read Chinese documents, the search service can. I have tried the cognitive service on Azure portal.