(This is Part 2 of a series extending an AI-powered conversational speaker. If you haven't yet, complete part 1 first: AI Conversation Speaker aka Friend Bot: Part 1 Conversation - Hackster.io)
The Conversational Speaker, informally known as "Friend Bot", uses a Raspberry Pi to enable a spoken conversation with OpenAI large language models. This implementation waits for a wake phrase, listens to speech, processes the conversation through the OpenAI service, and responds back.
For more information on the prompt engine used for maintaining conversation context, go here: python,typescript,dotnet.
For more information about prompt design in general, checkout OpenAI's documentation on the subject: https://beta.openai.com/docs/guides/completion/prompt-design.
This project is written in.NET 6 which supports Raspberry Pi OS, Linux, macOS, and Windows.
Build time: 5 minutes
Read time: 5 minutes
The Code1. Using the repo you cloned in part 1, checkout the hackster-tutorial-2
branch.
cd ~/conversational-speaker
git checkout hackster-tutorial-2
2. Build and run the new code!
cd ~/conversational-speaker/src/ConversationalSpeaker
dotnet build
dotnet run
How It WorksFor more details on how the code words, check out the README.
Azure(Optional) Create a custom wake word
The code base has a default wake word (i.e., "Hey, Computer.") already, which I suggest you use first. If you want to create your own (free!) custom wake word, follow the steps below:
1. Create a custom keyword model using Microsoft's Speech Studio with the directions here: https://aka.ms/hackster/microsoft/wakeword.
2. Download the model, extract the .table
file, and overwrite the src/ConversationalSpeaker/Handlers/WakeWordModel.table
file in the code base.
3. Rebuild and run the project to use your custom wake word.
UsageBy default, say "Hey, Computer" to start the Friend Bot listening and will continue the conversation until you say "Goodbye". After that, the AI should say "Bye", stop listening to everything, and start listening for just the wake phrase.
Next Time...In the next tutorial we'll go deeper with prompt engineering and explore how to integrate our friendly conversational speaker into helping out around our smart home.
Have fun!
Comments