Bugfix: problems with the prompt refactoring of the planning step (#564)
This commit is contained in:
parent
75b2a10fbc
commit
75fe8cdd63
|
@ -464,12 +464,14 @@ You have been provided with these additional arguments, that you can access usin
|
||||||
"content": [
|
"content": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"text": f"""Here is the task:
|
"text": textwrap.dedent(
|
||||||
```
|
f"""Here is the task:
|
||||||
{task}
|
```
|
||||||
```
|
{task}
|
||||||
Now begin!""",
|
```
|
||||||
}
|
Now begin!"""
|
||||||
|
),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
input_messages = [message_prompt_facts, message_prompt_task]
|
input_messages = [message_prompt_facts, message_prompt_task]
|
||||||
|
@ -500,14 +502,18 @@ Now begin!""",
|
||||||
)
|
)
|
||||||
answer_plan = chat_message_plan.content
|
answer_plan = chat_message_plan.content
|
||||||
|
|
||||||
final_plan_redaction = f"""Here is the plan of action that I will follow to solve the task:
|
final_plan_redaction = textwrap.dedent(
|
||||||
```
|
f"""Here is the plan of action that I will follow to solve the task:
|
||||||
{answer_plan}
|
```
|
||||||
```"""
|
{answer_plan}
|
||||||
final_facts_redaction = f"""Here are the facts that I know so far:
|
```"""
|
||||||
```
|
)
|
||||||
{answer_facts}
|
final_facts_redaction = textwrap.dedent(
|
||||||
```""".strip()
|
f"""Here are the facts that I know so far:
|
||||||
|
```
|
||||||
|
{answer_facts}
|
||||||
|
```""".strip()
|
||||||
|
)
|
||||||
self.memory.steps.append(
|
self.memory.steps.append(
|
||||||
PlanningStep(
|
PlanningStep(
|
||||||
model_input_messages=input_messages,
|
model_input_messages=input_messages,
|
||||||
|
@ -533,7 +539,7 @@ Now begin!""",
|
||||||
"content": [{"type": "text", "text": self.prompt_templates["planning"]["update_facts_pre_messages"]}],
|
"content": [{"type": "text", "text": self.prompt_templates["planning"]["update_facts_pre_messages"]}],
|
||||||
}
|
}
|
||||||
facts_update_post_messages = {
|
facts_update_post_messages = {
|
||||||
"role": MessageRole.SYSTEM,
|
"role": MessageRole.USER,
|
||||||
"content": [{"type": "text", "text": self.prompt_templates["planning"]["update_facts_post_messages"]}],
|
"content": [{"type": "text", "text": self.prompt_templates["planning"]["update_facts_post_messages"]}],
|
||||||
}
|
}
|
||||||
input_messages = [facts_update_pre_messages] + memory_messages + [facts_update_post_messages]
|
input_messages = [facts_update_pre_messages] + memory_messages + [facts_update_post_messages]
|
||||||
|
@ -553,12 +559,12 @@ Now begin!""",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
update_plan_post_messages = {
|
update_plan_post_messages = {
|
||||||
"role": MessageRole.SYSTEM,
|
"role": MessageRole.USER,
|
||||||
"content": [
|
"content": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"text": populate_template(
|
"text": populate_template(
|
||||||
self.prompt_templates["planning"]["update_plan_pre_messages"],
|
self.prompt_templates["planning"]["update_plan_post_messages"],
|
||||||
variables={
|
variables={
|
||||||
"task": task,
|
"task": task,
|
||||||
"tools": self.tools,
|
"tools": self.tools,
|
||||||
|
|
Loading…
Reference in New Issue