Move local code exec to ext, uplevel components (#4557)

This commit is contained in:
Jack Gerrits
2024-12-04 20:21:46 -08:00
committed by GitHub
parent cc6765b189
commit 9af450a59f
30 changed files with 927 additions and 115 deletions

View File

@@ -26,8 +26,8 @@ python/autogen_agentchat.state
:caption: AutoGen Core
python/autogen_core
python/autogen_core.code_executor
python/autogen_core.components.models
python/autogen_core.components.code_executor
python/autogen_core.components.model_context
python/autogen_core.components.tools
python/autogen_core.components.tool_agent

View File

@@ -0,0 +1,7 @@
autogen\_core.code_executor
===========================
.. automodule:: autogen_core.code_executor
:members:
:undoc-members:
:show-inheritance:

View File

@@ -1,8 +0,0 @@
autogen\_core.components.code\_executor
=======================================
.. automodule:: autogen_core.components.code_executor
:members:
:undoc-members:
:show-inheritance:

View File

@@ -11,7 +11,7 @@
"This means that each code block is executed in a new process. There are two forms of this executor:\n",
"\n",
"- Docker ({py:class}`~autogen_ext.code_executor.docker_executor.DockerCommandLineCodeExecutor`) - this is where all commands are executed in a Docker container\n",
"- Local ({py:class}`~autogen_core.components.code_executor.LocalCommandLineCodeExecutor`) - this is where all commands are executed on the host machine\n",
"- Local ({py:class}`~autogen_core.code_executor.local.LocalCommandLineCodeExecutor`) - this is where all commands are executed on the host machine\n",
"\n",
"## Docker\n",
"\n",
@@ -40,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
@@ -55,7 +55,7 @@
"from pathlib import Path\n",
"\n",
"from autogen_core import CancellationToken\n",
"from autogen_core.components.code_executor import CodeBlock\n",
"from autogen_core.code_executor import CodeBlock\n",
"from autogen_ext.code_executors import DockerCommandLineCodeExecutor\n",
"\n",
"work_dir = Path(\"coding\")\n",
@@ -111,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
@@ -126,7 +126,8 @@
"from pathlib import Path\n",
"\n",
"from autogen_core import CancellationToken\n",
"from autogen_core.components.code_executor import CodeBlock, LocalCommandLineCodeExecutor\n",
"from autogen_core.code_executor import CodeBlock\n",
"from autogen_ext.code_executors.local import LocalCommandLineCodeExecutor\n",
"\n",
"work_dir = Path(\"coding\")\n",
"work_dir.mkdir(exist_ok=True)\n",
@@ -153,7 +154,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
@@ -172,7 +173,8 @@
"from pathlib import Path\n",
"\n",
"from autogen_core import CancellationToken\n",
"from autogen_core.components.code_executor import CodeBlock, LocalCommandLineCodeExecutor\n",
"from autogen_core.code_executor import CodeBlock\n",
"from autogen_ext.code_executors.local import LocalCommandLineCodeExecutor\n",
"\n",
"work_dir = Path(\"coding\")\n",
"work_dir.mkdir(exist_ok=True)\n",
@@ -197,20 +199,6 @@
"source": [
"As we can see, the code has executed successfully, and the installation has been isolated to the newly created virtual environment, without affecting our global environment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@@ -229,7 +217,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.12.5"
}
},
"nbformat": 4,