Skip to content

Commit

Permalink
feat: new artifact structure (#240)
Browse files Browse the repository at this point in the history
* feat: new artifact structure

* address comment

* adddress comment
  • Loading branch information
wuyiqunLu authored Sep 19, 2024
1 parent cc8be2e commit 32c6c0a
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions vision_agent/tools/meta_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ def create_code_artifact(artifacts: Artifacts, name: str) -> str:
display(
{
MimeType.APPLICATION_ARTIFACT: json.dumps(
{"name": name, "content": artifacts[name]}
{
"name": name,
"content": artifacts[name],
"action": "create",
}
)
},
raw=True,
Expand Down Expand Up @@ -305,7 +309,11 @@ def edit_code_artifact(
display(
{
MimeType.APPLICATION_ARTIFACT: json.dumps(
{"name": name, "content": artifacts[name]}
{
"name": name,
"content": artifacts[name],
"action": "edit",
}
)
},
raw=True,
Expand Down Expand Up @@ -366,7 +374,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)
Expand Down Expand Up @@ -434,7 +451,15 @@ 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,
"action": "edit",
}
)
},
raw=True,
)
return view_lines(code_lines, 0, total_lines, name, total_lines)
Expand Down

0 comments on commit 32c6c0a

Please sign in to comment.