Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions agent/component/categorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,29 @@ def get_prompt(self, chat_hist):
for c, desc in self.category_description.items():
if desc.get("description"):
descriptions.append(
"--------------------\nCategory: {}\nDescription: {}\n".format(c, desc["description"]))
"\nCategory: {}\nDescription: {}".format(c, desc["description"]))

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 ----
{}
Role: You're a text classifier.
Task: 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.

Requirements:
- Just mention the category names, no need for any additional words.

---- Real Data ----
USER: {}\n
""".format(
len(self.category_description.keys()),
"/".join(list(self.category_description.keys())),
"\n".join(descriptions),
"- ".join(cate_lines),
"\n\n- ".join(cate_lines),
chat_hist
)
return self.prompt
Expand Down
4 changes: 3 additions & 1 deletion rag/llm/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ def chat(self, system, history, gen_conf):
if "max_tokens" in gen_conf:
del gen_conf["max_tokens"]
try:
options = {}
options = {
"num_ctx": 32768
}
if "temperature" in gen_conf:
options["temperature"] = gen_conf["temperature"]
if "max_tokens" in gen_conf:
Expand Down