Module 3: Lab - Book Creator application

The Book creator sample application shows how SK uses planner, skills and memories are to create a children’s book. The Planner creates a plan for the skills (functions) that are pre-defined for generating a book topic and creating a book. The Writer pre-defined skills are chained together based on the user ask to create the book.

Requirements:

  • You will need an Open AI API Key or Azure Open AI service key to get started.
  • Azure Functions Core Tools are required to run the kernel as a local web service, this service is used by the sample web app.
  • .NET 6. If you have .NET 7 installed, Azure Function Tools will still require .NET 6, so we suggest installing both.
  • Yarn is used for installing web apps’ dependencies.

Running the Book Creator sample app

Note: to run the sample in VS Code Desktop using Dev Containers from Github Codespaces: Click hamburger menu on the left side of the VS Code window in Codespaces and select Open in VS Code Desktop

  1. Clone the semantic kernel repo

    git clone https://github.com/microsoft/semantic-kernel.git
    
  2. Start the KernelHttpServer. This is the backend API server used by the front end React app and is the intermediary between the front end client application and AzureOpenAI

    cd semantic-kernel/samples/dotnet/KernelHttpServer
    
  3. Run

    func start --csharp
    

    This will run the service API locally at http://localhost:7071.

    cd semantic-kernel/samples/dotnet/KernelHttpServer

  4. In another terminal window, start the BookCreator web application

    cd semantic-kernel/samples/apps/book-creator-webapp-react/
    
  5. Rename the semantic-kernel/samples/apps/book-creator-webapp-react/.env.example file to semantic-kernel/samples/apps/book-creator-webapp-react/.env.

  6. Start the book creator app by running the following commands

    yarn install
    yarn start
    
  7. A browser will automatically open, otherwise you can navigate to http://localhost:3000 to access the application.

  8. On the application main page, enter your AzureOpenAI key and also a value for the model ID as shown below, you may use the default text-davinci-003 and click Save button

    Semantic Kernel Use cases

  9. Follow the application prompts to enter a book idea and click get Ideas button to see some sample suggestions, screenshot should similar to below

    Semantic Kernel Use cases

  10. Select an idea option and click on the create book button to see the newly created book. Note: you need to additionally click on the play button as shown below on the next screen to get the book contents.

    Semantic Kernel Use cases

    The final result of the book

    Semantic Kernel Use cases