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": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": f"""Here is the task:
|
||||
```
|
||||
{task}
|
||||
```
|
||||
Now begin!""",
|
||||
}
|
||||
"text": textwrap.dedent(
|
||||
f"""Here is the task:
|
||||
```
|
||||
{task}
|
||||
```
|
||||
Now begin!"""
|
||||
),
|
||||
},
|
||||
],
|
||||
}
|
||||
input_messages = [message_prompt_facts, message_prompt_task]
|
||||
|
@ -500,14 +502,18 @@ Now begin!""",
|
|||
)
|
||||
answer_plan = chat_message_plan.content
|
||||
|
||||
final_plan_redaction = f"""Here is the plan of action that I will follow to solve the task:
|
||||
```
|
||||
{answer_plan}
|
||||
```"""
|
||||
final_facts_redaction = f"""Here are the facts that I know so far:
|
||||
```
|
||||
{answer_facts}
|
||||
```""".strip()
|
||||
final_plan_redaction = textwrap.dedent(
|
||||
f"""Here is the plan of action that I will follow to solve the task:
|
||||
```
|
||||
{answer_plan}
|
||||
```"""
|
||||
)
|
||||
final_facts_redaction = textwrap.dedent(
|
||||
f"""Here are the facts that I know so far:
|
||||
```
|
||||
{answer_facts}
|
||||
```""".strip()
|
||||
)
|
||||
self.memory.steps.append(
|
||||
PlanningStep(
|
||||
model_input_messages=input_messages,
|
||||
|
@ -533,7 +539,7 @@ Now begin!""",
|
|||
"content": [{"type": "text", "text": self.prompt_templates["planning"]["update_facts_pre_messages"]}],
|
||||
}
|
||||
facts_update_post_messages = {
|
||||
"role": MessageRole.SYSTEM,
|
||||
"role": MessageRole.USER,
|
||||
"content": [{"type": "text", "text": self.prompt_templates["planning"]["update_facts_post_messages"]}],
|
||||
}
|
||||
input_messages = [facts_update_pre_messages] + memory_messages + [facts_update_post_messages]
|
||||
|
@ -553,12 +559,12 @@ Now begin!""",
|
|||
],
|
||||
}
|
||||
update_plan_post_messages = {
|
||||
"role": MessageRole.SYSTEM,
|
||||
"role": MessageRole.USER,
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": populate_template(
|
||||
self.prompt_templates["planning"]["update_plan_pre_messages"],
|
||||
self.prompt_templates["planning"]["update_plan_post_messages"],
|
||||
variables={
|
||||
"task": task,
|
||||
"tools": self.tools,
|
||||
|
|
Loading…
Reference in New Issue