🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fix example
geekanfdc00e8d9f96
diff --git a/examples/write_novel.py b/examples/write_novel.pyindex b272a56e6..03daf1f0c 100644--- a/examples/write_novel.py+++ b/examples/write_novel.py@@ -33,14 +33,25 @@ class Chapter(BaseModel):content: str = Field(default="...", description="The content of the chapter. No more than 1000 words.")+class Chapters(BaseModel):+ chapters: List[Chapter] = Field(+ default=[+ {"name": "Chapter 1", "content": "..."},+ {"name": "Chapter 2", "content": "..."},+ {"name": "Chapter 3", "content": "..."},+ ],+ description="The chapters of the novel.",+ )++async def generate_novel():instruction = (- "Write a novel named 'Harry Potter in The Lord of the Rings'. "+ "Write a novel named 'Reborn in Skyrim'. ""Fill the empty nodes with your own ideas. Be creative! Use your own words!""I will tip you $100,000 if you write a good novel.")novel_node = await ActionNode.from_pydantic(Novel).fill(context=instruction, llm=LLM())- chap_node = await ActionNode.from_pydantic(Chapter).fill(+ chap_node = await ActionNode.from_pydantic(Chapters).fill(context=f"### instruction\n{instruction}\n### novel\n{novel_node.content}", llm=LLM())print(chap_node.content)