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: claude artifact path #252

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
6 changes: 4 additions & 2 deletions vision_agent/utils/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ def __init__(
_LOGGER.info(
f"E2BCodeInterpreter (sandbox id: {self.interpreter.sandbox_id}) initialized:\n{sys_versions}"
)
self.remote_path = Path(remote_path if remote_path is not None else WORKSPACE)
self.remote_path = Path(
remote_path if remote_path is not None else "/home/user"
)

def close(self, *args: Any, **kwargs: Any) -> None:
try:
Expand Down Expand Up @@ -713,7 +715,7 @@ def _get_e2b_env() -> Union[Dict[str, str], None]:
openai_api_key = os.getenv("OPENAI_API_KEY", "")
anthropic_api_key = os.getenv("ANTHROPIC_API_KEY", "")
if openai_api_key or anthropic_api_key:
envs = {}
envs = {"WORKSPACE": os.getenv("WORKSPACE", "/home/user")}
if openai_api_key:
envs["OPENAI_API_KEY"] = openai_api_key
if anthropic_api_key:
Expand Down
Loading