INNER CODE UNIT · Python

handle_book_sections

victordibia/designing-multiagent-systems · course/samples/book_generator/autogen_core/app.py:94

    async def handle_book_sections(self, message: BookSections, ctx: MessageContext) -> None:
        try:
            print(">>> ImageGeneratorAgent: Generating images for book sections")
            sections_with_images = []
            for section in message.sections:
                image_path = await self.generate_image(section.image) if section.image else None
                sections_with_images.append(Section(
                    title=section.title,
                    level=section.level,
                    content=section.content,
                    image=image_path
                ))
            
            await self.publish_message(
                BookSections(sections=sections_with_images),
                topic_id=TopicId("BookGeneratorAgent", source=self.id.key)
            )
        except Exception as e:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…