Sick Gaming
[Tut] How I Built a Virtual Assistant like Siri using ChatGPT Prompting (No Code!) - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Programming (https://www.sickgaming.net/forum-76.html)
+--- Forum: Python (https://www.sickgaming.net/forum-83.html)
+--- Thread: [Tut] How I Built a Virtual Assistant like Siri using ChatGPT Prompting (No Code!) (/thread-100827.html)



[Tut] How I Built a Virtual Assistant like Siri using ChatGPT Prompting (No Code!) - xSicKxBot - 03-04-2023

How I Built a Virtual Assistant like Siri using ChatGPT Prompting (No Code!)

<div>
<div class="kk-star-ratings kksr-auto kksr-align-left kksr-valign-top" data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;1177543&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;top&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;2&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;5\/5 - (2 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;{score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>
<div class="kksr-stars">
<div class="kksr-stars-inactive">
<div class="kksr-star" data-star="1" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="2" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="3" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="4" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" data-star="5" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
<div class="kksr-stars-active" style="width: 142.5px;">
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
<div class="kksr-star" style="padding-right: 5px">
<div class="kksr-icon" style="width: 24px; height: 24px;"></div>
</p></div>
</p></div>
</div>
<div class="kksr-legend" style="font-size: 19.2px;"> 5/5 – (2 votes) </div>
</p></div>
<p>Siri sucks. <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f61e.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>I am a Siri user, and Siri fails me more than it performs for me. It doesn’t understand the chain of commands. </p>
<h2>Project Idea: Recreate Siri Using ChatGPT</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="577" height="564" src="https://blog.finxter.com/wp-content/uploads/2023/03/image-10.png" alt="" class="wp-image-1177554" srcset="https://blog.finxter.com/wp-content/uploads/2023/03/image-10.png 577w, https://blog.finxter.com/wp-content/uploads/2023/03/image-10-300x293.png 300w" sizes="(max-width: 577px) 100vw, 577px" /></figure>
</div>
<p>This got me thinking, <em>“What if I can repurpose ChatGPT to work like Siri?”</em>. So before I tell you how the prompt looks like this is what the chatbot can recognise in the most natural form:</p>
<ul>
<li>Increase volume</li>
<li>Decrease volume</li>
<li>Play movie</li>
<li>Pause or stop the movie</li>
<li>Open an app</li>
<li>Book a movie or movie ticket</li>
<li>Play song</li>
<li>Book a cab</li>
<li>Call someone</li>
<li>Set a reminder</li>
<li>Send a message</li>
<li>Set an alarm</li>
<li>Open a website</li>
<li>Get directions</li>
<li>Check the weather</li>
</ul>
<p>To trigger these commands, the user needed to begin the instruction with <strong><em><code>"Hey Nik"</code></em></strong>.</p>
<p>Let me begin by showing you the most complicated instruction it can handle</p>
<h2>Prompt First Trial – Not Perfect Yet</h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" loading="lazy" width="1024" height="756" src="https://blog.finxter.com/wp-content/uploads/2023/03/image-11-1024x756.png" alt="" class="wp-image-1177579" srcset="https://blog.finxter.com/wp-content/uploads/2023/03/image-11-1024x756.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/03/image-11-300x222.png 300w, https://blog.finxter.com/wp-content/uploads/2023/03/image-11-768x567.png 768w, https://blog.finxter.com/wp-content/uploads/2023/03/image-11.png 1323w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>
<pre class="wp-block-preformatted"><code><strong>Nik</strong>: Assume it's sunny. Hey Nik check the weather for me and if it's sunny book a cab to go to the beach, play song california love by 2Pac <strong>ChatGPT</strong>: Hey there! The weather today is sunny. Sure, I can check the weather for you and book a cab to the beach if it's sunny. Here are the commands: [WEATHER] [OPENAPP UBER] [PLAYSONG CALIFORNIA LOVE BY 2PAC]</code></pre>
<p><strong>Nik</strong>: Assume it’s sunny. <em>Hey Nik check the weather for me and if it’s sunny book a cab to go to the beach, play song california love by 2Pac</em></p>
<p><strong>ChatGPT</strong>: Hey there! The weather today is sunny. Sure, I can check the weather for you and book a cab to the beach if it’s sunny. Here are the commands:</p>
<p>[WEATHER] [OPENAPP UBER] [PLAYSONG CALIFORNIA LOVE BY 2PAC]</p>
<p>Please note that the cab booking will not be completed as this is a simulated environment.</p>
<p>ChatGPT is not aware of my environment hence I had to tell them that it’s sunny. And then I start with <code>"Hey Nik..."</code><em>. </em>In contrast, Google &amp; Siri cannot handle this.</p>
<p>After a good deal of <a href="https://blog.finxter.com/i-created-a-chatgpt-powered-website-creator-with-chatgpt-heres-what-i-learned/" data-type="post" data-id="1158337" target="_blank" rel="noreferrer noopener">prompt engineering</a>, I came up with the following prompt that could be used by an app to not only detect user meaning but also respond accordingly — without needing to create a single line of code to accomplish this magic!</p>
<p>ChatGPT truly can be used as the <a href="https://blog.finxter.com/building-a-movie-recommendation-app-with-chatgpt/" data-type="post" data-id="1132950" target="_blank" rel="noreferrer noopener">heart</a> of many applications — not just to create them!</p>
<h2>Final Prompt</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="489" height="528" src="https://blog.finxter.com/wp-content/uploads/2023/03/image-12.png" alt="" class="wp-image-1177581" srcset="https://blog.finxter.com/wp-content/uploads/2023/03/image-12.png 489w, https://blog.finxter.com/wp-content/uploads/2023/03/image-12-278x300.png 278w" sizes="(max-width: 489px) 100vw, 489px" /></figure>
</div>
<p>You can copy and paste this prompt in case you want to reuse it to build your own Siri replacement:</p>
<pre class="wp-block-preformatted"><code><strong>Nik</strong>: I want you to be an interactive chatbot that responds to predefined instructions. The instructions and their respective commands are: Increase volume: [INCREASEVOLUME] Decrease volume: [DECREASEVOLUME] Play movie [MOVIE NAME]: [PLAYMOVIE [MOVIE NAME]] Pause or stop the movie: [STOPMOVIE] Open an app [APP NAME]: [OPENAPP [APP NAME]] Book a movie or movie ticket: [OPENAPP BOOKMYSHOW] Play song [song or artist name]: [PLAYSONG [song or artist name]] Book a cab: [OPENAPP UBER] Call someone [NAME]: [CALL [NAME]] Set a reminder [TIME] [REMINDER]: [SETREMINDER [TIME] [REMINDER]] Send a message [NAME] [MESSAGE]: [SENDMESSAGE [NAME] [MESSAGE]] Set an alarm - [SETALARM [time]] Open a website - [OPEN [website name]] Get directions - [DIRECTIONTO [location]] Check the weather - [WEATHER] Here are some conditions to consider: If the instruction includes a number or percentage when using INCREASEVOLUME or DECREASEVOLUME, append it to the command. If the instruction includes the name of an app when using OPENAPP, append it to the command. To trigger these commands, begin the instruction with "Hey Nik". Please note that commands will be in square brackets, with spaces removed except for messages or names. Your response should contain an acknowledgement in English and below it should be the sequence of commands. After you display the commands do not print anything else.</code></pre>
<p>I came up with the following commands on the first attempt</p>
<ul>
<li>Increase volume: [INCREASE VOLUME]</li>
<li>Decrease volume: [DECREASEVOLUME]</li>
<li>Play movie [MOVIE NAME]: [PLAYMOVIE [MOVIE NAME]]</li>
<li>Pause or stop the movie: [STOPMOVIE]</li>
<li>Open an app [APP NAME]: [OPENAPP [APP NAME]]</li>
<li>Book a movie or movie ticket: [OPENAPP BOOKMYSHOW]</li>
<li>Play song [song or artist name]: [PLAYSONG [song or artist name]]</li>
<li>Book a cab: [OPENAPP UBER]</li>
</ul>
<p>After I perfected the results, I wanted to see if ChatGPT could add more commands, so I tried the following prompt</p>
<h2>Refinement Prompt</h2>
<pre class="wp-block-preformatted"><code><strong>Nik</strong>: Can you add more commands in the style given to the prompt. Take inspiration from "ok google" and "hey siri" Please write in English language. <strong>ChatGPT</strong>: Sure, I can add more commands in the style given to the prompt! Here are some additional commands you can use: To set a reminder, say "Hey Nik, set a reminder for [time] to [task]". For example, "Hey Nik, set a reminder for 2pm to attend a meeting". To check the weather, say "Hey Nik, what's the weather like today?". To get directions, say "Hey Nik, how do I get to [location]?". For example, "Hey Nik, how do I get to Central Park?". To set an alarm, say "Hey Nik, set an alarm for [time]". For example, "Hey Nik, set an alarm for 7am". To send a message, say "Hey Nik, send a message to [contact name]". You will then be prompted to dictate the message and confirm before sending. To open a website, say "Hey Nik, open [website name]". For example, "Hey Nik, open Google". Remember to begin each command with "Hey Nik" for the chatbot to respond. I hope these additional commands are helpful! <strong>Nik</strong>:Ok now generate the original prompt with the newly added commands Please write in English language.</code></pre>
<h2>My Personal Considerations and Findings Using This Prompt</h2>
<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" loading="lazy" width="679" height="429" src="https://blog.finxter.com/wp-content/uploads/2023/03/image-13.png" alt="" class="wp-image-1177583" srcset="https://blog.finxter.com/wp-content/uploads/2023/03/image-13.png 679w, https://blog.finxter.com/wp-content/uploads/2023/03/image-13-300x190.png 300w" sizes="(max-width: 679px) 100vw, 679px" /></figure>
</div>
<p>I am impressed with ChatGPT’s ability to generate a more user-friendly and straightforward set of commands. And it also kept modifying my original prompt to include these commands.&nbsp; </p>
<p>But, I realized that there were some conditions that I needed to consider, such as:</p>
<ul>
<li>If the instruction includes a number or percentage when using INCREASEVOLUME or DECREASEVOLUME, append it to the command.</li>
<li>If the instruction includes the name of an app when using OPENAPP, append it to the command.</li>
</ul>
<p>With these conditions in mind, I combined the original set of commands with the new commands generated by ChatGPT and added the necessary conditions to create a more comprehensive and user-friendly prompt.</p>
<p>As I developed the chatbot, I discovered that one of its most significant advantages over Siri was its ability to handle an unlimited set of inputs. Siri, on the other hand, works with one command at a time, which can be limiting for users who want to execute multiple tasks in one go.</p>
<p>Here are some examples of user inputs and their respective responses:</p>
<pre class="wp-block-preformatted"><code><strong>User Input</strong>: Hey Nik, play movie The Shawshank Redemption <strong>Response</strong>: [PLAYMOVIE The Shawshank Redemption] <strong>User Input</strong>: Hey Nik, increase volume by 50 percent <strong>Response</strong>: [INCREASEVOLUME 50 percent]</code>
<code>
<strong>User Input</strong>: Hey Nik, send a message to John saying I will be there in 10 minutes </code> <code><strong>Response</strong>: [SENDMESSAGE John I will be there in 10 minutes] <strong>User Input</strong>: Hey Nik, what is the weather like in New York? <strong>Response</strong>: [WEATHER New York]</code></pre>
<p>Here is an example of the user input and response for the “play song” command:</p>
<pre class="wp-block-preformatted"><code><strong>User input</strong>: Hey Nik, play song Shape of You by Ed Sheeran <strong>Response</strong>: Playing Shape of You by Ed Sheeran <strong>Command</strong>: [PLAYSONG Shape of You by Ed Sheeran]</code></pre>
<p>And here is an example of the user input and response for the <code>"open an app"</code> command:</p>
<pre class="wp-block-preformatted"><code><strong>User input</strong>: Hey Nik, open app Netflix <strong>Response</strong>: Opening Netflix <strong>Command</strong>: [OPEN APP NETFLIX]</code></pre>
<h2>How to Deploy This</h2>
<p>To deploy it as an app, you can use the ChatGPT API + Promptable + Any No Code App Builder, the app can be deployed on iPhone, but there are many permissions that need to be worked out. </p>
<p>A similar version of this may work on Android as it is more open.</p>
<p class="has-base-background-color has-background"><img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f449.png" alt="?" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/building-a-movie-recommendation-app-with-chatgpt/" data-type="URL" data-id="https://blog.finxter.com/building-a-movie-recommendation-app-with-chatgpt/" target="_blank" rel="noreferrer noopener">ChatGPT at the Heart – Building a Movie Recommendation Python Web App</a></p>
</div>


https://www.sickgaming.net/blog/2023/03/02/how-i-built-a-virtual-assistant-like-siri-using-chatgpt-prompting-no-code/