From f6d2141a480dd6b5b8ee0e48d43bb64773232791 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 26 Mar 2024 23:38:14 -0600 Subject: add header ids --- ...02-08-Interact-with-siri-from-the-terminal.html | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html') diff --git a/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html b/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html index 8df15ef..0c23964 100644 --- a/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html +++ b/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html @@ -6,13 +6,13 @@ - Interacting with Siri using the command line + id="interacting-with-siri-using-the-command-line">Interacting with Siri using the command line - - + Interacting with Siri using the command line" /> + Interacting with Siri using the command line" /> @@ -44,11 +44,11 @@
-

Interacting with Siri using the command line

+

Interacting with Siri using the command line

My main objective was to see if I could issue multi-intent commands in one go. Obviously, Siri cannot do that (neither can Alexa, Cortana, or Google Assistant). The script here can issue either a single command, or use the help of OpenAI's DaVinci model to extract multiple commands and pass them onto siri.

-

Prerequisites

+

Prerequisites

-

Show me ze code

+

Show me ze code

If you are here just for the code:

@@ -136,11 +136,11 @@ python3 main.py & -

ELI5

+

ELI5

I am not actually going to explain it as if I am explaining to a five-year old kid.

-

AppleScript

+

AppleScript

In the age of Siri Shortcuts, AppleScript can still do more. It is a scripting language created by Apple that can help you automate pretty much anything you see on your screen.

@@ -191,11 +191,11 @@ python3 main.py & -

Multi-Intent Commands

+

Multi-Intent Commands

We can call OpenAI's API to autocomplete our prompt and extract multiple commands. We don't need to use OpenAI's API, and can also simply use Google's Flan-T5 model using HuggingFace's transformers library.

-

Ze Prompt

+

Ze Prompt

You are provided with multiple commands as a single command. Break down all the commands and return them in a list of strings. If you are provided with a single command, return a list with a single string, trying your best to understand the command.
@@ -217,7 +217,7 @@ python3 main.py &
 
 

This prompt gives the model a few examples to increase the generation accuracy, along with instructing it to return a Python list.

-

Ze Code

+

Ze Code

import openai
@@ -251,7 +251,7 @@ python3 main.py &
 
-

Gluing together code

+

Gluing together code

To finish it all off, we can use argparse to only send the input command to OpenAI when asked to do so.

@@ -271,7 +271,7 @@ python3 main.py &
-

Conclusion

+

Conclusion

Siri is still dumb. When I ask it to Switch off the lights, it default to the home thousands of miles away. But, this code snippet definitely does work!

-- cgit v1.2.3