Skip to content

Commit 5aa4996

Browse files
committed
fixed user req prompt
1 parent 242f85c commit 5aa4996

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

vision_agent/agent/vision_agent_v3.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
import sys
55
from pathlib import Path
6-
from typing import Any, Dict, List, Optional, Union, cast, Callable, no_type_check
6+
from typing import Any, Callable, Dict, List, Optional, Union, cast, no_type_check
77

88
from rich.console import Console
99
from rich.syntax import Syntax
@@ -14,6 +14,7 @@
1414
CODE,
1515
FEEDBACK,
1616
FIX_BUG,
17+
FULL_TASK,
1718
PLAN,
1819
REFLECT,
1920
SIMPLE_TEST,
@@ -332,7 +333,7 @@ def chat_with_workflow(
332333
self.verbosity,
333334
)
334335
results = write_and_test_code(
335-
plan_i_str,
336+
FULL_TASK.format(user_request=chat[0]["content"], subtasks=plan_i_str), # type: ignore
336337
tool_info,
337338
UTILITIES_DOCSTRING,
338339
format_memory(working_memory),
@@ -350,7 +351,14 @@ def chat_with_workflow(
350351
plan.append({"code": code, "test": test, "plan": plan_i})
351352

352353
if self_reflection:
353-
reflection = reflect(chat, plan_i_str, code, self.planner)
354+
reflection = reflect(
355+
chat,
356+
FULL_TASK.format(
357+
user_request=chat[0]["content"], subtasks=plan_i_str
358+
),
359+
code,
360+
self.planner,
361+
)
354362
if self.verbosity > 0:
355363
self.log_progress(
356364
{

vision_agent/agent/vision_agent_v3_prompts.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
{user_request}
44
"""
55

6+
FULL_TASK = """
7+
## User Request
8+
{user_request}
9+
10+
## Subtasks
11+
{subtasks}
12+
"""
13+
614
FEEDBACK = """
715
## This contains code and feedback from previous runs and is used for providing context so you do not make the same mistake again.
816
@@ -170,7 +178,7 @@ def find_text(image_path: str, text: str) -> str:
170178

171179

172180
FIX_BUG = """
173-
**Role** As a coder, your job is to find the error in the code and fix it. You are running in a notebook setting so feel free to run !pip install to install missing packages.
181+
**Role** As a coder, your job is to find the error in the code and fix it. You are running in a notebook setting so you can run !pip install to install missing packages.
174182
175183
**Instructions**:
176184
Please re-complete the code to fix the error message. Here is the previous version:

0 commit comments

Comments
 (0)