Skip to content

Commit

Permalink
Update prompts (#96)
Browse files Browse the repository at this point in the history
* fixed user req prompt

* ran isort

* fixed type issue
  • Loading branch information
dillonalaird authored May 28, 2024
1 parent 242f85c commit 3f77538
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vision_agent/agent/agent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Dict, List, Optional, Union, Any
from typing import Any, Dict, List, Optional, Union


class Agent(ABC):
Expand Down
2 changes: 1 addition & 1 deletion vision_agent/agent/agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import sys
from pathlib import Path
from typing import Dict, List, Optional, Union, Any
from typing import Any, Dict, List, Optional, Union

from rich.console import Console
from rich.syntax import Syntax
Expand Down
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),
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 3f77538

Please sign in to comment.