From 4dec2abcf3747b9301d2d8ed7ffb0d15caa1e77b Mon Sep 17 00:00:00 2001 From: wuyiqunLu Date: Thu, 19 Sep 2024 11:39:36 +0800 Subject: [PATCH] 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)