In the third and final part of this guide, we will learn how to execute the agents, generate our story with illustrations, and verify the output.
Make sure you have followed the steps outlined in both the first part, "Initial Setup for Generating Illustrated Stories with Hyv, OpenAI GPT and DALL-E," and the second part, "Generating and Illustrating a Story with Hyv, OpenAI GPT and DALL-E."
Having prepared our agents, we can now start the sequence to create our story:
try {
await sequence(
{
task: "provide information about the story",
competitionRules: {
wordCount: 500,
chapterCount: 1,
imageCount: 3,
maturityRating: "G|PG|PG13",
},
},
[bookAgent, author, illustrator]
);
console.log("Done");
} catch (error) {
console.error("Error:", error);
}
Save the script in a .ts
(TypeScript) file and execute it using the ts-node
command. If you
don't already have ts-node
, you can install it via npm:
ts-node your_script_file.ts
After running the script, you should verify the output directory, which is
examples/output/auto-book/
in our example. You should find a story
crafted by the author
agent, complete with reading time and word count, and images generated by
the illustrator
agent, inlined within the story.
In case of any errors during the script execution, they will be logged to the console, thanks to the try/catch block surrounding the sequence function.
This guide covered the process of executing AI agents to generate an illustrated story using Hyv, OpenAI's GPT-4, and DALL-E. By following these steps, you can create engaging narratives with accompanying illustrations.
Hyv, OpenAI, GPT-4, DALL-E, TypeScript, Story Generation, AI, Illustrations