2d ago in CrewAI
What is this doing?
Hey guys,
can someone tell me what is going on in these lines of code?
"book_outline": [
chapter_outline.model_dump_json()
for chapter_outline in self.state.book_outline
]
Here is the original section from the BookFlow (crewai crash course)
async def write_chapters(self):
print("Writing Book Chapters")
tasks = []
async def write_single_chapter(chapter_outline):
output = (
WriteBookChapterCrew()
.crew()
.kickoff(
inputs={
"goal": self.state.goal,
"topic": self.state.topic,
"chapter_title": chapter_outline.title,
"chapter_description": chapter_outline.description,
"book_outline": [
chapter_outline.model_dump_json()
for chapter_outline in self.state.book_outline
],
}
)
)
title = output["title"]
content = output["content"]
chapter = Chapter(title=title, content=content)
return chapter
for chapter_outline in self.state.book_outline:
print(f"Writing Chapter: {chapter_outline.title}")
print(f"Description: {chapter_outline.description}")
# Schedule each chapter writing task
task = asyncio.create_task(write_single_chapter(chapter_outline))
tasks.append(task)
0
2 comments
Ax Va
1
What is this doing?
AI Developer Accelerator
skool.com/ai-developer-accelerator
Master AI & software development to build apps and unlock new income streams. Transform ideas into profits. 💡➕🤖➕👨‍💻🟰💰
Leaderboard (30-day)
powered by