Compare commits

...

4 Commits

Author SHA1 Message Date
João Moura
a336381849 adding agent to task output 2024-05-16 05:12:32 -03:00
Jason Schrader
208c3a780c Add version command to CLI (#348)
* feat: add version command to cli with tools flag

* test: check output of version and tools flag

* fix: add version tool info to cli outputs
2024-05-15 19:50:49 -03:00
João Moura
1e112fa50a fixing crew base 2024-05-14 17:40:38 -03:00
João Moura
38fc5510ed ppreparing new version 0.30.9 2024-05-14 11:32:05 -03:00
8 changed files with 48 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "crewai"
version = "0.30.8"
version = "0.30.11"
description = "Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks."
authors = ["Joao Moura <joao@crewai.com>"]
readme = "README.md"

View File

@@ -1,4 +1,5 @@
import click
import pkg_resources
from .create_crew import create_crew
@@ -15,5 +16,22 @@ def create(project_name):
create_crew(project_name)
@crewai.command()
@click.option(
"--tools", is_flag=True, help="Show the installed version of crewai tools"
)
def version(tools):
"""Show the installed version of crewai."""
crewai_version = pkg_resources.get_distribution("crewai").version
click.echo(f"crewai version: {crewai_version}")
if tools:
try:
tools_version = pkg_resources.get_distribution("crewai[tools]").version
click.echo(f"crewai tools version: {tools_version}")
except pkg_resources.DistributionNotFound:
click.echo("crewai tools not installed")
if __name__ == "__main__":
crewai()

View File

@@ -6,7 +6,7 @@ authors = ["Your Name <you@example.com>"]
[tool.poetry.dependencies]
python = ">=3.10,<=3.13"
crewai = {extras = ["tools"], version = "^0.30.8"}
crewai = {extras = ["tools"], version = "^0.30.11"}
[tool.poetry.scripts]
{{folder_name}} = "{{folder_name}}.main:run"

View File

View File

@@ -1,22 +1,19 @@
import inspect
import os
from pathlib import Path
import yaml
import os
from pathlib import Path
from pydantic import ConfigDict
from dotenv import load_dotenv
load_dotenv()
def CrewBase(cls):
class WrappedClass(cls):
model_config = ConfigDict(arbitrary_types_allowed=True)
is_crew_class: bool = True
class Config:
arbitrary_types_allowed = True
ignored_types = [bool]
base_directory = None
for frame_info in inspect.stack():
if "site-packages" not in frame_info.filename:

View File

@@ -201,6 +201,7 @@ class Task(BaseModel):
description=self.description,
exported_output=exported_output,
raw_output=result,
agent=agent.role,
)
if self.callback:

View File

@@ -11,6 +11,7 @@ class TaskOutput(BaseModel):
exported_output: Union[str, BaseModel] = Field(
description="Output of the task", default=None
)
agent: str = Field(description="Agent that executed the task")
raw_output: str = Field(description="Result of the task")
@model_validator(mode="after")

20
tests/cli_test.py Normal file
View File

@@ -0,0 +1,20 @@
from click.testing import CliRunner
from crewai.cli.cli import version
def test_version_command():
runner = CliRunner()
result = runner.invoke(version)
assert result.exit_code == 0
assert "crewai version:" in result.output
def test_version_command_with_tools():
runner = CliRunner()
result = runner.invoke(version, ["--tools"])
assert result.exit_code == 0
assert "crewai version:" in result.output
assert (
"crewai tools version:" in result.output
or "crewai tools not installed" in result.output
)