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

Fix Issues for App #275

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cfe4201
add more checks around changing new/old format
dillonalaird Oct 15, 2024
79151bb
fix issue with raising json error type
dillonalaird Oct 15, 2024
9b28706
only add artifacts to media list if they exist
dillonalaird Oct 15, 2024
9405de0
only add artifacts to media list if they exist
dillonalaird Oct 15, 2024
398ff23
only add artifacts to media list if they exist
dillonalaird Oct 15, 2024
d011617
extract media from ipython display
dillonalaird Oct 15, 2024
d92e192
add better prompts for dealing with artifacts
dillonalaird Oct 15, 2024
250bbaa
add another prmopt example, reformat to reduce complex
dillonalaird Oct 15, 2024
b2bcc9f
add another prompt for editing code
dillonalaird Oct 15, 2024
9ab9e1d
fix issues with edit code
dillonalaird Oct 15, 2024
0247de1
remove verbosity arg
dillonalaird Oct 16, 2024
c514da3
limit context length and amount of debugging VA does
dillonalaird Oct 16, 2024
3f86993
fix side case with edit_artifact
dillonalaird Oct 16, 2024
04c57f9
remove generate vision plan
dillonalaird Oct 16, 2024
5fa377e
better parsing for json
dillonalaird Oct 16, 2024
c8eea97
loop over formats
dillonalaird Oct 16, 2024
666ab3c
updated prompt to tell it save_image/video will save to artifacts
dillonalaird Oct 16, 2024
906ee66
ensure artifact is saved
dillonalaird Oct 16, 2024
802c7e2
remove break point
dillonalaird Oct 16, 2024
b58e48d
fixed type errors
dillonalaird Oct 16, 2024
55fc598
upload and download artifacts per turn
dillonalaird Oct 16, 2024
8161c48
fixed streamlit app for new updates
dillonalaird Oct 16, 2024
dea8756
reduced code complexity
dillonalaird Oct 16, 2024
38f23d3
fix test case
dillonalaird Oct 16, 2024
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
14 changes: 11 additions & 3 deletions examples/chat/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@
"style": {"bottom": "calc(50% - 4.25rem", "right": "0.4rem"},
}
# set artifacts remote_path to WORKSPACE
artifacts = va.tools.meta_tools.Artifacts(WORKSPACE / "artifacts.pkl")
local_artifacts_path = "artifacts.pkl"
remote_artifacts_path = WORKSPACE / "artifacts.pkl"
artifacts = va.tools.meta_tools.Artifacts(remote_artifacts_path, local_artifacts_path)
if Path("artifacts.pkl").exists():
artifacts.load("artifacts.pkl")
else:
artifacts.save("artifacts.pkl")

agent = va.agent.VisionAgent(verbosity=1, local_artifacts_path="artifacts.pkl")
agent = va.agent.VisionAgent(
verbosity=2,
local_artifacts_path=local_artifacts_path,
remote_artifacts_path=remote_artifacts_path,
)

st.set_page_config(layout="wide")

Expand All @@ -54,7 +60,9 @@ def update_messages(messages, lock):
with lock:
if Path("artifacts.pkl").exists():
artifacts.load("artifacts.pkl")
new_chat, _ = agent.chat_with_artifacts(messages, artifacts=artifacts)
new_chat, _ = agent.chat_with_artifacts(
messages, artifacts=artifacts, test_multi_plan=False
)
for new_message in new_chat[len(messages) :]:
messages.append(new_message)

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_meta_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_check_and_load_image_two():


def test_use_object_detection_fine_tuning_none():
artifacts = Artifacts("test")
artifacts = Artifacts("test", "test")
code = "print('Hello, World!')"
artifacts["code"] = code
output = use_object_detection_fine_tuning(artifacts, "code", "123")
Expand All @@ -33,7 +33,7 @@ def test_use_object_detection_fine_tuning_none():


def test_use_object_detection_fine_tuning():
artifacts = Artifacts("test")
artifacts = Artifacts("test", "test")
code = """florence2_phrase_grounding('one', image1)
owl_v2_image('two', image2)
florence2_sam2_image('three', image3)"""
Expand All @@ -50,7 +50,7 @@ def test_use_object_detection_fine_tuning():


def test_use_object_detection_fine_tuning_twice():
artifacts = Artifacts("test")
artifacts = Artifacts("test", "test")
code = """florence2_phrase_grounding('one', image1)
owl_v2_image('two', image2)
florence2_sam2_image('three', image3)"""
Expand All @@ -75,7 +75,7 @@ def test_use_object_detection_fine_tuning_twice():


def test_use_object_detection_fine_tuning_real_case():
artifacts = Artifacts("test")
artifacts = Artifacts("test", "test")
code = "florence2_phrase_grounding('(strange arg)', image1)"
expected_code = 'florence2_phrase_grounding("(strange arg)", image1, "123")'
artifacts["code"] = code
Expand Down
4 changes: 3 additions & 1 deletion vision_agent/agent/agent_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def extract_json(json_str: str) -> Dict[str, Any]:
if json_dict is None:
error_msg = f"Could not extract JSON from the given str: {json_orig}"
_LOGGER.exception(error_msg)
raise ValueError(error_msg)
raise json.JSONDecodeError(
msg="Could not extract JSON", doc=json_orig, pos=0
)

return json_dict

Expand Down
Loading
Loading