You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"When I use the @callback decorator to pass into Task or Crew, it results in an error."
Steps to Reproduce
@callback
def callback_function(self,output: str):
# Do something after the task is completed
# Example: Send an email to the manager
print(f"""
Task completed!
Task: {output.description}
Output: {output.raw}
""")
return Crew(
agents=self.agents, # Automatically created by the @agent decorator
#可以不用注解直接传 tasks=[self.research_task(),self.reporting_task()], # Automatically created by the @task decorator
tasks=self.tasks,
process=Process.sequential,
verbose=True,
cache=True,
task_callback=self.callback_function
# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
)
Description
"When I use the @callback decorator to pass into Task or Crew, it results in an error."
Steps to Reproduce
@callback
def callback_function(self,output: str):
# Do something after the task is completed
# Example: Send an email to the manager
print(f"""
Task completed!
Task: {output.description}
Output: {output.raw}
""")
@task
def research_task(self) -> Task:
return Task(
config=self.tasks_config['research_task'],
callback=self.callback_function
)
@crew
def crew(self) -> Crew:
"""Creates the Crewaiexample crew"""
# To learn how to add knowledge sources to your crew, check out the documentation:
# https://docs.crewai.com/concepts/knowledge#what-is-knowledge
Expected behavior
in document no page used the @callback
Screenshots/Code snippets
Operating System
Ubuntu 20.04
Python Version
3.10
crewAI Version
0.9
crewAI Tools Version
0.9
Virtual Environment
Venv
Evidence
no
Possible Solution
no
Additional context
no
The text was updated successfully, but these errors were encountered: