mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
Brandon/cre 211 fix agent and task config for yaml based projects (#1211)
* Fixed agents. Now need to fix tasks. * Add type fixes and fix task decorator * Clean up logs * fix more type errors * Revert back to required * Undo changes. * Remove default none for properties that cannot be none * Clean up comments * Implement all of Guis feedback
This commit is contained in:
committed by
GitHub
parent
17bffb0803
commit
8119edb495
@@ -1,3 +1,5 @@
|
||||
from functools import wraps
|
||||
|
||||
from crewai.project.utils import memoize
|
||||
|
||||
|
||||
@@ -5,21 +7,17 @@ def task(func):
|
||||
if not hasattr(task, "registration_order"):
|
||||
task.registration_order = []
|
||||
|
||||
func.is_task = True
|
||||
memoized_func = memoize(func)
|
||||
|
||||
# Append the function name to the registration order list
|
||||
task.registration_order.append(func.__name__)
|
||||
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
result = memoized_func(*args, **kwargs)
|
||||
|
||||
result = func(*args, **kwargs)
|
||||
if not result.name:
|
||||
result.name = func.__name__
|
||||
|
||||
return result
|
||||
|
||||
return wrapper
|
||||
setattr(wrapper, "is_task", True)
|
||||
task.registration_order.append(func.__name__)
|
||||
|
||||
return memoize(wrapper)
|
||||
|
||||
|
||||
def agent(func):
|
||||
|
||||
Reference in New Issue
Block a user