idenr
Browse files- model/custom_agent.py +6 -5
model/custom_agent.py
CHANGED
@@ -112,6 +112,8 @@ class CustomHfAgent(Agent):
|
|
112 |
if chat_mode:
|
113 |
if self.chat_history is None:
|
114 |
prompt = self.chat_prompt_template.replace("<<all_tools>>", description)
|
|
|
|
|
115 |
messages = [
|
116 |
{
|
117 |
"role": "user",
|
@@ -121,16 +123,15 @@ class CustomHfAgent(Agent):
|
|
121 |
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
|
122 |
else:
|
123 |
prompt = self.chat_history
|
124 |
-
|
125 |
-
cmp = CHAT_MESSAGE_PROMPT.replace("<<task>>", task)
|
126 |
messages = [
|
127 |
{
|
128 |
"role": "user",
|
129 |
-
"content":
|
130 |
}
|
131 |
]
|
132 |
-
|
133 |
-
prompt
|
134 |
else:
|
135 |
prompt = self.run_prompt_template.replace("<<all_tools>>", description)
|
136 |
prompt = prompt.replace("<<prompt>>", task)
|
|
|
112 |
if chat_mode:
|
113 |
if self.chat_history is None:
|
114 |
prompt = self.chat_prompt_template.replace("<<all_tools>>", description)
|
115 |
+
prompt += CHAT_MESSAGE_PROMPT.replace("<<task>>", task)
|
116 |
+
|
117 |
messages = [
|
118 |
{
|
119 |
"role": "user",
|
|
|
123 |
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
|
124 |
else:
|
125 |
prompt = self.chat_history
|
126 |
+
prompt += CHAT_MESSAGE_PROMPT.replace("<<task>>", task)
|
|
|
127 |
messages = [
|
128 |
{
|
129 |
"role": "user",
|
130 |
+
"content": prompt,
|
131 |
}
|
132 |
]
|
133 |
+
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
|
134 |
+
prompt
|
135 |
else:
|
136 |
prompt = self.run_prompt_template.replace("<<all_tools>>", description)
|
137 |
prompt = prompt.replace("<<prompt>>", task)
|