From 4dec2abcf3747b9301d2d8ed7ffb0d15caa1e77b Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Thu, 19 Sep 2024 11:39:36 +0800 Subject: [PATCH 1/3] feat: new artifact structure --- vision_agent/tools/meta_tools.py | 37 ++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/vision_agent/tools/meta_tools.py b/vision_agent/tools/meta_tools.py index bcdbefb6..42ad1bb9 100644 --- a/vision_agent/tools/meta_tools.py +++ b/vision_agent/tools/meta_tools.py @@ -211,14 +211,6 @@ def create_code_artifact(artifacts: Artifacts, name: str) -> str: return_str = f"[Artifact {name} created]" print(return_str) - display( - { - MimeType.APPLICATION_ARTIFACT: json.dumps( - {"name": name, "content": artifacts[name]} - ) - }, - raw=True, - ) return return_str @@ -305,7 +297,12 @@ def edit_code_artifact( display( { MimeType.APPLICATION_ARTIFACT: json.dumps( - {"name": name, "content": artifacts[name]} + { + "name": name, + "content": artifacts[name], + "contentType": "vision_code", + "action": "edit", + } ) }, raw=True, @@ -366,7 +363,16 @@ def detect_dogs(image_path: str): total_lines = len(code_lines) display( - {MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})}, + { + MimeType.APPLICATION_ARTIFACT: json.dumps( + { + "name": name, + "content": code, + "contentType": "vision_code", + "action": "create", + } + ) + }, raw=True, ) return view_lines(code_lines, 0, total_lines, name, total_lines) @@ -434,7 +440,16 @@ def detect_dogs(image_path: str): total_lines = len(code_lines) display( - {MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})}, + { + MimeType.APPLICATION_ARTIFACT: json.dumps( + { + "name": name, + "content": code, + "contentType": "vision_code", + "action": "edit", + } + ) + }, raw=True, ) return view_lines(code_lines, 0, total_lines, name, total_lines) From 1c208cb749c7cfea48bc9a8603a1fa47b06e0251 Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Thu, 19 Sep 2024 11:52:13 +0800 Subject: [PATCH 2/3] address comment --- vision_agent/tools/meta_tools.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/vision_agent/tools/meta_tools.py b/vision_agent/tools/meta_tools.py index 42ad1bb9..14e49cbf 100644 --- a/vision_agent/tools/meta_tools.py +++ b/vision_agent/tools/meta_tools.py @@ -300,7 +300,6 @@ def edit_code_artifact( { "name": name, "content": artifacts[name], - "contentType": "vision_code", "action": "edit", } ) @@ -445,7 +444,6 @@ def detect_dogs(image_path: str): { "name": name, "content": code, - "contentType": "vision_code", "action": "edit", } ) From 15808c64730bd0d2906ba1698f5b34dc71fc2d05 Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Thu, 19 Sep 2024 12:02:07 +0800 Subject: [PATCH 3/3] adddress comment --- vision_agent/tools/meta_tools.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vision_agent/tools/meta_tools.py b/vision_agent/tools/meta_tools.py index 14e49cbf..9012e9d4 100644 --- a/vision_agent/tools/meta_tools.py +++ b/vision_agent/tools/meta_tools.py @@ -211,6 +211,18 @@ def create_code_artifact(artifacts: Artifacts, name: str) -> str: return_str = f"[Artifact {name} created]" print(return_str) + display( + { + MimeType.APPLICATION_ARTIFACT: json.dumps( + { + "name": name, + "content": artifacts[name], + "action": "create", + } + ) + }, + raw=True, + ) return return_str