Skip to content

Commit

Permalink
updating crewai version
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura committed Oct 23, 2024
1 parent a921828 commit 74c1703
Show file tree
Hide file tree
Showing 10 changed files with 1,016 additions and 1,094 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "crewai"
version = "0.75.1"
version = "0.76.0"
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."
readme = "README.md"
requires-python = ">=3.10,<=3.13"
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
category=UserWarning,
module="pydantic.main",
)
__version__ = "0.75.1"
__version__ = "0.76.0"
__all__ = ["Agent", "Crew", "Process", "Task", "Pipeline", "Router", "LLM", "Flow"]
5 changes: 3 additions & 2 deletions src/crewai/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ def crewai():
@crewai.command()
@click.argument("type", type=click.Choice(["crew", "pipeline", "flow"]))
@click.argument("name")
@click.option("--skip-provider", is_flag=True, help="Skip provider validation")
@click.option("--provider", type=str, help="The provider to use for the crew")
def create(type, name, provider):
def create(type, name, provider, skip_provider_validation=False):
"""Create a new crew, pipeline, or flow."""
if type == "crew":
create_crew(name, provider)
create_crew(name, provider, skip_provider_validation)
elif type == "pipeline":
create_pipeline(name)
elif type == "flow":
Expand Down
137 changes: 72 additions & 65 deletions src/crewai/cli/create_crew.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,77 +81,84 @@ def copy_template_files(folder_path, name, class_name, parent_folder):
copy_template(src_file, dst_file, name, class_name, folder_path.name)


def create_crew(name, parent_folder=None):
def create_crew(
name, provider=None, skip_provider_validation=False, parent_folder=None
):
folder_path, folder_name, class_name = create_folder_structure(name, parent_folder)
env_vars = load_env_vars(folder_path)

existing_provider = None
for provider, env_keys in ENV_VARS.items():
if any(key in env_vars for key in env_keys):
existing_provider = provider
break

if existing_provider:
if not click.confirm(
f"Found existing environment variable configuration for {existing_provider.capitalize()}. Do you want to override it?"
):
click.secho("Keeping existing provider configuration.", fg="yellow")
if not skip_provider_validation:
if not provider:
provider_models = get_provider_data()
if not provider_models:
return

existing_provider = None
for provider, env_keys in ENV_VARS.items():
if any(key in env_vars for key in env_keys):
existing_provider = provider
break

if existing_provider:
if not click.confirm(
f"Found existing environment variable configuration for {existing_provider.capitalize()}. Do you want to override it?"
):
click.secho("Keeping existing provider configuration.", fg="yellow")
return

provider_models = get_provider_data()
if not provider_models:
return

provider_models = get_provider_data()
if not provider_models:
return

while True:
selected_provider = select_provider(provider_models)
if selected_provider is None: # User typed 'q'
click.secho("Exiting...", fg="yellow")
sys.exit(0)
if selected_provider: # Valid selection
break
click.secho(
"No provider selected. Please try again or press 'q' to exit.", fg="red"
)

while True:
selected_model = select_model(selected_provider, provider_models)
if selected_model is None: # User typed 'q'
click.secho("Exiting...", fg="yellow")
sys.exit(0)
if selected_model: # Valid selection
break
click.secho(
"No model selected. Please try again or press 'q' to exit.", fg="red"
)

if selected_provider in PROVIDERS:
api_key_var = ENV_VARS[selected_provider][0]
else:
api_key_var = click.prompt(
f"Enter the environment variable name for your {selected_provider.capitalize()} API key",
type=str,
default="",
)
while True:
selected_provider = select_provider(provider_models)
if selected_provider is None: # User typed 'q'
click.secho("Exiting...", fg="yellow")
sys.exit(0)
if selected_provider: # Valid selection
break
click.secho(
"No provider selected. Please try again or press 'q' to exit.", fg="red"
)

while True:
selected_model = select_model(selected_provider, provider_models)
if selected_model is None: # User typed 'q'
click.secho("Exiting...", fg="yellow")
sys.exit(0)
if selected_model: # Valid selection
break
click.secho(
"No model selected. Please try again or press 'q' to exit.", fg="red"
)

if selected_provider in PROVIDERS:
api_key_var = ENV_VARS[selected_provider][0]
else:
api_key_var = click.prompt(
f"Enter the environment variable name for your {selected_provider.capitalize()} API key",
type=str,
default="",
)

api_key_value = ""
click.echo(
f"Enter your {selected_provider.capitalize()} API key (press Enter to skip): ",
nl=False,
)
try:
api_key_value = input()
except (KeyboardInterrupt, EOFError):
api_key_value = ""

if api_key_value.strip():
env_vars = {api_key_var: api_key_value}
write_env_file(folder_path, env_vars)
click.secho("API key saved to .env file", fg="green")
else:
click.secho("No API key provided. Skipping .env file creation.", fg="yellow")

env_vars["MODEL"] = selected_model
click.secho(f"Selected model: {selected_model}", fg="green")
click.echo(
f"Enter your {selected_provider.capitalize()} API key (press Enter to skip): ",
nl=False,
)
try:
api_key_value = input()
except (KeyboardInterrupt, EOFError):
api_key_value = ""

if api_key_value.strip():
env_vars = {api_key_var: api_key_value}
write_env_file(folder_path, env_vars)
click.secho("API key saved to .env file", fg="green")
else:
click.secho("No API key provided. Skipping .env file creation.", fg="yellow")

env_vars["MODEL"] = selected_model
click.secho(f"Selected model: {selected_model}", fg="green")

package_dir = Path(__file__).parent
templates_dir = package_dir / "templates" / "crew"
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/cli/templates/crew/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "{{name}} using crewAI"
authors = [{ name = "Your Name", email = "[email protected]" }]
requires-python = ">=3.10,<=3.13"
dependencies = [
"crewai[tools]>=0.75.1,<1.0.0"
"crewai[tools]>=0.76.0,<1.0.0"
]

[project.scripts]
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/cli/templates/flow/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "{{name}} using crewAI"
authors = [{ name = "Your Name", email = "[email protected]" }]
requires-python = ">=3.10,<=3.13"
dependencies = [
"crewai[tools]>=0.75.1,<1.0.0",
"crewai[tools]>=0.76.0,<1.0.0",
]

[project.scripts]
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/cli/templates/pipeline/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.10,<=3.13"
crewai = { extras = ["tools"], version = ">=0.75.1,<1.0.0" }
crewai = { extras = ["tools"], version = ">=0.76.0,<1.0.0" }
asyncio = "*"

[tool.poetry.scripts]
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/cli/templates/pipeline_router/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "{{name}} using crewAI"
authors = ["Your Name <[email protected]>"]
requires-python = ">=3.10,<=3.13"
dependencies = [
"crewai[tools]>=0.75.1,<1.0.0"
"crewai[tools]>=0.76.0,<1.0.0"
]

[project.scripts]
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/cli/templates/tool/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ description = "Power up your crews with {{folder_name}}"
readme = "README.md"
requires-python = ">=3.10,<=3.13"
dependencies = [
"crewai[tools]>=0.75.1"
"crewai[tools]>=0.76.0"
]

Loading

0 comments on commit 74c1703

Please sign in to comment.