mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-03 08:12:39 +00:00
Working on creating Crew templates and pipeline templates
This commit is contained in:
26
src/crewai/cli/templates/pipeline/pipeline.py
Normal file
26
src/crewai/cli/templates/pipeline/pipeline.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from crewai import Pipeline
|
||||
from crewai.project import PipelineBase
|
||||
from crews.crew import *
|
||||
|
||||
@PipelineBase
|
||||
class {{pipeline_name}}Pipeline:
|
||||
def __init__(self):
|
||||
# Initialize crews
|
||||
{% for crew_name in crew_names %}
|
||||
self.{{crew_name.lower()}}_crew = {{crew_name}}Crew().crew()
|
||||
{% endfor %}
|
||||
|
||||
@pipeline
|
||||
def create_pipeline(self):
|
||||
return Pipeline(
|
||||
stages=[
|
||||
{% for crew_name in crew_names %}
|
||||
self.{{crew_name.lower()}}_crew,
|
||||
{% endfor %}
|
||||
]
|
||||
)
|
||||
|
||||
async def run(self, inputs):
|
||||
pipeline = self.create_pipeline()
|
||||
results = await pipeline.kickoff(inputs)
|
||||
return results
|
||||
Reference in New Issue
Block a user