Spaces:
Sleeping
Sleeping
File size: 1,642 Bytes
8647366 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from jio_savan_music_downloader.models.response_models import MusicDetails
from jio_savan_music_downloader.tools.custom_tool import search_tool
@CrewBase
class JioSavanMusicDownloaderAgent:
"""JioSavanMusicDownloaderAgent crew"""
agents_config = "config/agents.yaml"
tasks_config = "config/tasks.yaml"
@agent
def music_researcher(self) -> Agent:
"""
Creates a music researcher agent.
This agent is responsible for searching for the specified music on JioSaavn
and returning the results in a structured format.
:return: An instance of the Agent class
"""
return Agent(config=self.agents_config["music_researcher"], verbose=True)
@task
def music_research_task(self) -> Task:
"""
Creates the music research task.
This task is responsible for searching for the specified music on JioSaavn
and returning the results in a structured format.
:return: An instance of the Task class
"""
return Task(
config=self.tasks_config["music_research_task"],
tools=[search_tool],
output_json=MusicDetails,
)
@crew
def crew(self) -> Crew:
"""Creates the JioSavanMusicDownloaderAgent crew"""
return Crew(
agents=self.agents, # Automatically created by the @agent decorator
tasks=self.tasks, # Automatically created by the @task decorator
process=Process.sequential,
verbose=False,
)
|