Skip to content

Commit

Permalink
preparing new version
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura committed May 13, 2024
1 parent 87d28e8 commit 615ac7f
Show file tree
Hide file tree
Showing 6 changed files with 1,626 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "crewai"
version = "0.30.4"
version = "0.30.5"
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"
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/cli/templates/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = ">=3.10,<=3.13"
crewai = {extras = ["tools"], version = "^0.28.8"}
crewai = {extras = ["tools"], version = "^0.30.5"}

[tool.poetry.scripts]
{{folder_name}} = "{{folder_name}}.main:run"
Expand Down
10 changes: 8 additions & 2 deletions src/crewai/tools/agent_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ def tools(self):

def delegate_work(self, task: str, context: str, coworker: Union[str, None] = None, **kwargs):
"""Useful to delegate a specific task to a co-worker passing all necessary context and names."""
coworker = coworker or kwargs.get("co_worker")
coworker = coworker or kwargs.get("co_worker") or kwargs.get("co-worker")
is_list = coworker.startswith("[") and coworker.endswith("]")
if is_list:
coworker = coworker[1:-1].split(",")[0]
return self._execute(coworker, task, context)

def ask_question(self, question: str, context: str, coworker: Union[str, None] = None, **kwargs):
"""Useful to ask a question, opinion or take from a co-worker passing all necessary context and names."""
coworker = coworker or kwargs.get("co_worker")
coworker = coworker or kwargs.get("co_worker") or kwargs.get("co-worker")
is_list = coworker.startswith("[") and coworker.endswith("]")
if is_list:
coworker = coworker[1:-1].split(",")[0]
return self._execute(coworker, question, context)

def _execute(self, agent, task, context):
Expand Down
27 changes: 27 additions & 0 deletions tests/agent_tools/agent_tools_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,33 @@ def test_ask_question_with_wrong_co_worker_variable():
== "No, I don't hate AI agents. In fact, I find them quite fascinating. They are powerful tools that can greatly assist in various tasks, including my research. As a technology researcher, AI and AI agents are subjects of interest to me due to their potential in advancing our understanding and capabilities in various fields. My supposed love for them stems from this professional interest and the potential they hold."
)

@pytest.mark.vcr(filter_headers=["authorization"])
def test_delegate_work_withwith_coworker_as_array():
result = tools.delegate_work(
co_worker="[researcher]",
task="share your take on AI Agents",
context="I heard you hate them",
)

assert (
result
== "AI Agents are software entities which operate in an environment to achieve a particular goal. They can perceive their environment, reason about it, and take actions to fulfill their objectives. This includes everything from chatbots to self-driving cars. They are designed to act autonomously to a certain extent and are capable of learning from their experiences to improve their performance over time.\n\nDespite some people's fears or dislikes, AI Agents are not inherently good or bad. They are tools, and like any tool, their value depends on how they are used. For instance, AI Agents can be used to automate repetitive tasks, provide customer support, or analyze vast amounts of data far more quickly and accurately than a human could. They can also be used in ways that invade privacy or replace jobs, which is often where the apprehension comes from.\n\nThe key is to create regulations and ethical guidelines for the use of AI Agents, and to continue researching and developing them in a way that maximizes their benefits and minimizes their potential harm. From a research perspective, there's a lot of potential in AI Agents, and it's a fascinating field to be a part of."
)


@pytest.mark.vcr(filter_headers=["authorization"])
def test_ask_question_with_coworker_as_array():
result = tools.ask_question(
co_worker="[researcher]",
question="do you hate AI Agents?",
context="I heard you LOVE them",
)

assert (
result
== "I don't hate or love AI agents. My passion lies in understanding them, researching about their capabilities, implications, and potential for development. As a researcher, my feelings toward AI are more of fascination and interest rather than personal love or hate."
)


def test_delegate_work_to_wrong_agent():
result = tools.ask_question(
Expand Down

0 comments on commit 615ac7f

Please sign in to comment.