mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
Refactor code executor namespace (#4538)
* refactor code exec namespaces * delete code exec init * update conflicts --------- Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
c02d87e9cf
commit
4018a129f8
@@ -1,4 +0,0 @@
|
||||
from ._azure_container_code_executor import ACADynamicSessionsCodeExecutor, TokenProvider
|
||||
from ._docker_code_executor import DockerCommandLineCodeExecutor
|
||||
|
||||
__all__ = ["DockerCommandLineCodeExecutor", "TokenProvider", "ACADynamicSessionsCodeExecutor"]
|
||||
@@ -0,0 +1,3 @@
|
||||
from ._azure_container_code_executor import ACADynamicSessionsCodeExecutor, TokenProvider
|
||||
|
||||
__all__ = ["TokenProvider", "ACADynamicSessionsCodeExecutor"]
|
||||
@@ -23,7 +23,7 @@ from autogen_core.code_executor import (
|
||||
)
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
from ._common import build_python_functions_file, get_required_packages, to_stub
|
||||
from .._common import build_python_functions_file, get_required_packages, to_stub
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from azure.core.credentials import AccessToken
|
||||
@@ -47,7 +47,11 @@ class ACADynamicSessionsCodeExecutor(CodeExecutor):
|
||||
|
||||
.. note::
|
||||
|
||||
This class requires the :code:`azure` extra for the :code:`autogen-ext` package.
|
||||
This class requires the :code:`azure` extra for the :code:`autogen-ext` package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install 'autogen-ext[azure]==0.4.0.dev7'
|
||||
|
||||
|
||||
**This will execute LLM generated code on an Azure dynamic code container.**
|
||||
@@ -0,0 +1,3 @@
|
||||
from ._docker_code_executor import DockerCommandLineCodeExecutor
|
||||
|
||||
__all__ = ["DockerCommandLineCodeExecutor"]
|
||||
@@ -22,7 +22,7 @@ from autogen_core.code_executor import (
|
||||
FunctionWithRequirementsStr,
|
||||
)
|
||||
|
||||
from ._common import (
|
||||
from .._common import (
|
||||
CommandLineCodeResult,
|
||||
build_python_functions_file,
|
||||
get_file_name_from_content,
|
||||
@@ -55,7 +55,11 @@ class DockerCommandLineCodeExecutor(CodeExecutor):
|
||||
|
||||
.. note::
|
||||
|
||||
This class requires the :code:`docker` extra for the :code:`autogen-ext` package.
|
||||
This class requires the :code:`docker` extra for the :code:`autogen-ext` package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install 'autogen-ext[docker]==0.4.0.dev7'
|
||||
|
||||
|
||||
The executor first saves each code block in a file in the working
|
||||
@@ -323,6 +327,7 @@ $functions"""
|
||||
async def start(self) -> None:
|
||||
try:
|
||||
import asyncio_atexit
|
||||
|
||||
import docker
|
||||
from docker.errors import ImageNotFound
|
||||
except ImportError as e:
|
||||
@@ -10,7 +10,7 @@ import pytest
|
||||
from anyio import open_file
|
||||
from autogen_core import CancellationToken
|
||||
from autogen_core.code_executor import CodeBlock
|
||||
from autogen_ext.code_executors import ACADynamicSessionsCodeExecutor
|
||||
from autogen_ext.code_executors.azure import ACADynamicSessionsCodeExecutor
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
UNIX_SHELLS = ["bash", "sh", "shell"]
|
||||
|
||||
@@ -11,7 +11,7 @@ from autogen_core.code_executor import (
|
||||
FunctionWithRequirements,
|
||||
with_requirements,
|
||||
)
|
||||
from autogen_ext.code_executors import ACADynamicSessionsCodeExecutor
|
||||
from autogen_ext.code_executors.azure import ACADynamicSessionsCodeExecutor
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
ENVIRON_KEY_AZURE_POOL_ENDPOINT = "AZURE_POOL_ENDPOINT"
|
||||
|
||||
@@ -10,7 +10,7 @@ import pytest_asyncio
|
||||
from aiofiles import open
|
||||
from autogen_core import CancellationToken
|
||||
from autogen_core.code_executor import CodeBlock
|
||||
from autogen_ext.code_executors import DockerCommandLineCodeExecutor
|
||||
from autogen_ext.code_executors.docker import DockerCommandLineCodeExecutor
|
||||
|
||||
|
||||
def docker_tests_enabled() -> bool:
|
||||
|
||||
Reference in New Issue
Block a user