mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
updating specs
This commit is contained in:
@@ -46,6 +46,7 @@ def test_custom_llm():
|
||||
assert agent.llm.model_name == "gpt-4"
|
||||
assert agent.llm.temperature == 0
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_agent_without_memory():
|
||||
no_memory_agent = Agent(
|
||||
role="test role",
|
||||
@@ -71,7 +72,7 @@ def test_agent_without_memory():
|
||||
|
||||
result = no_memory_agent.execute_task("How much is 1 + 1?")
|
||||
|
||||
assert result == "2"
|
||||
assert result == "1 + 1 equals 2."
|
||||
assert no_memory_agent.agent_executor.memory is None
|
||||
assert memory_agent.agent_executor.memory is not None
|
||||
|
||||
@@ -85,7 +86,7 @@ def test_agent_execution():
|
||||
)
|
||||
|
||||
output = agent.execute_task("How much is 1 + 1?")
|
||||
assert output == "1 + 1 equals 2."
|
||||
assert output == "2"
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_agent_execution_with_tools():
|
||||
@@ -93,9 +94,9 @@ def test_agent_execution_with_tools():
|
||||
|
||||
@tool
|
||||
def multiplier(numbers) -> float:
|
||||
"""Useful for when you need to multiply two numbers together.
|
||||
The input to this tool should be a comma separated list of numbers of
|
||||
length two, representing the two numbers you want to multiply together.
|
||||
"""Useful for when you need to multiply two numbers together.
|
||||
The input to this tool should be a comma separated list of numbers of
|
||||
length two, representing the two numbers you want to multiply together.
|
||||
For example, `1,2` would be the input if you wanted to multiply 1 by 2."""
|
||||
a, b = numbers.split(',')
|
||||
return int(a) * int(b)
|
||||
@@ -109,7 +110,7 @@ def test_agent_execution_with_tools():
|
||||
)
|
||||
|
||||
output = agent.execute_task("What is 3 times 4")
|
||||
assert output == "3 times 4 equals to 12."
|
||||
assert output == "12"
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_agent_execution_with_specific_tools():
|
||||
@@ -117,9 +118,9 @@ def test_agent_execution_with_specific_tools():
|
||||
|
||||
@tool
|
||||
def multiplier(numbers) -> float:
|
||||
"""Useful for when you need to multiply two numbers together.
|
||||
The input to this tool should be a comma separated list of numbers of
|
||||
length two, representing the two numbers you want to multiply together.
|
||||
"""Useful for when you need to multiply two numbers together.
|
||||
The input to this tool should be a comma separated list of numbers of
|
||||
length two, representing the two numbers you want to multiply together.
|
||||
For example, `1,2` would be the input if you wanted to multiply 1 by 2."""
|
||||
a, b = numbers.split(',')
|
||||
return int(a) * int(b)
|
||||
|
||||
@@ -19,7 +19,7 @@ def test_delegate_work():
|
||||
command="researcher|share your take on AI Agents|I heard you hate them"
|
||||
)
|
||||
|
||||
assert result == "It seems there is a misunderstanding. As a researcher, my stance on AI agents is not based on personal emotions like love or hate. I study and analyze them objectively based on their capabilities, how they function, their limitations, and their potential for future development. AI agents are powerful tools that, when developed and used properly, can greatly benefit society in numerous ways such as improving efficiency, optimizing processes, and opening up new possibilities for innovation. However, like any other technology, it's also important to consider ethical implications and possible risks."
|
||||
assert result == "I apologize if my previous statements have given you the impression that I hate AI agents. As a technology researcher, I don't hold personal sentiments towards AI or any other technology. Rather, I analyze them objectively based on their capabilities, applications, and implications. AI agents, in particular, are a fascinating domain of research. They hold tremendous potential in automating and optimizing various tasks across industries. However, like any other technology, they come with their own set of challenges, such as ethical considerations around privacy and decision-making. My objective is to understand these technologies in depth and provide a balanced view."
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_ask_question():
|
||||
@@ -27,7 +27,7 @@ def test_ask_question():
|
||||
command="researcher|do you hate AI Agents?|I heard you LOVE them"
|
||||
)
|
||||
|
||||
assert result == "As an AI, I don't have personal emotions, so I don't hate or love anything. However, I can analyze and provide insights about AI agents based on the data and information available. AI agents are a fascinating area of study in the field of technology, offering potential for significant advancements in various sectors. It's important to note that while they can be highly beneficial, they should be developed and used responsibly, considering ethical implications and potential risks."
|
||||
assert result == "As an AI, I don't possess feelings or emotions, so I don't love or hate anything. However, I can provide detailed analysis and research on AI agents. They are a fascinating field of study with the potential to revolutionize many industries, although they also present certain challenges and ethical considerations."
|
||||
|
||||
def test_delegate_work_with_wrong_input():
|
||||
result = tools.ask_question(
|
||||
|
||||
@@ -28,7 +28,7 @@ writer = Agent(
|
||||
def test_crew_config_conditional_requirement():
|
||||
with pytest.raises(ValueError):
|
||||
Crew(process=Process.sequential)
|
||||
|
||||
|
||||
config = json.dumps({
|
||||
"agents": [
|
||||
{
|
||||
@@ -51,15 +51,15 @@ def test_crew_config_conditional_requirement():
|
||||
"description": "Write a 1 amazing paragraph highlight for each idead that showcases how good an article about this topic could be, check references if necessary or search for more content but make sure it's unique, interesting and well written. Return the list of ideas with their paragraph and your notes.",
|
||||
"agent": "Senior Writer"
|
||||
}
|
||||
]
|
||||
]
|
||||
})
|
||||
parsed_config = json.loads(config)
|
||||
|
||||
try:
|
||||
crew = Crew(process=Process.sequential, config=config)
|
||||
crew = Crew(process=Process.sequential, config=config)
|
||||
except ValueError:
|
||||
pytest.fail("Unexpected ValidationError raised")
|
||||
|
||||
|
||||
assert [agent.role for agent in crew.agents] == [agent['role'] for agent in parsed_config['agents']]
|
||||
assert [task.description for task in crew.tasks] == [task['description'] for task in parsed_config['tasks']]
|
||||
|
||||
@@ -80,7 +80,7 @@ def test_crew_config_with_wrong_keys():
|
||||
"description": "Give me a list of 5 interesting ideas to explore for na article, what makes them unique and interesting.",
|
||||
"agent": "Senior Researcher"
|
||||
}
|
||||
]
|
||||
]
|
||||
})
|
||||
with pytest.raises(ValueError):
|
||||
Crew(process=Process.sequential, config='{"wrong_key": "wrong_value"}')
|
||||
@@ -108,20 +108,15 @@ def test_crew_creation():
|
||||
tasks=tasks,
|
||||
)
|
||||
|
||||
assert crew.kickoff() == """1. AI and Ethical Dilemmas:
|
||||
Facing the future, we grapple with moral quandaries brought forth by AI. This article will delve into the ethical dilemmas posed by AI, such as data privacy, algorithmic bias, and the responsibility of AI’s decisions. It will provide a compelling narrative about the necessity of considering ethical aspects in AI development and how they might shape the future of humanity.
|
||||
assert crew.kickoff() == """1. **The Evolution of AI: From Old Concepts to New Frontiers** - Journey with us as we traverse the fascinating timeline of artificial intelligence - from its philosophical and mathematical infancy to the sophisticated, problem-solving tool it has become today. This riveting account will not only educate but also inspire, as we delve deep into the milestones that brought us here and shine a beacon on the potential that lies ahead.
|
||||
|
||||
2. AI in Healthcare:
|
||||
Imagine a world where diagnosis and treatment are not limited by human errors or geographical boundaries. This article will explore the transformative role of AI in healthcare, from robotic surgeries to personalized medicine. It will offer fascinating insights into how AI can revolutionize healthcare, save countless lives, and bring about a new era of medical science.
|
||||
2. **AI Agents in Healthcare: The Future of Medicine** - Imagine a world where illnesses are diagnosed before symptoms appear, where patient outcomes are not mere guesses but accurate predictions. This is the world AI is crafting in healthcare - a revolution that's saving lives and changing the face of medicine as we know it. This article will spotlight this transformative journey, underlining the profound impact AI is having on our health and well-being.
|
||||
|
||||
3. The Role of AI in Climate Change:
|
||||
As our planet faces an unprecedented climate crisis, we turn to AI for solutions. This article will illuminate the role of AI in combating climate change by optimizing renewable energy, predicting weather patterns, and managing resources. It will underscore the pivotal role that AI plays in our fight against climate change, painting a hopeful picture of the future.
|
||||
3. **AI and Ethics: Navigating the Moral Landscape of Artificial Intelligence** - As AI becomes an integral part of our lives, it brings along a plethora of ethical dilemmas. This thought-provoking piece will navigate the complex moral landscape of AI, addressing critical concerns like privacy, job displacement, and decision-making biases. It serves as a much-needed discussion platform for the societal implications of AI, urging us to look beyond the technology and into the mirror.
|
||||
|
||||
4. AI in Art and Creativity:
|
||||
Art and AI may seem like odd companions, but they are pushing the boundaries of creativity. This article will highlight the influence of AI in art and creativity, from creating original art pieces to enhancing human creativity. It will delve into the intriguing intersection of technology and art, showcasing the unexpected harmony between AI and human creativity.
|
||||
4. **Demystifying AI Algorithms: A Deep Dive into Machine Learning** - Ever wondered what goes on behind the scenes of AI? This enlightening article will break down the complex world of machine learning algorithms into digestible insights, unraveling the mystery of AI's 'black box'. It's a rare opportunity for the non-technical audience to appreciate the inner workings of AI, fostering a deeper understanding of this revolutionary technology.
|
||||
|
||||
5. The Future of Jobs with AI:
|
||||
With the advent of AI, the job market is poised for a seismic shift. This article will delve into the implications of AI on the future of jobs, discussing the jobs AI will create and those it may render obsolete. It will provide a thought-provoking examination of how AI could redefine our workplaces and our understanding of work itself."""
|
||||
5. **AI Startups: The Game Changers of the Tech Industry** - In the world of tech, AI startups are the bold pioneers charting new territories. This article will spotlight these game changers, showcasing how their innovative products and services are driving the AI revolution. It's a unique opportunity to catch a glimpse of the entrepreneurial side of AI, offering inspiration for the tech enthusiasts and dreamers alike."""
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_crew_with_delegating_agents():
|
||||
@@ -138,7 +133,7 @@ def test_crew_with_delegating_agents():
|
||||
tasks=tasks,
|
||||
)
|
||||
|
||||
assert crew.kickoff() == 'AI agents represent a significant stride in the evolution of artificial intelligence. These entities are designed to act autonomously, learn from their environment, and make decisions based on a set of predefined rules or through machine learning techniques. The potential of AI agents is tremendous and their versatility is unparalleled. They can be deployed in various sectors, from healthcare to finance, performing tasks with efficiency and accuracy that surpass human capabilities. In healthcare, AI agents can predict patient deterioration, offer personalized treatment suggestions, and manage patient flow. In finance, they can detect fraudulent transactions, manage investments, and provide personalized financial advice. Furthermore, the adaptability of AI agents allows them to learn and improve over time, becoming more proficient and effective in their tasks. This dynamic nature of AI agents is what sets them apart and posits them as a revolutionary force in the AI landscape. As we continue to explore and harness the capabilities of AI agents, we can expect them to play an increasingly integral role in shaping our world and the way we live.'
|
||||
assert crew.kickoff() == 'The Senior Writer has created a compelling and engaging 1 paragraph draft about AI agents. The paragraph provides a brief yet comprehensive overview of AI agents, their uses, and implications in the current world. It emphasizes their potential and the role they can play in the future. The tone is informative but captivating, meeting the objectives of the task.'
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_crew_verbose_output(capsys):
|
||||
|
||||
Reference in New Issue
Block a user