Bugfix: problems with the prompt refactoring of the planning step (#564)

This commit is contained in:
Ilya Gusev 2025-02-10 11:29:26 +01:00 committed by GitHub
parent 75b2a10fbc
commit 75fe8cdd63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 17 deletions

View File

@ -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,