mirror of https://github.com/microsoft/autogen.git
Added m1 cli package (#4949)
* Added m1 cli package * update CI, install card, deprecations * Update python/packages/magentic-one-cli/pyproject.toml * fix mypy and pyright * add package * Suppress 'ResourceWarning: unclosed socket' --------- Co-authored-by: Jack Gerrits
This commit is contained in:
parent
a427b38000
commit
7131dc945d
|
@ -58,6 +58,7 @@ jobs:
|
|||
"./packages/agbench",
|
||||
"./packages/autogen-ext",
|
||||
"./packages/autogen-agentchat",
|
||||
"./packages/magentic-one-cli",
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -86,6 +87,7 @@ jobs:
|
|||
"./packages/agbench",
|
||||
"./packages/autogen-ext",
|
||||
"./packages/autogen-agentchat",
|
||||
"./packages/magentic-one-cli",
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -132,7 +134,7 @@ jobs:
|
|||
source ${{ github.workspace }}/python/.venv/bin/activate
|
||||
poe --directory ${{ matrix.package }} test
|
||||
working-directory: ./python
|
||||
|
||||
|
||||
codecov:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
@ -213,7 +215,7 @@ jobs:
|
|||
source ${{ github.workspace }}/python/.venv/bin/activate
|
||||
poe --directory ${{ matrix.package }} docs-check-examples
|
||||
working-directory: ./python
|
||||
|
||||
|
||||
samples-code-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
@ -14,6 +14,7 @@ on:
|
|||
- agbench
|
||||
- autogen-magentic-one
|
||||
- autogen-studio
|
||||
- magentic-one-cli
|
||||
ref:
|
||||
description: 'Tag to deploy'
|
||||
required: true
|
||||
|
|
|
@ -60,7 +60,7 @@ A multi-agent assistant for web and file-based tasks.
|
|||
Built on AgentChat.
|
||||
|
||||
```bash
|
||||
pip install magentic-one
|
||||
pip install magentic-one-cli
|
||||
m1 "Find flights from Seattle to Paris and format the result in a table"
|
||||
```
|
||||
|
||||
|
|
|
@ -18,14 +18,11 @@ dependencies = [
|
|||
"autogen-core==0.4.0.dev13",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
m1 = "autogen_ext.teams.magentic_one_cli:main"
|
||||
|
||||
[project.optional-dependencies]
|
||||
langchain = ["langchain_core~= 0.3.3"]
|
||||
azure = ["azure-core", "azure-identity"]
|
||||
docker = ["docker~=7.0"]
|
||||
openai = ["openai>=1.52.2", "aiofiles"]
|
||||
openai = ["openai>=1.52.2", "tiktoken>=0.8.0", "aiofiles"]
|
||||
file-surfer = [
|
||||
"autogen-agentchat==0.4.0.dev13",
|
||||
"markitdown>=0.0.1a2",
|
||||
|
|
|
@ -409,14 +409,14 @@ class BaseOpenAIChatCompletionClient(ChatCompletionClient):
|
|||
|
||||
# TODO: allow custom handling.
|
||||
# For now we raise an error if images are present and vision is not supported
|
||||
if self.capabilities["vision"] is False:
|
||||
if self.model_info["vision"] is False:
|
||||
for message in messages:
|
||||
if isinstance(message, UserMessage):
|
||||
if isinstance(message.content, list) and any(isinstance(x, Image) for x in message.content):
|
||||
raise ValueError("Model does not support vision and image was provided")
|
||||
|
||||
if json_output is not None:
|
||||
if self.capabilities["json_output"] is False and json_output is True:
|
||||
if self.model_info["json_output"] is False and json_output is True:
|
||||
raise ValueError("Model does not support JSON output")
|
||||
|
||||
if json_output is True:
|
||||
|
@ -424,13 +424,13 @@ class BaseOpenAIChatCompletionClient(ChatCompletionClient):
|
|||
else:
|
||||
create_args["response_format"] = {"type": "text"}
|
||||
|
||||
if self.capabilities["json_output"] is False and json_output is True:
|
||||
if self.model_info["json_output"] is False and json_output is True:
|
||||
raise ValueError("Model does not support JSON output")
|
||||
|
||||
oai_messages_nested = [to_oai_type(m) for m in messages]
|
||||
oai_messages = [item for sublist in oai_messages_nested for item in sublist]
|
||||
|
||||
if self.capabilities["function_calling"] is False and len(tools) > 0:
|
||||
if self.model_info["function_calling"] is False and len(tools) > 0:
|
||||
raise ValueError("Model does not support function calling")
|
||||
future: Union[Task[ParsedChatCompletion[BaseModel]], Task[ChatCompletion]]
|
||||
if len(tools) > 0:
|
||||
|
@ -622,14 +622,14 @@ class BaseOpenAIChatCompletionClient(ChatCompletionClient):
|
|||
|
||||
# TODO: allow custom handling.
|
||||
# For now we raise an error if images are present and vision is not supported
|
||||
if self.capabilities["vision"] is False:
|
||||
if self.model_info["vision"] is False:
|
||||
for message in messages:
|
||||
if isinstance(message, UserMessage):
|
||||
if isinstance(message.content, list) and any(isinstance(x, Image) for x in message.content):
|
||||
raise ValueError("Model does not support vision and image was provided")
|
||||
|
||||
if json_output is not None:
|
||||
if self.capabilities["json_output"] is False and json_output is True:
|
||||
if self.model_info["json_output"] is False and json_output is True:
|
||||
raise ValueError("Model does not support JSON output")
|
||||
|
||||
if json_output is True:
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
|
@ -0,0 +1 @@
|
|||
# magentic-one-cli
|
|
@ -0,0 +1,47 @@
|
|||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "magentic-one-cli"
|
||||
version = "0.1.0"
|
||||
license = {file = "LICENSE-CODE"}
|
||||
description = "Magentic-One is a generalist multi-agent system, built on `AutoGen-AgentChat`, for solving complex web and file-based tasks. This package installs the `m1` command-line utility to quickly get started with Magentic-One."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
dependencies = [
|
||||
"autogen-agentchat", #>=0.4.0<0.5
|
||||
"autogen-ext[openai,magentic-one]", #>=0.4.0<0.5
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
m1 = "magentic_one_cli._m1:main"
|
||||
|
||||
[dependency-groups]
|
||||
dev = []
|
||||
|
||||
|
||||
[tool.ruff]
|
||||
extend = "../../pyproject.toml"
|
||||
include = ["src/**", "tests/*.py"]
|
||||
|
||||
[tool.pyright]
|
||||
extends = "../../pyproject.toml"
|
||||
include = ["src"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
minversion = "6.0"
|
||||
testpaths = ["tests"]
|
||||
|
||||
[tool.poe]
|
||||
include = "../../shared_tasks.toml"
|
||||
|
||||
[tool.poe.tasks]
|
||||
mypy = "mypy --config-file $POE_ROOT/../../pyproject.toml src"
|
||||
test = "true"
|
||||
coverage = "true"
|
|
@ -0,0 +1,3 @@
|
|||
from ._m1 import main
|
||||
|
||||
main()
|
|
@ -1,11 +1,14 @@
|
|||
import argparse
|
||||
import asyncio
|
||||
import warnings
|
||||
|
||||
from autogen_agentchat.ui import Console
|
||||
|
||||
from autogen_ext.models.openai import OpenAIChatCompletionClient
|
||||
from autogen_ext.teams.magentic_one import MagenticOne
|
||||
|
||||
# Suppress warnings about the requests.Session() not being closed
|
||||
warnings.filterwarnings(action="ignore", message="unclosed", category=ResourceWarning)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""
|
|
@ -31,9 +31,10 @@ autogen-agentchat = { workspace = true }
|
|||
autogen-core = { workspace = true }
|
||||
autogen-ext = { workspace = true }
|
||||
autogen-magentic-one = { workspace = true }
|
||||
autogenstudio = { workspace = true }
|
||||
autogen-test-utils = { workspace = true }
|
||||
autogenstudio = { workspace = true }
|
||||
component-schema-gen = { workspace = true }
|
||||
magentic-one-cli = { workspace = true }
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
|
|
|
@ -26,6 +26,7 @@ members = [
|
|||
"autogen-test-utils",
|
||||
"autogenstudio",
|
||||
"component-schema-gen",
|
||||
"magentic-one-cli",
|
||||
]
|
||||
|
||||
[manifest.dependency-groups]
|
||||
|
@ -509,6 +510,7 @@ magentic-one = [
|
|||
openai = [
|
||||
{ name = "aiofiles" },
|
||||
{ name = "openai" },
|
||||
{ name = "tiktoken" },
|
||||
]
|
||||
video-surfer = [
|
||||
{ name = "autogen-agentchat" },
|
||||
|
@ -553,6 +555,7 @@ requires-dist = [
|
|||
{ name = "pillow", marker = "extra == 'web-surfer'", specifier = ">=11.0.0" },
|
||||
{ name = "playwright", marker = "extra == 'magentic-one'", specifier = ">=1.48.0" },
|
||||
{ name = "playwright", marker = "extra == 'web-surfer'", specifier = ">=1.48.0" },
|
||||
{ name = "tiktoken", marker = "extra == 'openai'", specifier = ">=0.8.0" },
|
||||
]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
|
@ -2463,6 +2466,24 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/ba/b2/6a22fb5c0885da3b00e116aee81f0b829ec9ac8f736cd414b4a09413fc7d/lxml-5.3.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:6e91cf736959057f7aac7adfc83481e03615a8e8dd5758aa1d95ea69e8931dba", size = 3487557 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "magentic-one-cli"
|
||||
version = "0.1.0"
|
||||
source = { editable = "packages/magentic-one-cli" }
|
||||
dependencies = [
|
||||
{ name = "autogen-agentchat" },
|
||||
{ name = "autogen-ext", extra = ["magentic-one", "openai"] },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "autogen-agentchat", editable = "packages/autogen-agentchat" },
|
||||
{ name = "autogen-ext", extras = ["openai", "magentic-one"], editable = "packages/autogen-ext" },
|
||||
]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = []
|
||||
|
||||
[[package]]
|
||||
name = "mako"
|
||||
version = "1.3.6"
|
||||
|
|
Loading…
Reference in New Issue