Skip to content

Commit

Permalink
show artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
yzld2002 committed Oct 1, 2024
1 parent 2b2d5bc commit d45d034
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def chat_with_code(
remote_artifacts_path = code_interpreter.upload_file(
self.local_artifacts_path
)
artifacts_loaded = artifacts.show()
artifacts_loaded = artifacts.show(code_interpreter.remote_path)
int_chat.append({"role": "observation", "content": artifacts_loaded})
orig_chat.append({"role": "observation", "content": artifacts_loaded})
self.streaming_message({"role": "observation", "content": artifacts_loaded})
Expand Down
11 changes: 7 additions & 4 deletions vision_agent/tools/meta_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ def load(self, file_path: Union[str, Path]) -> None:
with open(self.remote_save_path.parent / k, mode) as f:
f.write(v)

def show(self) -> str:
def show(self, uploaded_file_path: Optional[Union[str, Path]] = None) -> str:
"""Shows the artifacts that have been loaded and their remote save paths."""
loaded_path = (
Path(uploaded_file_path)
if uploaded_file_path is not None
else self.remote_save_path
)
output_str = "[Artifacts loaded]\n"
for k in self.artifacts.keys():
output_str += (
f"Artifact {k} loaded to {str(self.remote_save_path.parent / k)}\n"
)
output_str += f"Artifact {k} loaded to {str(loaded_path / k)}\n"
output_str += "[End of artifacts]\n"
print(output_str)
return output_str
Expand Down

0 comments on commit d45d034

Please sign in to comment.