top of page

#3 - Let ChatGPT Program Your Own AI Voice Assistant Without Coding

The digital era is shaping a new breed of product management, one where technology, data, and artificial intelligence converge to create innovative, customer-centric solutions. Among these, AI voice assistants are rising as an instrumental asset, driving efficiency and transforming user experiences. But the prospect of building an AI voice assistant can seem intimidating, especially to those without coding expertise.


What if, as a product manager, you could create a prototype of an AI voice assistant without having to write a single line of code? What if you could swiftly test, iterate, and validate your concepts using the power of AI?


Introducing ChatGPT, OpenAI's groundbreaking language model. More than just an AI capable of understanding and generating human-like text, ChatGPT serves as a powerful tool for product managers for rapid prototyping of AI voice assistants. Trained on diverse internet text and capable of learning and adapting, ChatGPT is the ideal platform for creating a preliminary voice-activated assistant tailored to your product's requirements.


In this blog post, I will guide product managers through the exciting process of using ChatGPT for swift, code-free prototyping of an AI voice assistant. Whether you're seeking to accelerate product innovation, enhance user engagement, or simply explore the possibilities of AI in product management, this guide is for you.


Bear in mind, while the outcome may not be a fully production-ready voice assistant, it serves as a practical example of AI's potential in the prototyping phase.


1. Browse to OpenAI ChatGPT


2. Start a new ChatGPT session and select the GPT-4 model. If you are using the free GPT-3.5 version, the example will eventually work but you may need to try this ten times to get it right one time. Therefore, I suggest using GPT-4.


3. Run this following prompt:


I am writing a messaging web page for my own use and need an example single html page in javascript where I can have a conversation with chatgpt chat api. Provide me first only the html file; I will ask for the js file later. Below is more information. 1) I want to dictate my message with speech-to- text, edit it if necessary and then click a button to send it. 2) I want to hear the messages I receive as audio. 3) Have the javascript in a separate file called “chatgpt.js”. 4) Keep the css in the html file. 5) WebSpeechAPI provides the speech-to-text and the text-to-speech functionality. 6) Use Tailwind to style the page futuristic from the latest api at https://unpkg.com/ tailwindcss@^1.0/dist/tailwind.min.css. Make the text color always contrasting on background. 7) Openapi chat api is at https://api.openai.com/v1/chat/completions and the model is gpt-3.5-turbo. The endpoint requires a “messages” parameter instead of the “prompt”. An example of a conversation between user and assistant is here: messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"}, {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, ] 8) I want to see any error messages on the page.

4. Rerun in a new session if ChatGPT brakes

5. Copy the HTML code from ChatGPT and paste it into a new HTML file named index.html

6. Run this prompt on ChatGPT: provide the js file that works for the html page you provided

7. If ChatGPT brakes go to the 1st step in a new session

8. Copy the JS code from ChatGPT and paste it into a file named chatgpt.js file

9. Get your OpenAI API key. If you don’t know how to get your OpenAI API KEY either ask ChatGPT or search for “How to get my OpenAI API key” on the web.


10. Find and replace the YOUR_API_KEY placeholder in the HTML with the API key. More often than not chatGPT will use YOUR_API_KEY but it can also use any arbitrary placeholder name. Below are some examples. Replace the highlighted text:

... = “<YOUR_API_KEY>”;

... = “YOUR_API_KEY”;

... = “API_KEY";

...“Bearer PASTE_YOUR_API_KEY”


11. Open index.html in your web browser. You should see something close to the screen below, but not exactly the same:



12. Click the button that is for recording. If anything does not work from this point forward then go back to the first step in a new ChatGPT session. There is always a chance for a bug, therefore instead of going into debugging it is easier to regenerate the code.


13. Approve the audio recording permission when your browser asks for it


14. Say something, verify the text and click send


15. Listen to the response audio and keep chatting like seen on the screenshot below



Bonus! Try changing the prompt for different styles and functions to create the next Generative AI startup!


Help? IM me for any errors. Code? Comment to this post to

receive my code.


More? Check out my other ChatGPT programming examples.

Delete your OpenAI API key from OpenAI once you are done to keep your OpenAI access safe.


For more AI topics follow me on https://lnkd.in/gai3E3ZA.

Or, join one of my AI programs for product managers and business professionals at https://aiproductinstitute.com


10 views0 comments

Comments


bottom of page