small refactor

This commit is contained in:
Luan Citta
2024-06-05 10:55:29 +01:00
parent 8b6dba4aaf
commit 973abde931
+11 -5
View File
@@ -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)