Skip to content

Commit

Permalink
fixed user req prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed May 28, 2024
1 parent 242f85c commit 5aa4996
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
14 changes: 11 additions & 3 deletions vision_agent/agent/vision_agent_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional, Union, cast, Callable, no_type_check
from typing import Any, Callable, Dict, List, Optional, Union, cast, no_type_check

from rich.console import Console
from rich.syntax import Syntax
Expand All @@ -14,6 +14,7 @@
CODE,
FEEDBACK,
FIX_BUG,
FULL_TASK,
PLAN,
REFLECT,
SIMPLE_TEST,
Expand Down Expand Up @@ -332,7 +333,7 @@ def chat_with_workflow(
self.verbosity,
)
results = write_and_test_code(
plan_i_str,
FULL_TASK.format(user_request=chat[0]["content"], subtasks=plan_i_str), # type: ignore
tool_info,
UTILITIES_DOCSTRING,
format_memory(working_memory),
Expand All @@ -350,7 +351,14 @@ def chat_with_workflow(
plan.append({"code": code, "test": test, "plan": plan_i})

if self_reflection:
reflection = reflect(chat, plan_i_str, code, self.planner)
reflection = reflect(
chat,
FULL_TASK.format(
user_request=chat[0]["content"], subtasks=plan_i_str
),
code,
self.planner,
)
if self.verbosity > 0:
self.log_progress(
{
Expand Down
10 changes: 9 additions & 1 deletion vision_agent/agent/vision_agent_v3_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
{user_request}
"""

FULL_TASK = """
## User Request
{user_request}
## Subtasks
{subtasks}
"""

FEEDBACK = """
## This contains code and feedback from previous runs and is used for providing context so you do not make the same mistake again.
Expand Down Expand Up @@ -170,7 +178,7 @@ def find_text(image_path: str, text: str) -> str:


FIX_BUG = """
**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.
**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.
**Instructions**:
Please re-complete the code to fix the error message. Here is the previous version:
Expand Down

0 comments on commit 5aa4996

Please sign in to comment.