From 50c78e471419083d7fac42ca8ee7e8a553a421bc Mon Sep 17 00:00:00 2001 From: Zhichao Date: Thu, 12 Sep 2024 11:21:25 +0800 Subject: [PATCH] add OPENAI_API_KEY to e2b env --- vision_agent/utils/execute.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vision_agent/utils/execute.py b/vision_agent/utils/execute.py index c2e0e652..d0a713cc 100644 --- a/vision_agent/utils/execute.py +++ b/vision_agent/utils/execute.py @@ -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(