Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version check to crew_chat.py #1966

Merged
merged 6 commits into from
Jan 24, 2025
17 changes: 17 additions & 0 deletions src/crewai/cli/crew_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

import click
import tomli
from packaging import version

from crewai.cli.utils import read_toml
from crewai.cli.version import get_crewai_version
from crewai.crew import Crew
from crewai.llm import LLM
from crewai.types.crew_chat import ChatInputField, ChatInputs
Expand All @@ -19,6 +22,20 @@ def run_chat():
Incorporates crew_name, crew_description, and input fields to build a tool schema.
Exits if crew_name or crew_description are missing.
"""
crewai_version = get_crewai_version()
min_required_version = "0.98.0"

pyproject_data = read_toml()

if pyproject_data.get("tool", {}).get("poetry") and (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This not the correct error message to say.

Our message should be along the lines of you are using an older version of crew that doesn't support conversational crews.

Run uv upgrade crewai

version.parse(crewai_version) < version.parse(min_required_version)
):
click.secho(
f"You are running an older version of crewAI ({crewai_version}) that uses poetry pyproject.toml. "
f"Please run `crewai update` to update your pyproject.toml to use uv.",
fg="red",
)
return
crew, crew_name = load_crew_and_name()
chat_llm = initialize_chat_llm(crew)
if not chat_llm:
Expand Down
Loading