small refactor
This commit is contained in:
+11
-5
@@ -18,11 +18,14 @@ class CrewNode(BaseNode):
|
||||
},
|
||||
}
|
||||
INPUT_IS_LIST = (True, True, False, False)
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_TYPES = ("STRING", "STRING")
|
||||
FUNCTION = "create_crew"
|
||||
|
||||
def create_crew(self, tasks, process, topic="", agents=[],):
|
||||
process_type = Process.sequential if process[0] == "sequential" else Process.hierarchical
|
||||
def create_crew(self, tasks, process, topic="", agents=[]):
|
||||
# Determine the process type
|
||||
process_type = Process.sequential if process[0] == "sequential" else Process.hierarchical
|
||||
|
||||
# Create the Crew instance
|
||||
crew = Crew(
|
||||
agents=agents,
|
||||
tasks=tasks,
|
||||
@@ -30,7 +33,10 @@ class CrewNode(BaseNode):
|
||||
topic=topic,
|
||||
)
|
||||
|
||||
# Kick off the process and capture the result
|
||||
result = crew.kickoff(inputs={'topic': topic})
|
||||
print("\n\n📎Crew AI - result", result)
|
||||
return (result,)
|
||||
print("\n\n📎Crew AI - result", result)
|
||||
return (result, crew.usage_metrics)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user