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

feat: support passing env to e2b #223

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion vision_agent/agent/vision_agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ def chat_with_workflow(
test_multi_plan: bool = True,
display_visualization: bool = False,
customized_tool_names: Optional[List[str]] = None,
envs: Optional[Dict[str, str]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a docstring for the envs parameter explaining what is this used for ? Since this is a most used function by developers , it might be helpful for them to understand the envs parameter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks for the suggestion!

) -> Dict[str, Any]:
"""Chat with VisionAgentCoder and return intermediate information regarding the
task.
Expand Down Expand Up @@ -703,7 +704,7 @@ def chat_with_workflow(

# NOTE: each chat should have a dedicated code interpreter instance to avoid concurrency issues
with CodeInterpreterFactory.new_instance(
code_sandbox_runtime=self.code_sandbox_runtime
code_sandbox_runtime=self.code_sandbox_runtime, envs=envs
) as code_interpreter:
chat = copy.deepcopy(chat)
media_list = []
Expand Down
3 changes: 2 additions & 1 deletion vision_agent/utils/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,13 @@ def get_default_instance() -> CodeInterpreter:
def new_instance(
code_sandbox_runtime: Optional[str] = None,
remote_path: Optional[Union[str, Path]] = None,
envs: Optional[Dict[str, str]] = None,
) -> CodeInterpreter:
if not code_sandbox_runtime:
code_sandbox_runtime = os.getenv("CODE_SANDBOX_RUNTIME", "local")
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
Loading