Skip to content

Commit

Permalink
add OPENAI_API_KEY to e2b env
Browse files Browse the repository at this point in the history
  • Loading branch information
yzld2002 committed Sep 12, 2024
1 parent 7c97e58 commit 50c78e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vision_agent/utils/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,11 @@ def new_instance(
) -> CodeInterpreter:
if not code_sandbox_runtime:
code_sandbox_runtime = os.getenv("CODE_SANDBOX_RUNTIME", "local")
openai_api_key = os.getenv("OPENAI_API_KEY", "")
envs = {"OPENAI_API_KEY": openai_api_key} if openai_api_key else None
if code_sandbox_runtime == "e2b":
instance: CodeInterpreter = E2BCodeInterpreter(
timeout=_SESSION_TIMEOUT, remote_path=remote_path
timeout=_SESSION_TIMEOUT, remote_path=remote_path, envs=envs
)
elif code_sandbox_runtime == "local":
instance = LocalCodeInterpreter(
Expand Down

0 comments on commit 50c78e4

Please sign in to comment.