ragflow
ragflow copied to clipboard
[Question]: When I use Chinese, The Categorize component didn't work very well
Describe your problem
I have configured Categorize component in Chinese on the front-end web page. After running it, often find that it cannot match the expected categorize branch. Is it because the Categorize component base is prompt framework written in English, splicing the Chinese content I input, assembly into the final Chinese and English mixing prompt will appear this problem
What about adding a Generate component a head of it to translate user's input into English?
What about adding a
Generatecomponent a head of it to translate user's input into English?
self.prompt = """
You're a text classifier. You need to categorize the user’s questions into {} categories,
namely: {}
Here's description of each category:
{}
You could learn from the following examples:
{}
You could learn from the above examples.
Just mention the category names, no need for any additional words.
---- Real Data ----
{}
""".format(
len(self.category_description.keys()),
"/".join(list(self.category_description.keys())),
"\n".join(descriptions),
"- ".join(cate_lines),
chat_hist
)
Firstly, thank you for reply.
In the above source code of agent\component\categorize.py, prompt builds in English with the information configured in the Categorize component, So the final mixed prompt contain both Chinese and English? I'm confused about this.
Secondly,
Your reply means i must add translate before the Generate component, but now the problem is the Categorize component that named '服务分类' in the image above, I can't change what's encapsulated inside it.
@KevinHuSh Welcome to correct