mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 15:18:29 +00:00
Compare commits
4 Commits
fix/consol
...
fix-issue-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d26ece7343 | ||
|
|
739d58a3ec | ||
|
|
7b1388b34c | ||
|
|
24a0f66141 |
@@ -257,10 +257,14 @@ reporting_task:
|
|||||||
from crewai import Agent, Crew, Process, Task
|
from crewai import Agent, Crew, Process, Task
|
||||||
from crewai.project import CrewBase, agent, crew, task
|
from crewai.project import CrewBase, agent, crew, task
|
||||||
from crewai_tools import SerperDevTool
|
from crewai_tools import SerperDevTool
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from typing import List
|
||||||
|
|
||||||
@CrewBase
|
@CrewBase
|
||||||
class LatestAiDevelopmentCrew():
|
class LatestAiDevelopmentCrew():
|
||||||
"""LatestAiDevelopment crew"""
|
"""LatestAiDevelopment crew"""
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def researcher(self) -> Agent:
|
def researcher(self) -> Agent:
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class LatestAiDevelopmentCrew():
|
|||||||
@agent
|
@agent
|
||||||
def researcher(self) -> Agent:
|
def researcher(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['researcher'],
|
config=self.agents_config['researcher'], # type: ignore[index]
|
||||||
verbose=True,
|
verbose=True,
|
||||||
tools=[SerperDevTool()]
|
tools=[SerperDevTool()]
|
||||||
)
|
)
|
||||||
@@ -126,7 +126,7 @@ class LatestAiDevelopmentCrew():
|
|||||||
@agent
|
@agent
|
||||||
def reporting_analyst(self) -> Agent:
|
def reporting_analyst(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['reporting_analyst'],
|
config=self.agents_config['reporting_analyst'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -52,12 +52,16 @@ After creating your CrewAI project as outlined in the [Installation](/installati
|
|||||||
```python code
|
```python code
|
||||||
from crewai import Agent, Crew, Task, Process
|
from crewai import Agent, Crew, Task, Process
|
||||||
from crewai.project import CrewBase, agent, task, crew, before_kickoff, after_kickoff
|
from crewai.project import CrewBase, agent, task, crew, before_kickoff, after_kickoff
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from typing import List
|
||||||
|
|
||||||
@CrewBase
|
@CrewBase
|
||||||
class YourCrewName:
|
class YourCrewName:
|
||||||
"""Description of your crew"""
|
"""Description of your crew"""
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
# Paths to your YAML configuration files
|
# Paths to your YAML configuration files
|
||||||
# To see an example agent and task defined in YAML, checkout the following:
|
# To see an example agent and task defined in YAML, checkout the following:
|
||||||
# - Task: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
|
# - Task: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
|
||||||
@@ -80,27 +84,27 @@ class YourCrewName:
|
|||||||
@agent
|
@agent
|
||||||
def agent_one(self) -> Agent:
|
def agent_one(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['agent_one'],
|
config=self.agents_config['agent_one'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def agent_two(self) -> Agent:
|
def agent_two(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['agent_two'],
|
config=self.agents_config['agent_two'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def task_one(self) -> Task:
|
def task_one(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['task_one']
|
config=self.tasks_config['task_one'] # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def task_two(self) -> Task:
|
def task_two(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['task_two']
|
config=self.tasks_config['task_two'] # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@crew
|
@crew
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ In this section, you'll find detailed examples that help you select, configure,
|
|||||||
@agent
|
@agent
|
||||||
def researcher(self) -> Agent:
|
def researcher(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['researcher'],
|
config=self.agents_config['researcher'], # type: ignore[index]
|
||||||
llm=local_nvidia_nim_llm
|
llm=local_nvidia_nim_llm
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class LatestAiDevelopmentCrew():
|
|||||||
@agent
|
@agent
|
||||||
def researcher(self) -> Agent:
|
def researcher(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['researcher'],
|
config=self.agents_config['researcher'], # type: ignore[index]
|
||||||
verbose=True,
|
verbose=True,
|
||||||
tools=[SerperDevTool()]
|
tools=[SerperDevTool()]
|
||||||
)
|
)
|
||||||
@@ -121,20 +121,20 @@ class LatestAiDevelopmentCrew():
|
|||||||
@agent
|
@agent
|
||||||
def reporting_analyst(self) -> Agent:
|
def reporting_analyst(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['reporting_analyst'],
|
config=self.agents_config['reporting_analyst'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def research_task(self) -> Task:
|
def research_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['research_task']
|
config=self.tasks_config['research_task'] # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def reporting_task(self) -> Task:
|
def reporting_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['reporting_task']
|
config=self.tasks_config['reporting_task'] # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@crew
|
@crew
|
||||||
|
|||||||
@@ -185,15 +185,20 @@ Let's modify the `crew.py` file:
|
|||||||
from crewai import Agent, Crew, Process, Task
|
from crewai import Agent, Crew, Process, Task
|
||||||
from crewai.project import CrewBase, agent, crew, task
|
from crewai.project import CrewBase, agent, crew, task
|
||||||
from crewai_tools import SerperDevTool
|
from crewai_tools import SerperDevTool
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from typing import List
|
||||||
|
|
||||||
@CrewBase
|
@CrewBase
|
||||||
class ResearchCrew():
|
class ResearchCrew():
|
||||||
"""Research crew for comprehensive topic analysis and reporting"""
|
"""Research crew for comprehensive topic analysis and reporting"""
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def researcher(self) -> Agent:
|
def researcher(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['researcher'],
|
config=self.agents_config['researcher'], # type: ignore[index]
|
||||||
verbose=True,
|
verbose=True,
|
||||||
tools=[SerperDevTool()]
|
tools=[SerperDevTool()]
|
||||||
)
|
)
|
||||||
@@ -201,20 +206,20 @@ class ResearchCrew():
|
|||||||
@agent
|
@agent
|
||||||
def analyst(self) -> Agent:
|
def analyst(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['analyst'],
|
config=self.agents_config['analyst'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def research_task(self) -> Task:
|
def research_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['research_task']
|
config=self.tasks_config['research_task'] # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def analysis_task(self) -> Task:
|
def analysis_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['analysis_task'],
|
config=self.tasks_config['analysis_task'], # type: ignore[index]
|
||||||
output_file='output/report.md'
|
output_file='output/report.md'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -387,4 +392,4 @@ Now that you've built your first crew, you can:
|
|||||||
|
|
||||||
<Check>
|
<Check>
|
||||||
Congratulations! You've successfully built your first CrewAI crew that can research and analyze any topic you provide. This foundational experience has equipped you with the skills to create increasingly sophisticated AI systems that can tackle complex, multi-stage problems through collaborative intelligence.
|
Congratulations! You've successfully built your first CrewAI crew that can research and analyze any topic you provide. This foundational experience has equipped you with the skills to create increasingly sophisticated AI systems that can tackle complex, multi-stage problems through collaborative intelligence.
|
||||||
</Check>
|
</Check>
|
||||||
|
|||||||
@@ -203,35 +203,40 @@ These task definitions provide detailed instructions to our agents, ensuring the
|
|||||||
# src/guide_creator_flow/crews/content_crew/content_crew.py
|
# src/guide_creator_flow/crews/content_crew/content_crew.py
|
||||||
from crewai import Agent, Crew, Process, Task
|
from crewai import Agent, Crew, Process, Task
|
||||||
from crewai.project import CrewBase, agent, crew, task
|
from crewai.project import CrewBase, agent, crew, task
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from typing import List
|
||||||
|
|
||||||
@CrewBase
|
@CrewBase
|
||||||
class ContentCrew():
|
class ContentCrew():
|
||||||
"""Content writing crew"""
|
"""Content writing crew"""
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def content_writer(self) -> Agent:
|
def content_writer(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['content_writer'],
|
config=self.agents_config['content_writer'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def content_reviewer(self) -> Agent:
|
def content_reviewer(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['content_reviewer'],
|
config=self.agents_config['content_reviewer'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def write_section_task(self) -> Task:
|
def write_section_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['write_section_task']
|
config=self.tasks_config['write_section_task'] # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def review_section_task(self) -> Task:
|
def review_section_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['review_section_task'],
|
config=self.tasks_config['review_section_task'], # type: ignore[index]
|
||||||
context=[self.write_section_task()]
|
context=[self.write_section_task()]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -87,15 +87,20 @@ Follow the steps below to get Crewing! 🚣♂️
|
|||||||
from crewai import Agent, Crew, Process, Task
|
from crewai import Agent, Crew, Process, Task
|
||||||
from crewai.project import CrewBase, agent, crew, task
|
from crewai.project import CrewBase, agent, crew, task
|
||||||
from crewai_tools import SerperDevTool
|
from crewai_tools import SerperDevTool
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from typing import List
|
||||||
|
|
||||||
@CrewBase
|
@CrewBase
|
||||||
class LatestAiDevelopmentCrew():
|
class LatestAiDevelopmentCrew():
|
||||||
"""LatestAiDevelopment crew"""
|
"""LatestAiDevelopment crew"""
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def researcher(self) -> Agent:
|
def researcher(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['researcher'],
|
config=self.agents_config['researcher'], # type: ignore[index]
|
||||||
verbose=True,
|
verbose=True,
|
||||||
tools=[SerperDevTool()]
|
tools=[SerperDevTool()]
|
||||||
)
|
)
|
||||||
@@ -103,20 +108,20 @@ Follow the steps below to get Crewing! 🚣♂️
|
|||||||
@agent
|
@agent
|
||||||
def reporting_analyst(self) -> Agent:
|
def reporting_analyst(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['reporting_analyst'],
|
config=self.agents_config['reporting_analyst'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def research_task(self) -> Task:
|
def research_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['research_task'],
|
config=self.tasks_config['research_task'], # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def reporting_task(self) -> Task:
|
def reporting_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['reporting_task'],
|
config=self.tasks_config['reporting_task'], # type: ignore[index]
|
||||||
output_file='output/report.md' # This is the file that will be contain the final report.
|
output_file='output/report.md' # This is the file that will be contain the final report.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from crewai import Agent, Crew, Process, Task
|
from crewai import Agent, Crew, Process, Task
|
||||||
from crewai.project import CrewBase, agent, crew, task
|
from crewai.project import CrewBase, agent, crew, task
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from typing import List
|
||||||
# If you want to run a snippet of code before or after the crew starts,
|
# If you want to run a snippet of code before or after the crew starts,
|
||||||
# you can use the @before_kickoff and @after_kickoff decorators
|
# you can use the @before_kickoff and @after_kickoff decorators
|
||||||
# https://docs.crewai.com/concepts/crews#example-crew-class-with-decorators
|
# https://docs.crewai.com/concepts/crews#example-crew-class-with-decorators
|
||||||
@@ -9,25 +10,26 @@ from crewai.project import CrewBase, agent, crew, task
|
|||||||
class {{crew_name}}():
|
class {{crew_name}}():
|
||||||
"""{{crew_name}} crew"""
|
"""{{crew_name}} crew"""
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
# Learn more about YAML configuration files here:
|
# Learn more about YAML configuration files here:
|
||||||
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
|
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
|
||||||
# Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
|
# Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
|
||||||
agents_config = 'config/agents.yaml'
|
|
||||||
tasks_config = 'config/tasks.yaml'
|
|
||||||
|
|
||||||
# If you would like to add tools to your agents, you can learn more about it here:
|
# If you would like to add tools to your agents, you can learn more about it here:
|
||||||
# https://docs.crewai.com/concepts/agents#agent-tools
|
# https://docs.crewai.com/concepts/agents#agent-tools
|
||||||
@agent
|
@agent
|
||||||
def researcher(self) -> Agent:
|
def researcher(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['researcher'],
|
config=self.agents_config['researcher'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def reporting_analyst(self) -> Agent:
|
def reporting_analyst(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config['reporting_analyst'],
|
config=self.agents_config['reporting_analyst'], # type: ignore[index]
|
||||||
verbose=True
|
verbose=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,13 +39,13 @@ class {{crew_name}}():
|
|||||||
@task
|
@task
|
||||||
def research_task(self) -> Task:
|
def research_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['research_task'],
|
config=self.tasks_config['research_task'], # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def reporting_task(self) -> Task:
|
def reporting_task(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config['reporting_task'],
|
config=self.tasks_config['reporting_task'], # type: ignore[index]
|
||||||
output_file='report.md'
|
output_file='report.md'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
from crewai import Agent, Crew, Process, Task
|
from crewai import Agent, Crew, Process, Task
|
||||||
from crewai.project import CrewBase, agent, crew, task
|
from crewai.project import CrewBase, agent, crew, task
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from typing import List
|
||||||
|
|
||||||
# If you want to run a snippet of code before or after the crew starts,
|
# If you want to run a snippet of code before or after the crew starts,
|
||||||
# you can use the @before_kickoff and @after_kickoff decorators
|
# you can use the @before_kickoff and @after_kickoff decorators
|
||||||
@@ -10,6 +12,9 @@ from crewai.project import CrewBase, agent, crew, task
|
|||||||
class PoemCrew:
|
class PoemCrew:
|
||||||
"""Poem Crew"""
|
"""Poem Crew"""
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
# Learn more about YAML configuration files here:
|
# Learn more about YAML configuration files here:
|
||||||
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
|
# Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
|
||||||
# Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
|
# Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
|
||||||
@@ -21,7 +26,7 @@ class PoemCrew:
|
|||||||
@agent
|
@agent
|
||||||
def poem_writer(self) -> Agent:
|
def poem_writer(self) -> Agent:
|
||||||
return Agent(
|
return Agent(
|
||||||
config=self.agents_config["poem_writer"],
|
config=self.agents_config["poem_writer"], # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
# To learn more about structured task outputs,
|
# To learn more about structured task outputs,
|
||||||
@@ -30,7 +35,7 @@ class PoemCrew:
|
|||||||
@task
|
@task
|
||||||
def write_poem(self) -> Task:
|
def write_poem(self) -> Task:
|
||||||
return Task(
|
return Task(
|
||||||
config=self.tasks_config["write_poem"],
|
config=self.tasks_config["write_poem"], # type: ignore[index]
|
||||||
)
|
)
|
||||||
|
|
||||||
@crew
|
@crew
|
||||||
|
|||||||
@@ -4069,11 +4069,17 @@ def test_crew_guardrail_feedback_in_context():
|
|||||||
|
|
||||||
@pytest.mark.vcr(filter_headers=["authorization"])
|
@pytest.mark.vcr(filter_headers=["authorization"])
|
||||||
def test_before_kickoff_callback():
|
def test_before_kickoff_callback():
|
||||||
from crewai.project import CrewBase, agent, before_kickoff, task
|
from crewai.project import CrewBase
|
||||||
|
|
||||||
@CrewBase
|
@CrewBase
|
||||||
class TestCrewClass:
|
class TestCrewClass:
|
||||||
from crewai.project import crew
|
from typing import List
|
||||||
|
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
|
from crewai.project import CrewBase, agent, before_kickoff, crew, task
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
agents_config = None
|
agents_config = None
|
||||||
tasks_config = None
|
tasks_config = None
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
from typing import List
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from crewai.agent import Agent
|
from crewai.agent import Agent
|
||||||
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
from crewai.crew import Crew
|
from crewai.crew import Crew
|
||||||
from crewai.llm import LLM
|
from crewai.llm import LLM
|
||||||
from crewai.project import (
|
from crewai.project import (
|
||||||
@@ -40,28 +43,32 @@ class InternalCrew:
|
|||||||
agents_config = "config/agents.yaml"
|
agents_config = "config/agents.yaml"
|
||||||
tasks_config = "config/tasks.yaml"
|
tasks_config = "config/tasks.yaml"
|
||||||
|
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
@llm
|
@llm
|
||||||
def local_llm(self):
|
def local_llm(self):
|
||||||
return LLM(
|
return LLM(
|
||||||
model='openai/model_name',
|
model="openai/model_name",
|
||||||
api_key="None",
|
api_key="None",
|
||||||
base_url="http://xxx.xxx.xxx.xxx:8000/v1")
|
base_url="http://xxx.xxx.xxx.xxx:8000/v1",
|
||||||
|
)
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def researcher(self):
|
def researcher(self):
|
||||||
return Agent(config=self.agents_config["researcher"])
|
return Agent(config=self.agents_config["researcher"]) # type: ignore[index]
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def reporting_analyst(self):
|
def reporting_analyst(self):
|
||||||
return Agent(config=self.agents_config["reporting_analyst"])
|
return Agent(config=self.agents_config["reporting_analyst"]) # type: ignore[index]
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def research_task(self):
|
def research_task(self):
|
||||||
return Task(config=self.tasks_config["research_task"])
|
return Task(config=self.tasks_config["research_task"]) # type: ignore[index]
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def reporting_task(self):
|
def reporting_task(self):
|
||||||
return Task(config=self.tasks_config["reporting_task"])
|
return Task(config=self.tasks_config["reporting_task"]) # type: ignore[index]
|
||||||
|
|
||||||
@before_kickoff
|
@before_kickoff
|
||||||
def modify_inputs(self, inputs):
|
def modify_inputs(self, inputs):
|
||||||
@@ -165,24 +172,27 @@ def test_before_kickoff_with_none_input():
|
|||||||
def test_multiple_before_after_kickoff():
|
def test_multiple_before_after_kickoff():
|
||||||
@CrewBase
|
@CrewBase
|
||||||
class MultipleHooksCrew:
|
class MultipleHooksCrew:
|
||||||
|
agents: List[BaseAgent]
|
||||||
|
tasks: List[Task]
|
||||||
|
|
||||||
agents_config = "config/agents.yaml"
|
agents_config = "config/agents.yaml"
|
||||||
tasks_config = "config/tasks.yaml"
|
tasks_config = "config/tasks.yaml"
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def researcher(self):
|
def researcher(self):
|
||||||
return Agent(config=self.agents_config["researcher"])
|
return Agent(config=self.agents_config["researcher"]) # type: ignore[index]
|
||||||
|
|
||||||
@agent
|
@agent
|
||||||
def reporting_analyst(self):
|
def reporting_analyst(self):
|
||||||
return Agent(config=self.agents_config["reporting_analyst"])
|
return Agent(config=self.agents_config["reporting_analyst"]) # type: ignore[index]
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def research_task(self):
|
def research_task(self):
|
||||||
return Task(config=self.tasks_config["research_task"])
|
return Task(config=self.tasks_config["research_task"]) # type: ignore[index]
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def reporting_task(self):
|
def reporting_task(self):
|
||||||
return Task(config=self.tasks_config["reporting_task"])
|
return Task(config=self.tasks_config["reporting_task"]) # type: ignore[index]
|
||||||
|
|
||||||
@before_kickoff
|
@before_kickoff
|
||||||
def first_before(self, inputs):
|
def first_before(self, inputs):
|
||||||
|
|||||||
Reference in New Issue
Block a user