Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prompts #96

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading