<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Wolf Paulus on Medium]]></title>
        <description><![CDATA[Stories by Wolf Paulus on Medium]]></description>
        <link>https://medium.com/@wolfpaulus?source=rss-cc7885d0f40a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PynG8AkD6EOkxh3bPH6ANg.jpeg</url>
            <title>Stories by Wolf Paulus on Medium</title>
            <link>https://medium.com/@wolfpaulus?source=rss-cc7885d0f40a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 08:58:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wolfpaulus/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI Tutor helping students to learn Python]]></title>
            <link>https://medium.com/@wolfpaulus/ai-tutor-helping-students-to-learn-python-6a212f6a394c?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a212f6a394c</guid>
            <category><![CDATA[tutor]]></category>
            <category><![CDATA[college]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Sun, 04 Jun 2023 04:25:00 GMT</pubDate>
            <atom:updated>2023-06-04T04:25:00.620Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PMDRYpXS8SxddORqgwrQ7A.jpeg" /><figcaption>Cover art by <a href="https://deepai.org/machine-learning-model/cyberpunk-portrait-generator">Cyberpunk Portrait Generator API</a></figcaption></figure><p>You don’t need to be a pessimist to imagine a world where students let AI tools do their homework and teachers use AI tools to evaluate students’ submissions. Maybe there is still a chance for a better outcome.</p><p>For educators, it’s easy to perceive AI tools as a threat or a tool that almost invites students to cheat. Not as easy, but still plausible, is an approach that integrates AI tools into teaching.</p><p>For a given task like <em>“write a program that prints the first 100 prime numbers,”</em> it’s easy for students to open <a href="https://chat.openai.com/">ChatGPT</a>, enter the task, and copy/paste/submit the output. Not as easy, but certainly more rewarding, is an approach that allows students to embrace feedback from an AI-tool, before submitting their work.</p><h3>AI-Tutor</h3><p>I created a rather simple web service (dubbed <em>AI-Tutor</em>) that supplements incoming requests, before sending them on to a generative AI service.<br>To keep the conversation focused and to allow for follow-up questions, <strong>AI-Tutor maintains objective and context.</strong> It allows students to ask questions about a programming task and maybe more importantly, can evaluate a proposed solution and provide ongoing feedback.</p><h3>AI-Tutor + Colab</h3><p>To let students easily interact with AI-Tutor, I integrated the service into Colab. Google Research provides <a href="https://colab.research.google.com/">Colaboratory</a>, or Colab for short, for free. Colab allows anybody to write and execute source code through their web browser. I.e., you don’t need to have Python or an IDE installed on your computer.<br>For instance, in Colab, users can write Python programs in <a href="https://jupyter.org/">Jupyter Notebooks</a>. The code is placed into Jupyter cells and executed by pushing the execute button. Notebooks can easily be shared, by simply sharing a URL.</p><blockquote>Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and explanatory text. It provides an interactive computing environment where you can write and execute code, visualize data, and document your work.<br>The name “Jupyter” is derived from the combination of three programming languages: Julia, Python, and R. These languages were the initial languages supported by Jupyter Notebook, although now it supports many other programming languages.<br>A Jupyter Notebook consists of a series of cells, which can contain code, markdown text, or raw text. You can execute the code cells interactively and see the results immediately below the cell. This allows for a more exploratory and iterative workflow, where you can run code in small chunks and examine the output as you go.</blockquote><h3>Task</h3><p>A task is a programming exercise that students need to solve. Here are three examples:</p><ol><li>Find the first 100 prime numbers</li><li>Roll a dice until you have rolled six twice in a row</li><li>Ask a user for their name and output the number of vowels you found in the name</li></ol><h3>Solution</h3><p>Solutions are <strong><em>not</em></strong> provided to students, but a line of actions (strategy) is included. This is necessary because, without it, AI-Tutor might not always provide a consistent and correct approach for every task.</p><h3>Strategy</h3><p>A strategy is a line of actions that students can follow to solve the task.<br>For the above-mentioned <em>100 prime numbers</em> task, for instance, the strategy could be:</p><ol><li>Initialize an empty list to store the prime numbers.</li><li>Start with a number, let’s say 2, and check if it is prime.</li><li>If the number is prime, add it to the list of primes.</li><li>Increment the number and repeat steps 3 and 4 until you have found 100 prime numbers.</li></ol><h3>Asking questions</h3><p>At this point, students may have questions about the strategy, e.g. <em>“What does it mean that a number is prime?” </em>or <em>“How would I do step 3?”</em><br>AI-Tutor will answer questions in the context of the given task and strategy. However, code snippets longer than 10 lines are removed from the answer.</p><h3>Student question: What does it mean that a number is prime?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bR49OqIJliqXAPfnopLXfA.png" /></figure><h3>Student question: How would I do step 3?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uYjnK47fda-3F58lyDA7WA.png" /></figure><h3>Pseudo Code</h3><p>Depending on the task, it might be helpful to include <em>a pseudo-code</em>. For the above-mentioned <em>100 prime numbers</em> task for instance the pseudo-code could be:</p><pre>Initialize an empty list to store the prime numbers<br>Set num to 2, the first prime number<br>While the length of the list of prime numbers is less than 100:<br>    Set is_prime to True<br>    For each integer i from 2 to the square root of num (inclusive):<br>        If num is divisible by i:<br>            Set is_prime to False<br>            Break out of the loop<br>    If is_prime is True:<br>        Add num to the list of prime numbers<br>    Increment num by 1</pre><h3>Coding Editor</h3><p>The Colab notebook contains a rudimentary coding editor that allows students to write and execute code.</p><h3>Asking for feedback</h3><p>Students can ask AI-Tutor to evaluate their solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OKOAxT_DgKCjs6aeDxRZ4Q.png" /></figure><h3>Taking AI-Tutor for a spin</h3><p>Here are three Colab notebooks for you to try out:</p><ol><li><a href="https://colab.research.google.com/github/wolfpaulus/ai_tutor/blob/main/python_tutor_primes.ipynb">Print the first 100 primes</a></li><li><a href="https://colab.research.google.com/github/wolfpaulus/ai_tutor/blob/main/python_tutor_dice.ipynb">Roll a dice until you roll a six twice in a row</a></li><li><a href="https://colab.research.google.com/github/wolfpaulus/ai_tutor/blob/main/python_tutor_vowels.ipynb">Count the number of vowels in a name</a></li></ol><h3>Colab Notebook Quick Start</h3><p>The links above will open Colab Notebooks.</p><p><strong>Step 1: </strong>click <em>Connect</em>, which means that somewhere a <em>real</em> computer will come alive to host this <em>Colab</em> notebook. Interestingly, during my testing, this computer was often located in the Netherlands.<br><strong>Step 2: </strong>click the <em>play button</em> to initialize the tutor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_SM-myzwfpjjXKekWMjw-g.png" /></figure><p><strong>Step 3:</strong> click the next <em>play button</em>. A text input box will appear, allowing you to enter a question, which AI-Tutor will try to answer. If you have follow-up questions, just click the play button again.</p><p><strong>Step 4:</strong> once you have come up with a solution, or just something intermediate, click the final play button, to receive feedback. Consider the response, improve your code, and iterate. You can do this step until you like the response you are getting.</p><p><strong>Step 5:</strong> save your work. Click the <em>Save copy in Drive</em> option in the <em>File</em> menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLySm8vAxeH4zVefI2Fn1w.png" /></figure><p>If things go wrong, the <em>Runtime</em> menu is your friend. The nuclear option would be <em>“Disconnect and delete runtime” </em>and then simply reload the page.</p><h3>Adding more Tasks</h3><p>You can take a look at how AI-Tutor was implemented: <a href="https://github.com/wolfpaulus/ai_tutor">https://github.com/wolfpaulus/ai_tutor</a></p><p>Taking a closer look at the three examples (*.ipynb files) should give you an idea of the work that’s involved, creating more AI-Tutor-based assignments.<br>At this point, I think it should take no more than about 15 minutes, from idea to colab notebook.</p><h3>Let’s see a demo …</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F832989109%3Fh%3D72130c47fe%26app_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F832989109&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1679153640-9b649c6eb11afc4fa4db65c646e2269c39d9fb00854a9f31f6b5132a51441cfb-d_1280&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1081" frameborder="0" scrolling="no"><a href="https://medium.com/media/65c89624a613a0506bbc5e71b23d2eb9/href">https://medium.com/media/65c89624a613a0506bbc5e71b23d2eb9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_BYW3N7dHgTh2Qxn-_Q5w.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a212f6a394c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Could there be an effective computer for students that are REALLY on a budget?]]></title>
            <link>https://medium.com/@wolfpaulus/could-there-be-an-effective-computer-for-students-that-are-really-on-a-budget-3f6a818271ab?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f6a818271ab</guid>
            <category><![CDATA[college]]></category>
            <category><![CDATA[embry-riddle]]></category>
            <category><![CDATA[lenovo]]></category>
            <category><![CDATA[ssd]]></category>
            <category><![CDATA[computers]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Wed, 15 Mar 2023 00:21:18 GMT</pubDate>
            <atom:updated>2023-03-15T04:19:37.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFO1nYRbAd7H4X9nJZfqWg.jpeg" /></figure><p>At some point during my last high school years, I caught the computer bug, and I couldn’t stay away from programmable devices.</p><p>Late-afternoon bus rides back to the city, followed by 20-minute walks to the local university, finding an unlocked door, sneaking in, trying to look a little older, and finally finding an unattended terminal or even a Tektronix graphical workstation. Professors, being a little behind the technology curve, were still requesting students to turn in their homework on punchcards, leaving the newer tech unused and available to me ;-)</p><p>Today programmable devices are ubiquitous, affordable, and easily accessible no bus rides are needed. Our classrooms at Embry Riddle are equipped with decent PCs, running Windows and/or Linux, with all the necessary software pre-installed. Still, I have a suspicion, students bringing their own devices to class, generally, do better and earn better grades.</p><p>Most students do bring a computer to class but the devices that I have encountered differ greatly. Everything you can imagine, from advanced gaming laptops and MacBooks to Chromebooks and years-old iPads. Maybe I’m out of line, but I believe that some students with seemingly insufficient devices just could not afford a more suitable computer.</p><h3><strong><em>So here is the quest: is there a computer that is as nimble as it is affordable, just enough for students that are REALLY on a budget?</em></strong></h3><p>In spring 2023, the <strong>Lenovo IdeaPad 1–15IJL7 Laptop 82LX0050US</strong> costs as little as $149, here are the hardware specifications:</p><ul><li>Display diagonal: 15.6, 1920 x 1080 pixels (not a touchscreen)</li><li>Processor: Intel Pentium Silver N6000 1.1 GHz</li><li>Internal memory: 4 GB DDR4-SDRAM 2933 MHz</li><li>Storage: Toshiba 128 GB eMMC</li><li>Wi-Fi 6 (802.11ax)</li><li>Ports: USB-A 3.2, USB-A 2.0, USB-C, Headphone, HDMI, SDCard Reader</li><li>WebCam resolution: 1280 x 720 pixels, two microphones</li><li>Full-size Keyboard (incl. num pad but is not backlit)</li><li>Battery: 11 hrs</li><li>Weight: 1.45 kg</li></ul><p>Talking about a budget laptop, those specs don’t look bad at all. But to be very clear, while this is a Lenovo device, nothing feels premium but rather plasticky. Still, after removing all the stickers the dark blue device looks nice.</p><p>Out of the box, however, the Laptop is insufficient for almost any task. It runs Windows 11 in S-Mode, the display lacks contrast, 4 GB internal memory is simply not enough to open more than two or three browser tabs, and the worst part is the extremely slow and limited, eMMC hard drive.</p><p>Besides running software in ‘dark mode’, there is nothing that can be done to improve the display, but the memory issues can be addressed, by adding an <a href="https://www.amazon.com/dp/B09PXF9PT5">8 GB DDR4 Ram module</a> ($30) and a fast <a href="https://www.amazon.com/dp/B0B25NTRGD">500GB Solid State Drive</a> ($40).</p><p>Let me show you how this now $229 laptop comes to life.</p><h3>Preparing for the Upgrade</h3><p>The Laptop comes with Windows 11 preinstalled, but enventually, you will perform a clean install of Windows. Double-check that the activated Windows 11 digital license is associated with your Microsoft account.</p><p>The Activation page in Settings needs to show that the <em>“copy is activated with a digital license and associated with a Microsoft account.”</em></p><p>Temporarily, you will need a USB drive with at least 8GB of memory, a USB mouse, a small Phillips-head screwdriver, and a guitar pick or putty knife. Borrowing this stuff from a friend is okay. You will need it only briefly.</p><p>To switch Windows 11 out of S mode, follow <a href="https://support.microsoft.com/en-us/windows/switching-out-of-s-mode-in-windows-4f56d9be-99ec-6983-119f-031bfb28a307">these steps</a>.</p><p>To create a bootable USB drive to install Windows 11 from, follow the “<a href="https://www.microsoft.com/software-download/windows11https://www.microsoft.com/software-download/windows11">Create Windows 11 Installation Media</a>” instructions.</p><h3>Hardware Upgrade</h3><p>Before installing the additional memory modules, turn off the computer, and then press Fn and the power button to open the <em>“Novo Button Menu.”</em> Open the BIOS menu and locate “Disable Building-in Battery.” Unplug the powercord before selecting this item.</p><p>Remove the ten screws in the back (notice the location of the four shorter screws). Carefully use a pick or putty knife to open the taps (try not to insert any deeper than about 3 mm.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jRnqDNCAwA0biDmsktKmig.jpeg" /></figure><p>Locate the free DRAM slot, slide the module in at a 45 degrees angle, and push it down. If you have never installed a memory module before, watch this short <a href="https://youtu.be/6dh-kVbe11Y">video</a>.</p><p>Now locate the slot for SSD, insert it, and secure it with the provided screw. Here is a related <a href="https://youtu.be/9KmnjXj0ohg">video</a>.</p><p>Put the lid back on, press it down, and make sure you hear all the tabs snapping back into place again. Finally, put the ten screws back into place. Insert the power cable and start the device. (Don’t worry if the SSD doesn’t show up.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iNXanjBGJzzXuXMoy3FNGg.jpeg" /><figcaption>Lenovo IdeaPad 1–15IJL7 Laptop with additional memory modules added</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JxpK9GK0CmaSJbF2-RAbSg.jpeg" /><figcaption>Crucial 500GB NVMe SSD vs Toshiba 128 eMMC</figcaption></figure><h3>Installing Windows Cleanly</h3><p>Turn off the computer, insert the USB Drive, and press Fn and the power button to open the “novo menu.” Open the Boot Menu and select booting from the USB Drive.</p><p>Follow the installation steps and select the 500GB drive as the destination. You can leave the 128GB eMMC drive as is for now. However, I removed all partitions on that drive. Btw, I tried to protect my privacy as much as possible, disabling almost anything during the installation process. Still, you will find many apps installed (Instagram, Spotify, Xbox, etc.), most of which can easily be removed later. Whenever you have the chance .. with Windows, less is more here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zym6UOfYDFy0jpqKTb2cUA.jpeg" /></figure><p>During the installation and setup, the laptop’s touchpad won’t work, and you will need the USB mouse to navigate. <br>When Windows 11 is finally installed and updated, install <a href="https://www.lenovo.com/us/en/software/vantage/">Lenovo Vantage</a>, which will re-map all the function keys, like screen brightness, volume, etc.</p><p>If you feel a little uncertain about installing a clean copy of Windows 11 on your device, read some words of comfort on the <a href="https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Laptops/Is-there-a-way-to-fresh-install-Windows-11/m-p/5142085">Lenovo Forum</a>.</p><p>After that I installed Python and PyCharm and removed unneeded apps. I installed Chrome, made it the default browser, and switched the default search engine from “bing” to google.</p><p>The laptop works nicely now, and I’m starting to enjoy the keyboard. But let’s be honest, it may be a sufficient device but cannot keep up with a MacBook Air with an M2 chip. The Mac has less memory and storage but costs more than 5 times $229. <br>Here is a short Python program that computes the 1st 100,000 Prime numbers. The MacBook gets the job done in 1.4 seconds the upgraded IdeaPad 1 takes 2.3 seconds.</p><pre>&quot;&quot;&quot; Let&#39;s see how the IdeaPad 1 is performing &quot;&quot;&quot;<br>from time import process_time as time<br><br>num_of_primes = 100_000<br>print(f&quot;Finding {num_of_primes:,} Primes ...&quot;)<br><br>t0 = time()<br>primes = [2]<br>t = 1<br><br>while len(primes) &lt; num_of_primes:<br>    t += 2<br>    for p in primes:<br>        if t % p == 0:<br>            break  # is not prime<br>        elif p*p &gt; t:<br>            primes.append(t)<br>            break<br>dt = time() - t0<br>print(primes)<br>print(f&quot;Found {num_of_primes:,} prime numbers in {dt} secs.&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3V41MPVJYyVoldmCrsy3Yw.jpeg" /></figure><h3>Installing Linux</h3><p>Installing Linux was more involved than I had originally anticipated. I reused the USB drive to <a href="https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview">create a bootable Ubuntu USB drive</a>. <br>Once that was done, I booted into the “novo menu” to select to boot from the USB drive.<br>I skipped the wifi setup and selected the minimal installation.<br>Next, I selected the slow 128GB Toshiba drive /dev/mcblk0 and created a new Partition Table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BMIfT5LcGP0R_LC_XNXjPw.jpeg" /></figure><p>I create two partitions: EFI (300MB) and EXT4 mounting to “/” with the remaining memory. It took a while, but Ubuntu can now be booted from the original hard drive (using the “novo menu”.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*segpRuyXjjd1Nxwq6whquA.jpeg" /></figure><h3>Conclusion</h3><p>I wasn’t really sure what to expect when I started this project. Sure there was a good chance that I was just wasting (149+30+40=) $219 and some of you may still say that this is exactly what I did.</p><p>I have not owned a Windows computer in twenty years and I have to acknowledge that it’s workable and I admit, it’s much better than I thought. So I have learned a lot about Windows and Laptops built for that Eco-System. I have also learned about <a href="https://www.atpinc.com/blog/what-is-m.2-M-B-BM-key-socket-3">M.2 and mSATA, SATA and NVMe</a>, when selecting the storage module. Most of all, I know now that even for students that are truly on a budget, $220 would buy them a computer, sufficient to get at least through my classes.</p><p>Btw, after removing all the stickers this very dark blue laptop, in dark mode, looks kind of cool ...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsQn0KtolKYs36_U5P3XwQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f6a818271ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One Lambda to rule them all]]></title>
            <link>https://medium.com/@wolfpaulus/one-lambda-to-rule-them-all-796adb0d3eb4?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/796adb0d3eb4</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[native-extensions]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[polly]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Sat, 14 Nov 2020 04:25:39 GMT</pubDate>
            <atom:updated>2020-11-14T04:25:39.849Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CoAwRgIlNKR0Z7W1sBlnBw.jpeg" /></figure><p>Whenever I got a new laptop or was (re-)installing macOS from scratch, a Java JDK, <a href="https://www.jetbrains.com/idea/">IntelliJ IDEA</a>, and <a href="http://tomcat.apache.org/">Tomcat</a>, the “pure Java” HTTP web server environment, were always among the 1st things I installed.<br>How times have changed. Now it’s Docker, <a href="https://www.python.org/downloads/">Python3</a>, <a href="https://www.jetbrains.com/pycharm/">PyCharm</a>, and AWS and SAM CLIs that go on first. I still do Java, quite a bit actually, but Python and AWS Lambda are on the rise.</p><h3>AWS Lambda</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/0*PEhzyfXakplQqYvs.png" /></figure><p>I used to think of the AWS Lambda environment as of a Java Virtual Machine or a Python virtual environment, but it has more to offer, it’s a microVM. AWS Lambda uses <a href="https://firecracker-microvm.github.io/">Firecracker</a> as the foundation for provisioning and running sandboxes upon which we execute our custom code. Each Firecracker microVM uses 5.24 MB of memory and a single Firecracker microVM can be launched in 125 ms. Only Intel x86_64 and AMD x86_64 CPUs are supported, (which is important to know, when it comes to including native libs or executables.)</p><h3>Runtime Environment limits</h3><ul><li>The /tmp directory storage is limited to 512 MB.</li><li>File descriptors: 1024</li><li>Processes / threads: 1024</li><li>Deployment package size is 50 MB (compressed) 250MB (uncompressed)</li><li>Invocation payload (request and response) synchronous calls 6 MB, async. 256KB</li><li>Invocation frequency per function: 10x provisioned concurrency</li><li>Function timeout: 900s (15 minutes)</li><li>Memory range is from 128 to 3008 MB, in 64MB increments</li></ul><p>To explore inside the AWS Lambda infrastructures, here is fun a project, essentially giving you <a href="http://www.lambdashell.com/">direct shell access</a>, and here is a related <a href="https://github.com/iopipe/lambda-shell">project on GitHub</a>. And since the size of deployment packages is limited to 50 MB, it might be good to know, which <a href="https://insidelambda.com/">modules are already available</a> and therefore don’t have to be a part of the deployment package.</p><p>An AWS Lambda function can be simple but still quite powerful, doing many things, I used to do with Tomcat. I will show an AWS Lambda function, implemented in Python, performing things like:</p><ol><li>Serving an HTML page</li><li>Consuming HTTP Post requests sent from that page HTML page</li><li>Securely storing received information in a Dynamo DB</li><li>Synthesizing text into speech, i.e. returning MP3 (digital audio)</li><li>Calling native libraries or executables that were deployed with the lambda function.</li><li>Calling other AWS Lambda functions</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*59QApQvmS8Wol10L.jpg" /></figure><p>Since the last item on that list mentions calling another Lambda, we need two Lambda functions. Before writing any code, there are a few things that need to be installed.</p><h3>1 Prerequisite</h3><ol><li>Install <a href="https://www.python.org/downloads/">Python</a> and <a href="https://www.jetbrains.com/pycharm/download/">PyCharm</a> with the AWS Toolkit plugin enabled</li><li>Install AWS CLI and AWS SAM CLI</li><li>Create an AWS Account</li></ol><h3>1.1 PyCharm with the AWS Toolkit plugin enabled</h3><p>After installing PyCharm, open <em>Preferences,</em> and then <em>Plugins</em>. There you can search for and enable the <strong>AWS Toolkit</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*4h11DePygu0xr_iR.jpg" /></figure><h3>1.2 Installing AWS CLI and AWS SAM CLI</h3><p>Jetbrains’ AWS Toolkit is just a UI accessing the AWS Command-line Tools, which therefore must be installed before we can use the Toolkit.</p><h3>1.2.1 AWS Command Line Interface</h3><p>How to install the AWS CLI version 2 is explained <a href="https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html">here</a>. However, with <a href="https://brew.sh/">Homebrew</a> installed on your Mac, it can be installed easier and faster like so:</p><pre>brew install awscli</pre><p>and confirming the installation like so:</p><pre>aws --version<br>aws-cli/2.0.58 Python/3.9.0 Darwin/19.6.0 source/x86_64</pre><h3>1.2.2 AWS Serverless Application Model Command Line Interface</h3><p>How to install the AWS SAM CLI is explained <a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html">here</a>. Again, with Homebrew installed on your Mac, it can be installed like so:</p><pre>brew tap aws/tap<br>brew install aws-sam-cli</pre><p>and confirming the installation like so:</p><pre>sam --version<br>SAM CLI, version 1.6.2</pre><h3>1.3 Creating an AWS Account</h3><p>AWS Accounts (aka <em>Root User Accounts</em>) can be created here:<br><a href="https://portal.aws.amazon.com/gp/aws/developer/registration/index.html">https://portal.aws.amazon.com/gp/aws/developer/registration/index.html</a> students should start here instead: <a href="https://aws.amazon.com/education/awseducate/">https://aws.amazon.com/education/awseducate/</a><br>A credit card number and a phone is needed during the setup process. Select “<em>Basic</em>” for the support plan.</p><h3>1.3.1 Bucket</h3><p>Click in Services and navigate/find S3 or go directly to <a href="https://s3.console.aws.amazon.com/s3/">https://s3.console.aws.amazon.com/s3/</a> . There you will have the chance to create a bucket and provide it with a unique name. Go ahead and do that. I used <strong><em>edu-bucket </em></strong>for my bucket’s name and clicked through, going with all the defaults.</p><h3>1.3.2 Creating an IAM Account / Group and User</h3><p>Create an IAM Account (aka AWS <em>Identity and Access Management (IAM) user)</em> here:<br><a href="https://console.aws.amazon.com/iam">https://console.aws.amazon.com/iam</a></p><p>Select <em>‘Group’</em> on the left side and then click the “Create new Group” button.<br>Enter a name (e.g. <strong><em>MyEduGroup</em></strong>) and in the next step add these two policies:</p><ul><li>IAMFullAccess</li><li>PowerUserAccess</li></ul><p>Review and click the “Create Group” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*tL8gHxEfQxYxolXs.png" /></figure><p>Select <em>‘User’</em> on the left side and then click the “Add user” button, to create a new IAM user.<br>Create a user name (e.g. <strong><em>MyEduUser</em></strong>) and select “Programmatic access” only.<br>Next, add the user to the group, mentioned above, (e.g. <em>MyEduGroup</em>)</p><p>Review and click the “Create user” button and don’t forget to <strong>download the csv file, </strong>containing the IAM user’s credentials.</p><p>Now open a terminal or shell on your computer and enter ‘aws configure –profile &lt;profile name&gt;’ and provide the <em>key</em> and <em>secret</em> from the dowloaded csv file. I used <em>‘edu’</em> for the profile name. Then copy/paste the key-id, copy/paste access-key, for the region I used <em>‘us-west-2’</em>, and for the default output format I used <a href="https://www.w3schools.com/js/js_json_intro.asp"><em>‘json’</em></a></p><pre>aws configure --profile edu<br>AWS Access Key ID [None]: AKIA...<br>AWS Secret Access Key [None]: zjPG...<br>Default region name [None]: us-west-2<br>Default output format [None]: json</pre><h3>2 A simple AWS Lambda function for translating English text to German</h3><p>As mentioned above, we actually need two Lambda functions for this demo. Let’s start by creating the simpler function first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/0*n69qdKW9iuSg8OG_.png" /></figure><p><a href="https://github.com/wolfpaulus/EN2DE">https://github.com/wolfpaulus/EN2DE</a></p><h3>2.1 Create</h3><p>I open PyCharm and create a new project. No 3rd party modules are required (or more precisely need to be deployed) for this simple function and I don’t even bother with a virtual environment. Since this function will translate English text into German, I’m calling it EN2DE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*KIl_hOPiZx6T091z.jpg" /></figure><p>I usually create a sub-directory inside the project and name lambda. In there, I create two files: an empty <em>requirements.txt</em> file and an <em>app.py</em> file.</p><h3>2.1.1 Lambda Function Code</h3><pre>import logging<br><br>import boto3<br>logging.getLogger().setLevel(logging.INFO)<br><br><br>def lambda_handler(event: dict, context) -&gt; dict:<br>    logging.info(str(event))<br>    text = event.get(&#39;text&#39;, &#39;no input text provided&#39;)<br>    translate = boto3.client(service_name=&#39;translate&#39;, region_name=&#39;us-west-2&#39;, use_ssl=True)<br>    return translate.translate_text(Text=text, SourceLanguageCode=&#39;en&#39;, TargetLanguageCode=&#39;de&#39;)</pre><p>While simply using Python’s builtin print method would already write into the CloudWatch log, using Python’s <a href="https://docs.python.org/3/library/logging.html">logging library</a> allows for log levels and also writes a timestamp into each log entry.</p><pre>def lambda_handler(event: dict, context)</pre><p>The lambda function will receive an event dictionary with input parameters as well as a context object with methods and properties, providing information about the invocation, function, and execution environment. Here I’m assuming that the function will be called with a dictionary containing a ‘text’ item. Its value will be passed to the <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/translate.html">boto3 translate client</a>.</p><blockquote>boto3</blockquote><blockquote>Rob Bricheno’s cool <a href="https://insidelambda.com/">Inside Lambda service</a> shows that the boto3 module is already available and therefore doesn’t need to be mentioned as a requirement and thereby keeping the deployment package nice and small.</blockquote><h3>2.1.2 Lambda CloudFormation Template</h3><p>This Lambda CloudFormation Template (template.yaml), stored inside the project directory, allows for super convenient deployment. The template declares the required runtime (i.e. python3.8), the source code directory, the python file, and handler function (e.g. app.lambda_handler), the policy required at runtime, and also the log group with a retention policy.</p><p>.. seems way to complex for medium to render it .. well so what, find it here: <a href="https://github.com/wolfpaulus/EN2DE/blob/master/template.yaml">https://github.com/wolfpaulus/EN2DE/blob/master/template.yaml</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*t8EZvFKFntLhqT04.jpg" /></figure><p>After selecting the profile (e.g. edu) and region (e.g. us-west-2) in the AWS Explorer panel, I just right-click the template.yaml file and select the last menu-item: <em>Deploy Serverless Application.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*3paQprTL829PMfrL.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*V74aYNW64roNVLuL.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*6WG7Rjz5YL7oIwii.jpg" /></figure><p>Finally, I create a Run-Configuration in PyCharm, which allows me to execute the remote lambda function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*tJRkqN6oeeLjN9mI.jpg" /></figure><p>Which returns the following result:</p><pre>Invoking Lambda function: EN2DE<br>Logs: <br>START RequestId: c227fde4-25eb-4ec8-ac68-df87fd2ddbfc Version: $LATEST<br>[INFO]	2020-11-03T21:35:33.303Z	c227fde4-25eb-4ec8-ac68-df87fd2ddbfc	{&#39;text&#39;: &#39;Hello, how are you today?&#39;}<br>[INFO]	2020-11-03T21:35:33.328Z	c227fde4-25eb-4ec8-ac68-df87fd2ddbfc	Found credentials in environment variables.<br>END RequestId: c227fde4-25eb-4ec8-ac68-df87fd2ddbfc<br>REPORT RequestId: c227fde4-25eb-4ec8-ac68-df87fd2ddbfc	Duration: 344.52 ms	Billed Duration: 400 ms	Memory Size: 512 MB	Max Memory Used: 72 MB	Init Duration: 296.76 ms	</pre><pre>Output: <br>{<br>  &quot;TranslatedText&quot;: &quot;Hallo, wie geht&#39;s dir heute?&quot;,<br>  &quot;SourceLanguageCode&quot;: &quot;en&quot;,<br>  &quot;TargetLanguageCode&quot;: &quot;de&quot;,<br>  &quot;ResponseMetadata&quot;: {<br>    &quot;RequestId&quot;: &quot;efac8c3a-c2f7-40d4-8238-904e44d81704&quot;,<br>    &quot;HTTPStatusCode&quot;: 200,<br>    &quot;HTTPHeaders&quot;: {<br>      &quot;x-amzn-requestid&quot;: &quot;efac8c3a-c2f7-40d4-8238-904e44d81704&quot;,<br>      &quot;cache-control&quot;: &quot;no-cache&quot;,<br>      &quot;content-type&quot;: &quot;application/x-amz-json-1.1&quot;,<br>      &quot;content-length&quot;: &quot;101&quot;,<br>      &quot;date&quot;: &quot;Tue, 03 Nov 2020 21:35:32 GMT&quot;<br>    },<br>    &quot;RetryAttempts&quot;: 0<br>  }<br>}</pre><h3>3 One Lambda to rule them all</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/0*MKK3V5U9CMlyALHA.png" /></figure><p><a href="https://github.com/wolfpaulus/one">https://github.com/wolfpaulus/one</a></p><p>Now to the more capable Lambda function, still following the same recipe:</p><ol><li>Create a new project PyCharm, this is named “ONE”</li><li>Create and ./lambda directory with two files: app.py and requirements.txt</li></ol><p>Additionally, I create a ./lambda/ui directory, which contains the webpage the Lambda function will serve when an HTTP GET request is received. While the web page to be served is rather simple, I still want to adhere to the separation of concerns (SoC) design principal and put the style sheet and javascript into separate files.</p><p>Therefore, the header of /ui/index.hml page will look like this:</p><pre>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;title&gt;Speech Synthesizer&lt;/title&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://fonts.googleapis.com/icon?family=Material+Icons&quot;&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;./style.css&quot;/&gt;<br>    &lt;script type=&quot;text/javascript&quot; src=&quot;./script.js&quot;&gt;&lt;/script&gt;<br>&lt;/head&gt;</pre><p>In a user’s web browser, the page will eventually look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*bccnnlTmNhbFUBKF.jpg" /></figure><p>Text can be entered and submitted. The Lambda function will receive the text in an HTTP POST request and synthesize it. The output format (mp3 or wav) can be selected and optionally, the text can also be translated into German before the speech synthesis happens.</p><p>In summary, here is what the Lambda function will do:</p><ol><li>Serve the ./ui/index.hml page (including its resources) when an HTTP GET request for <strong>/ui/index.html</strong> is received</li><li>Process HTTP POST requests, received at <strong>/synthesize</strong></li><li>Call the translate Lambda function <strong><em>EN2DE</em></strong> to translate the text, if the translation into German is requested</li><li>Call the AWS Polly to synthesize text into speech (mp3)</li><li>Store the submitted text in a DynamoDB</li><li>Log events in a cloud watch log group “/aws/lambda/EN2DE” and keep them for 7 days</li><li>Convert the MP3 into WAV using the native FFmpeg executable (built for amd64 Linux kernels 3.2.0)</li><li>Return the base64 encoded binary data to the requesting HTML page for consumption</li></ol><h3>It’s all in the template.yaml</h3><p>Again, yaml files don’t like Medium, or is it the other way around? Find it here: <a href="https://github.com/wolfpaulus/one/blob/master/template.yaml">https://github.com/wolfpaulus/one/blob/master/template.yaml</a></p><p>This template.yaml is a bit more complex than the previous one, so let’s look at some of the declarations is more detail:</p><ul><li>The <strong>API</strong> declaration contains the CORS settings, allowing requests from any origin.</li><li>The declaration of the <strong>DynamoDBTable</strong> will create the table “<em>lambdaOneRequests</em>” with a hash key and a search key</li><li>The <strong>Lambda function</strong> declaration contains, the handler, runtime information, and also all the needed policies, like accessing DynamoDB, Speech Synthesis, accessing the log, or calling a Lambda function.</li><li><strong>Events</strong> declares the request PATH for HTTP GET and POST requests. Moreover, the UpdateSchedule configures that the Lambda function will be called every 5 minutes, which should keep it warm, i.e. remove startup delays.</li><li>The declaration of the <strong>LogsLogGroup</strong> will create the /aws/lambda/ONE log group and retain entries for 7 days.</li><li>The <strong>Output</strong> declaration will expose the function’s ARN and API Gateway URL</li></ul><h4>Project View</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*NczCo2XxdaYfZgp7.jpg" /></figure><h4>1st Deployment</h4><p>Like before, just right-click the template.yaml file and select the last menu-item: <em>Deploy Serverless Application,</em> to get the (re-)deployment started</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kNqgxtY-DMl4YJo6.jpg" /></figure><h4>CloudFormation after deployment</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*XlSg2zWXtZygRrpo.jpg" /></figure><h3>3.1 HTTP GET Requests — Serving HTML, CSS, and Script files</h3><p>In the lambda_handler, the entry point for any request the lambda function receives, I’m looking for either GET or POST requests and branch accordingly. The CORS header, which is repeated in the template yaml file, is important to allow regular REST clients to call the API Gateway as well, in case that is what you want.</p><pre>status_code, content_type, content = get(event[&#39;path&#39;]) if &#39;GET&#39; == event[&#39;httpMethod&#39;] else post(event)<br>return {<br>    &quot;statusCode&quot;: 200,<br>    &quot;headers&quot;: {<br>        # Cross-Origin Resource Sharing (CORS) allows a server to indicate any other origins than its own,<br>        # from which a browser should permit loading of resources.<br>        &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;,<br>        &#39;Access-Control-Allow-Credentials&#39;: True,<br>        &#39;Access-Control-Allow-Methods&#39;: &#39;OPTIONS,POST,GET&#39;,<br>        &#39;Content-Type&#39;: content_type,<br>    },<br>    &quot;body&quot;: content<br>}</pre><p>If a GET request was received, I’m calling the<strong><em> get() function</em></strong>, which then tries to find the requested text file, or returns <em>index.html</em>instead.</p><pre>if not file_path.startswith(&#39;/ui/&#39;):<br>    file_path = &#39;/ui/index.html&#39;<br>if file_path.endswith(&#39;.css&#39;):<br>    content_type = &#39;text/css; charset=UTF-8&#39;<br>elif file_path.endswith(&#39;.js&#39;):<br>    content_type = &#39;text/javascript; charset=UTF-8&#39;<br>else:<br>    content_type = &#39;text/html; charset=UTF-8&#39;<br>    file_path = &#39;/ui/index.html&#39;<br>try:<br>    with open(&#39;.&#39; + file_path, &#39;r&#39;) as file:<br>        content = file.read()<br>except:<br>    content_type = &#39;text/html; charset=UTF-8&#39;<br>    content = file_path</pre><h3>3.2 Processing HTTP POST requests</h3><p>In the <strong><em>post() function</em></strong>, depending on the requested audio format, the content_type is set and the speech synthesis is requested.</p><pre>content_type = &quot;audio/wav&quot; if params[&#39;format&#39;] == &#39;wav&#39; else &#39;audio/mpeg&#39;<br>content = synthesize(params[&#39;text&#39;], params[&#39;translate&#39;], params[&#39;format&#39;])<br>return 200, content_type, json.dumps({&quot;b64&quot;: content})</pre><h3>3.3 Calling other Lambda Functions</h3><p><a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/index.html">Boto</a> is the Amazon Web Services (AWS) SDK for Python and in the <strong><em>polly.to_german() function</em></strong>, I’m calling the above mentioned EN2DE lambda function, using the boto3 provides the client, which is called with 3 parameters: <em>function-name</em>, <em>invocation-type</em> (in the case RequestResponse .. we’ll wait for the response) and the <em>payload</em>, i.e. the English text.</p><pre>def to_german(english: str) -&gt; str:<br>    &quot;&quot;&quot;<br>    Calling our translate lambda function<br>    doc: <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html">https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html</a><br>    &quot;&quot;&quot;<br>    response_from_lambda = client(&#39;lambda&#39;).invoke(<br>        FunctionName=&#39;EN2DE&#39;,<br>        InvocationType=&#39;RequestResponse&#39;,<br>        Payload=bytes(json.dumps({&#39;text&#39;: english}), encoding=&#39;utf8&#39;)<br>    )<br>    response = json.load(response_from_lambda[&#39;Payload&#39;])<br>    return response.get(&#39;TranslatedText&#39;)</pre><h3>3.4 Calling AWS Polly</h3><p>Once again, the boto3 library’s client is used: polly_client = boto3.client(&#39;polly&#39;), and based on the requested language (English or German) a different voice is requested:</p><pre>response = polly_client.synthesize_speech(Engine=&quot;standard&quot; if translate else &quot;neural&quot;,<br>                                          VoiceId=&quot;Vicki&quot; if translate else &quot;Joanna&quot;,  # or Marlene or Hans<br>                                          OutputFormat=&quot;mp3&quot;,<br>                                          Text=text,<br>                                          TextType=&quot;ssml&quot;)</pre><p>The response contains the mp3 data, which needs to be base64 encoded, to be able to travel inside JSON documents, all the way to the requesting Web browser:</p><pre>return base64.b64encode( response[&quot;AudioStream&quot;].read() ).decode(&quot;utf-8&quot;)</pre><h3>3.5 Store requests in a DynamoDB</h3><p>This time it’s the boto3 library’s resource that is used to connect to an AWS Service, namely DynamoDB.</p><pre>from boto3 import resource<br>cls.dynamodb = resource(&quot;dynamodb&quot;)<br>cls.table = cls.dynamodb.Table(&quot;lambdaOneRequests&quot;)</pre><p>The RequestDB class in dynamo.py shows how new records get created, and the text and hashed IP address get stored. Here I’m using the <a href="https://github.com/Arattian/DynamoDb-GUI-Client">Dynamo DB GUI client</a> to take a quick look at the table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*DkJTh2oli_gxB_TX.jpg" /></figure><h3>3.6 Log events in a cloud watch log group</h3><p>Using Python’s <a href="https://docs.python.org/3/library/logging.html">logger</a>, writing entries into a cloys watch log group could not be any easier.</p><pre>import logging</pre><pre>logger = logging.getLogger(__name__)<br>logger.setLevel(logging.INFO)<br>..</pre><pre>logger.info(...)</pre><p>Conveniently, PyCharm provides access to AWS resources, including the log groups, without having to leave the IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*pH0D0MCjPVMr7iLy.jpg" /></figure><h3>3.7 Convert the MP3 into WAV</h3><p>FFmpeg is the leading multimedia framework, able to decode, encode, or transcode media files. I’m using it here for the rather mundane task, converting mp3 encoded media into wav. I could have requested a wav encoded synthesis from AWS Polly, but using <a href="https://ffmpeg.org/">FFmpeg</a> allows me to show how native Linux executables can easily be packaged with a Lambda function.</p><p>Since the Firecracker microVM only supports Intel x86_64 and AMD x86_64 CPUs, we know the hardware platform. Packaging of native binaries with their dependencies is explained <a href="https://aws.amazon.com/premiumsupport/knowledge-center/lambda-linux-binary-package/">here</a>, but using a static build (a binary with all the libs included inside the binary itself) is even easier <a href="https://github.com/polaco1782/linux-static-binaries">if you can find one</a>. Fortunately, John van Sickle regularly provides <a href="https://johnvansickle.com/ffmpeg/">static builds for FFmpeg</a>.</p><p>After downloading and extracting the latest <em>ffmpeg-git-amd64-static.tar.xz</em> archive, I copy the ffmpeg binary into the project’s lambda directory (adding 75 MB). However, to use it within the AWS Lambda environment, it needs to be moved into the /tmp directory and also made executable. Therefore, the Python file that contains the lambda_handler also contains these instructions:</p><pre>from os import chmod<br>from shutil import copyfile</pre><pre>copyfile(&quot;./ffmpeg&quot;, &#39;/tmp/ffmpeg&#39;)<br>chmod(&quot;/tmp/ffmpeg&quot;, 755)</pre><p>after that is done, I can call it to convert mp3 content stored in an <em>mp3_data</em> variable like so:</p><pre>wav_data = <br>subprocess.Popen([&quot;/tmp/ffmpeg&quot;, &quot;-i&quot;, &quot;pipe:0&quot;, &quot;-f&quot;, &quot;wav&quot;, &quot;pipe:1&quot;], shell=False, stdout=subprocess.PIPE,<br>stdin=subprocess.PIPE, stderr=subprocess.PIPE).communicate(mp3_data)[0]</pre><h3>Summary</h3><p>PyCharm has a simple REST client builtin that can be used to quickly see the Lambda function working:<br>Right-click the project and select <strong>New</strong> and then <strong>HTTP Request </strong>.. enter something like this:</p><pre>POST <a href="https://le95wslzi8.execute-api.us-west-2.amazonaws.com/Prod/synthesize">https://le95wslzi8.execute-api.us-west-2.amazonaws.com/Prod/synthesize</a><br>Content-Type: application/json<br>{<br>  &quot;scope&quot; : &quot;awscd&quot;,<br>  &quot;text&quot; : &quot;Hello Tom&quot;,<br>  &quot;translate&quot;: &quot;False&quot;,<br>  &quot;format&quot; : &quot;mp3&quot;<br>}</pre><p>Right-click the text and select <strong>Run</strong> and see the result.</p><pre>POST <a href="https://le95wslzi8.execute-api.us-west-2.amazonaws.com/Prod/synthesize">https://le95wslzi8.execute-api.us-west-2.amazonaws.com/Prod/synthesize</a></pre><pre>HTTP/1.1 200 OK<br>Content-Type: audio/mpeg<br>Content-Length: 8015<br>Connection: keep-alive<br>Date: Tue, 10 Nov 2020 22:47:49 GMT<br>x-amzn-RequestId: dde1e43f-8db8-4832-a2b7-81001ed222dc<br>Access-Control-Allow-Origin: *<br>x-amz-apigw-id: V0DHKExVPHcFsnQ=<br>Access-Control-Allow-Methods: OPTIONS,POST,GET<br>X-Amzn-Trace-Id: Root=1-5fab1894-41804fcf5874364b7f71a62d;Sampled=0<br>Access-Control-Allow-Credentials: true<br>X-Cache: Miss from cloudfront<br>Via: 1.1 abfc920f60e32b50b36ecc54c5a19cf4.cloudfront.net (CloudFront)<br>X-Amz-Cf-Pop: PHX50-C1<br>X-Amz-Cf-Id: 1q4b-F2pbldyZPXd7n4SoljByAd3mv5GaADXiQ_h0b3W2qJY3uID_g==</pre><pre>{&quot;b64&quot;: &quot;SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjQ1LjEwMAAAAAAAAAAAAAAA//NgxAAdSPooAGPMCAAw/FY/y6Hg/snDrZ2MBhYDAYWTAAACDCBAgCBBMmDgNOzyacRERERF37u7u4iIiIQcD58HwfBAEDhQEwfB8Hx4IAgcEEnLh9SjgYEfunLvBAAAgCAJg/ioYUCEEwfD5eCAIAgGMMdQIBAEz4Pyfog/D+n+t6oOREqCWVjEjrooHl15ZfhO/HAdCuB8/HMG//NixBkfub5tRmJFSOW4EpbQgBB1A+uWg3Rkg3HAGgAgBBEFZGHRY2/uTpAxcsbq21HIDF7OaNucCAkxcVjAYdDPCAAhvU9/o1GQwhXqv4kBAuD+s</pre><p>All done, we did what we wanted to do: use an AWS Lambda to serve a simple web page and process its HTTP POST requests. PyCharm has a simple REST client builtin that can be used to quickly see the Lambda function working:</p><p>Along the way, we called another lambda, called AWS Polly, stored some data in a DynamoDB, logged events in a cloud watch log-group, and used the native FFmpeg executable to convert an mp3 into wav media file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=796adb0d3eb4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Frictionless Speed]]></title>
            <link>https://medium.com/chat-bots/frictionless-speed-68e18b1a2ae0?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/68e18b1a2ae0</guid>
            <category><![CDATA[vui]]></category>
            <category><![CDATA[vui-design]]></category>
            <category><![CDATA[frictionless]]></category>
            <category><![CDATA[alexa]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Mon, 27 Apr 2020 18:40:34 GMT</pubDate>
            <atom:updated>2020-04-28T02:25:33.131Z</atom:updated>
            <content:encoded><![CDATA[<h4>Zero Intent Skills</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O6F4VNqZa67ntoVy_Ypm4Q.jpeg" /><figcaption><em>Bobsleigh teams race to complete a downhill route in the fastest times. An aggregate time from several runs is used to determine the winners. </em><a href="https://commons.wikimedia.org/wiki/File:US_4Mensbobsled_2002_Winter_Olympics.jpg">Photo Credit</a></figcaption></figure><p>Teams had taken four runs down the 1,450 meter (almost 1 mile) long track, made of reinforced concrete, covered in ice. Still, their combined times were separated by less than a blink of an eye. The ice on the track varied, the colder and harder, the faster the sleds would go. A sled’s metal blades that touch the ice were coated and polished to minimize friction. At the start of each run however, athletes first had to overcome static friction to move and accelerate the sled, weighing between 170 kg and 210 kg (375–463 lbs).</p><p><strong><em>Alexa,</em></strong><em> who won Bobsleigh at the 2010 Winter Olympics in Vancouver, Canada?</em></p><p>Excuse the pun but it’s those effortless requests that Alexa performs without any friction that make this voice user experience so delightful. Here are some of my favorites:</p><p><strong>Me</strong>: <em>Alexa, play my favorite songs</em></p><p><strong>Alexa</strong>: <em>Your liked songs from Wolf’s Spotify</em> [.. music starts playing.]</p><p><strong>Me</strong>: <em>Alexa, set a timer for ten minutes.</em></p><p>[music fades ..] <strong>Alexa</strong>: <em>Ten minutes, starting now</em> [.. music volume increases to previous level]</p><p><strong>Me</strong>: <em>Alexa, what’s the weather this afternoon.</em></p><p>[music fades ..] <strong>Alexa</strong>: <em>This afternoon, you can look for clear skies and sun, with temperatures around 59 degrees Fahrenheit.</em> [.. music volume increases to previous level]</p><p>Admittedly, not everything happens this smoothly on the Alexa, especially when 3rd party skills get invoked. American Express for instance has a skill that can be invoked with ‘Amex’ a nickname term for the popular credit card.</p><p><strong>Me</strong>: <em>Alexa, open Amex</em></p><p><strong>Alexa</strong>:<em> Welcome back, to get started please say the four digit pin you set up when enabling this skill.</em></p><p><strong>Me</strong>: 9 3 4 7</p><p><strong>Alexa</strong>: <em>Great you are all set. You can say things like</em></p><ul><li><em>check my membership rewards balance</em></li><li><em>when is my payment due date</em></li><li><em>or make a payment</em></li></ul><p><em>what would you like to do?</em></p><p>Amex is one of the <a href="https://www.tomsguide.com/round-up/best-alexa-skills">best</a> Alexa Skills but still reminds of the despised IVR systems (Interactive voice response, a technology that allows a computer to interact with humans through the use of voice and DTMF tones input via a keypad). Just like pressing 0 multiple times sometimes offered a shortcut with IVRs, experienced users know this new shortcut:</p><p><strong>Me</strong>: <em>Alexa, ask Amex for my account balance:</em></p><p><strong>Alexa</strong>: <em>Welcome back, to get started please say the four digit pin you set up when enabling this skill.</em></p><p><strong>Me</strong>: 9 3 4 7</p><p><strong>Alexa</strong>: <em>Great you are all set. Your remaining statement balance for your blue cash preferred is zero dollars and your total balance is 779 dollars and 90 cents. What would you like to do next?</em></p><p>Invoking a 3rd party skill on the Alexa requires the <strong>wake-up word</strong> (Alexa) followed by one or more <strong>invocation words</strong> (Amex) that identify the skill. The 3rd party skill will then take over, most likely, greeting me and relaying some ideas about how to proceed.</p><p>After a while, once I have memorized some options, it’s more efficient to say the wake-up word, invocation word, and intent all in one longer sentence, like “<strong><em>Alexa</em></strong><em>, ask </em><strong><em>Amex</em></strong><em> for my </em><strong><em>account balance</em></strong><em>.” </em>Still, this all is far from the smooth and frictionless experience mentioned above. Feels like someone put sand on an icy bobsled track.</p><h3>Zero Intent Skills</h3><p>Reducing the number of actions required to complete a task, is one of <a href="https://xd.adobe.com/ideas/process/ui-design/4-golden-rules-ui-design/">the 4 Golden Rules of UI Design</a>, sometimes we call this <em>“speed to benefit”</em>, and this rule seems to apply to VUI (voice user interfaces) even more.</p><p>I think it’s the absence of an invocation word and a succinct objective that makes communication with Alexa enjoyable, like demonstrated above:</p><ul><li><em>Alexa, play my favorite songs</em></li><li><em>Alexa, set a timer for ten minutes</em></li><li><em>Alexa, what’s the weather</em></li></ul><p>However, during the development and declaration of a 3rd party Alexa Skill, a two-word invocation needs to be provided (don’t know how American Express got away with just one). Imagine we would use ‘account balance’ for the invocation of a custom skill.</p><p>The ‘account balance’ skill is not versatile but very single minded. It just tells the balance of one account. The skill does not declare any custom intents nor entities (aka slots,) which is why I coined it a <strong><em>Zero-Intent Skill</em>.</strong></p><p>Among all my financial accounts, I consider my checking account to be most important. It’s used for direct deposit, credits cards get automatically paid, and also two utilities withdraw automatically, pretty scary, I know.</p><h3>Demo</h3><p><strong>Me</strong>: <em>Alexa, account balance</em></p><p><strong>Alexa</strong>: <em>Let me check .. the balance of your checking account is three thousand one hundred and seven dollars.</em></p><p><a href="https://wolfpaulus.com/wp-content/uploads/2020/04/aab.mp3">👂 Listen to this example</a></p><p>While hearing <em>“Let me check …”</em> the actual query gets executed. For simplicity, I’m looking for the 1st checking account in the dataset. Before sending the result to the speech synthesiser, the skill rounds the amount down. I.e., I won’t hear any cents, all in the interest of smoothness and speed. I also think the amount becomes more memorizable that way. I don’t know of a way to learn about an account balance with less friction or in less than 10 seconds.</p><h3>Privacy</h3><p>I know that some have their Amazon Echo devices in areas where privacy can be an issue and I am well aware of the tension between convenience and speed on one side and privacy and security on the other. The voice pin that the American Express skill has implemented only slightly protects the access to my account, until a “potential attacker” hears me saying it out loud.</p><p>In the current COVID-19 pandemic environment, <a href="https://newsroom.mastercard.com/press-releases/mastercard-enables-higher-contactless-payments-across-canada/">touching surfaces is discouraged</a> and face recognition doesn’t work all that well, when wearing a face mask. All this may work in the favor of voice biometric and my hope is that in a not too distant future, “voice-id” will be as prevalent for authentication as <a href="https://support.apple.com/en-us/HT201371">touch-id</a> and <a href="https://support.apple.com/en-us/HT208108">face-id</a> are today. Just saying <em>“Alexa, Account Balance”</em> would be enough to authenticate me as the owner of my account.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68e18b1a2ae0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chat-bots/frictionless-speed-68e18b1a2ae0">Frictionless Speed</a> was originally published in <a href="https://medium.com/chat-bots">Chatbots Magazine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alicia vs Alexa]]></title>
            <link>https://medium.com/swlh/alicia-vs-alexa-b418fcc0c82e?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b418fcc0c82e</guid>
            <category><![CDATA[intuit]]></category>
            <category><![CDATA[ssml]]></category>
            <category><![CDATA[emotional-prosody]]></category>
            <category><![CDATA[vui-design]]></category>
            <category><![CDATA[vui]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 04:58:12 GMT</pubDate>
            <atom:updated>2020-03-11T00:11:29.775Z</atom:updated>
            <content:encoded><![CDATA[<h4>Hear what you see</h4><h4>Democratizing the creation of delightful audible content</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iZwLXhc8yB2suPl_gJGrww.jpeg" /><figcaption>Alicia Keys, honoured with Amnesty International’s Ambassador of Conscience Award for 2017</figcaption></figure><p>Have you ever heard an <a href="https://youtu.be/h8sbGLwwRgI">interview with Alicia Keys</a>? She spent most of her childhood in Hell’s Kitchen, one of New York City’s toughest neighborhoods. Experiencing how much emotion she’s putting into each word and her very deliberate expressive pronunciation means you cannot just casually listen but have to stay attentively engaged.</p><p>Contrast this with listening to voice assistants. The defining moment for me was when I heard a cheery voice assistant casually report a fatal car accident. Such tone-deaf insensitivity triggered something deep within me. This prompted me to conduct research on a voice assistant’s inappropriate intonation — and ultimately land a coveted speaking slot at the 2014 Mobile Voice Conference in San Francisco and share my <a href="https://wolfpaulus.com/talks/#emotionalprosody">findings</a>.</p><p>I work in <a href="https://www.intuit.com/blog/tag/technology/">Intuit</a>’s Technology Futures group, accelerating the discovery and adoption of emerging technologies. Far beyond voice and conversational user interfaces, speech recognition and synthesis, and natural language understanding, I currently explore how to detect bias and how to automate empathy using sentiment analysis, speech synthesis, and empathetic dialogue design to match customers’ emotions to provide best-in-class experiences.</p><h3>Speech Synthesis Markup Language</h3><p>Today’s speech synthesis is much more natural sounding. Ironically, while progressing from extremely robotic to almost indiscernibly human, speech synthesis didn’t travel through the <a href="https://en.wikipedia.org/wiki/Uncanny_valley">uncanny valley</a>. Although, one <a href="https://www.researchgate.net/publication/268207867_Speech_Synthesis_and_Uncanny_Valley">research paper</a> suggests the speculative hypothesis that users’ positive attitude towards new technologies supersede their primary affinity towards an artificial conversation partner.</p><h4>Emphasizing in SSML</h4><p><a href="https://www.w3.org/TR/speech-synthesis11/">SSML</a>, the speech synthesis markup language, makes synthesis highly customizable. Just like I would use a <strong><em>bold</em></strong> or <strong><em>strong</em></strong> tag to emphasize a word when writing an HTML document, I can use SSML’s <strong><em>emphasis</em></strong> tag when creating an SSML document.</p><p>Let me apply this concept, emphasizing the word ‘lazy’, in this well-known alphabetic <a href="https://en.wikipedia.org/wiki/Pangram"><strong>pangram</strong></a>, “A quick brown fox jumps over the lazy dog.” If I had to speak this sentence, I would probably also say the word “quick”, a little faster, just to play up the fox’s agility. SSML supports that too, by allowing me to adjust the speech rate, which is an attribute of the <strong><em>prosody</em></strong> tag.</p><p>Here is how we would synthesize this sentence twice, first without, and then with the modifications:</p><pre>&lt;?xml version=&quot;1.0&quot;?&gt;<br>&lt;speak version=&quot;1.1&quot; xml:lang=&quot;en-US&quot;&gt;<br>&lt;p&gt;The quick brown fox jumps over the lazy dog.&lt;/p&gt;<br>&lt;p&gt;The &lt;prosody rate=&quot;fast&quot;&gt;quick&lt;/prosody&gt; brown fox jumps over the &lt;emphasis level=&quot;moderate&quot;&gt;lazy&lt;/emphasis&gt; dog.&lt;/p&gt;<br>&lt;/speak&gt;</pre><p>👂 <a href="https://wolfpaulus.com/wp-content/uploads/2020/03/eddy1.mp3">Listen to the synthesized speech</a></p><p>The next example uses a <a href="https://www.liquisearch.com/list_of_pangrams/english_phonetic_pangrams"><strong>phonetic pangram</strong></a> and introduces another prosody attribute, to raise or lower the tone (pitch), allowing the very young “Justin” voice, subtly making fun of the French queen.</p><pre>&lt;?xml version=&quot;1.0&quot;?&gt;<br>&lt;speak version=&quot;1.1&quot; xml:lang=&quot;en-US&quot;&gt;<br>&lt;p&gt;The beige hue on the waters of the loch impressed all, including the &lt;prosody pitch=&quot;high&quot;&gt;French queen&lt;/prosody&gt;, before she heard that symphony again, just as young Arthur wanted.&lt;/p&gt;<br>&lt;/speak&gt;</pre><p>👂 <a href="https://wolfpaulus.com/wp-content/uploads/2020/03/eddy2.mp3">Listen to the synthesized speech</a></p><h4>Emotional Prosody</h4><p>If I listen to someone saying something very sad, I notice how their voice expresses profound sorrow. The speech rate slows down, the volume softens, and the pitch deepens, particularly towards the end of the sentence.</p><p>SSML amplifies these expressions rather well.</p><pre>&lt;?xml version=&quot;1.0&quot;?&gt;<br>&lt;speak version=&quot;1.1&quot; xml:lang=&quot;en-US&quot;&gt;<br>&lt;p&gt;&lt;prosody rate=&quot;fast&quot;&gt;Despite everyone&#39;s recent &lt;emphasis level=&quot;moderate&quot;&gt;efforts&lt;/emphasis&gt;,&lt;/prosody&gt; this is very sad news for the workforce and&lt;prosody volume=&quot;soft&quot; pitch=&quot;low&quot; rate=&quot;slow&quot;&gt; their families.&lt;/prosody&gt;&lt;/p&gt;<br>&lt;/speak&gt;</pre><p>This time I used the synthesizer’s “Joey” voice and utilize the <strong><em>prosody</em></strong> attributes for <strong><em>rate</em></strong>, <strong><em>volume</em></strong>, and <strong><em>pitch</em></strong>:</p><p>👂 <a href="https://wolfpaulus.com/wp-content/uploads/2020/03/eddy.mp3">Listen to the synthesized speech</a></p><p>SSML offers much more. The <strong><em>say-as</em></strong> tag’s <strong><em>interpret-as</em></strong> attribute, for instance, can provide additional context. &lt;say-as interpret-as=”address”&gt;Acacia Dr.&lt;/say-as&gt; would result in the synthesis of the expanded name: <em>“Acacia Drive”</em>. &lt;say-as interpret-as=”characters”&gt;fox&lt;/say-as&gt;would spell out each character: “ F O X ”, while &lt;say-as interpret-as=”ordinal”&gt;23&lt;/say-as&gt; would be synthesized as “twenty-third”.</p><p>SSML is an XML-based markup language and SSML documents have a hierarchical tree structure. All elements in an SSML document can contain sub-elements, text, and attributes. The boundaries of elements are delimited by start-tags and end-tags. However, not all elements are allowed to be nested. For instance, the <em>emphasis</em> element may contain a <em>say-as</em> element, but not the way around. While there is a related standard, <a href="https://www.w3.org/TR/emotionml/">EmotionML</a>, the SSML standard does not support the encoding of emotions directly. Instead, some speech synthesis service providers now extend SSML with their own proprietary tags, like IBM’s <a href="https://cloud.ibm.com/docs/services/text-to-speech?topic=text-to-speech-expressive">‘expressive ssml</a>’.</p><p>Experimenting with SSML and putting SSML tags into content can be a fun but also cumbersome and error-prone process.</p><h3>Firing up the Wayback Machine</h3><p>WYSIWYG — <em>what you see is what you get — </em>At the beginning of the 1990s, writers could see for the first time what their copy would look like while writing it. I was there, and saw what it meant to content creators — this was truly a BIG deal. The presentation of the word I wanted to emphasize looked bold on the screen, exactly like it would look later on paper when printed.</p><p>Moving on, 30 years later, I spend way less time reading, and instead scan Instagram and YouTube, and listen to Amazon Echo and Google Home devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IGvt9tGmUXnD1ASjT_0M-w.jpeg" /></figure><h4>WYSIWYG for Speech Synthesis</h4><p>Writing copy for audible (rather than visual) consumption is likely to come with a new set of requirements. Hearing the content auralized or audiated (I think we still struggle to agree on an equivalent adjective for visualize) will certainly help content creators during the creation process and ultimately benefit listeners.</p><p>I believe that frequently listening to my content while writing it is crucial, but I also think additional visual cues could help other content creators and speed up the process. Here are some ideas for how speech synthesis attributes could be mapped to visual styles:</p><ul><li>Emphasis → font-weight, the heavier the font, the more emphasis is placed on the word.</li><li>Volume → font-size, the larger the font size, the louder the word is spoken.</li><li>Speech Rate → letter-spacing, the more a word is spaced out, the slower the word is spoken.</li><li>Pitch → color, as suggested in Nicholas Melendez’s<a href="https://www.flutopedia.com/img/ColorOfSound_Nextdrum_lg.jpg"> Color of Sound Chart</a></li></ul><p>With emphasis and the major prosody attributes mapped to <a href="https://www.w3.org/Style/CSS/">CSS</a> types, it’s a straightforward task to remove the need for XML tags and instead use a visual editor. Adding an eraser and a playback button and we are getting close to an HWYS (Hear What You See) editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GZNeLKaUJz4EU7KtSrQJhA.png" /></figure><h3>Code ≠ Content</h3><p>Writing clean, error-free code and writing engaging and emphatic content are two important skills; not everyone masters such skills equally, if at all.</p><p>I think in some small way, WYSIWYG editors democratized content writing and readers benefited by reading nicely-formatted, laid out content from a broader group of authors.</p><p>If we want to broaden the group of authors capable of creating delightful audible content, this will require easy-to-use tools. I think removing the need to write XML tags and assisting the generation of synthetic speech visually, is a good first step.</p><h3>Demo</h3><p>📺 Watch a 50 second demo</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F395599608%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F395599608&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F861951676_640.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="640" height="320" frameborder="0" scrolling="no"><a href="https://medium.com/media/07a875ffeb7ef9c4dc0e8a33c8c2affc/href">https://medium.com/media/07a875ffeb7ef9c4dc0e8a33c8c2affc/href</a></iframe><h3>Try it out</h3><p>🚀 <a href="http://bit.ly/ssmled01">http://bit.ly/ssmled01</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b418fcc0c82e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/alicia-vs-alexa-b418fcc0c82e">Alicia vs Alexa</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Universal Voice Browser]]></title>
            <link>https://medium.com/chat-bots/a-universal-voice-browser-13e879864ce8?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/13e879864ce8</guid>
            <category><![CDATA[vui]]></category>
            <category><![CDATA[amazon-echo]]></category>
            <category><![CDATA[technological-shift]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Mon, 30 Sep 2019 16:55:57 GMT</pubDate>
            <atom:updated>2019-09-30T16:58:48.709Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W6dl0c4nRqlXRuiS6VlVnA.jpeg" /></figure><p>On September 25, Amazon released 80 new devices, some of which can be found <a href="https://www.amazon.com/Amazon-Echo-And-Alexa-Devices/b?ie=UTF8&amp;node=9818047011">here</a>. Even for a company of its size, that is an impressive number and an even more impressive line-up. However, I think something much more profound happened a day earlier. On Tuesday, September 24, 2019, at 11:04 AM EDT, in a simple <a href="https://press.aboutamazon.com/news-releases/news-release-details/amazon-and-leading-technology-companies-announce-voice/">press release</a>, Amazon announced the <strong>Voice Interoperability Initiative</strong>.</p><p>Its goal is to ensure that voice services work seamlessly alongside one another on a single device. More specifically, voice-enabled products should be designed to support multiple simultaneous wake words. More than 30 companies already supporting this effort, including Amazon, Baidu, BMW, Bose, Harman, Logitech, Microsoft, Salesforce, Sonos, Sony, Spotify, Orange, Verizon, Intel, NXP, and Qualcomm.</p><p>I think Marc Benioff, Chairman and co-CEO at Salesforce, which has its own <strong>Einstein Voice</strong> Assistant, understood and verbalized the significance of this moment best, when he said:</p><blockquote><strong>“We’re in the midst of an incredible technological shift, in which voice and AI are completely transforming the customer experience.”</strong></blockquote><blockquote><em>Marc Benioff, Chairman and co-CEO at Salesforce</em></blockquote><p>I have often compared the current proprietary smart speaker/voice assistant market, with the time and market before the Web Browser. I.e., to me, Google Home, Amazon Echo, and Apple Home Pod, look a lot like CompuServe, AOL, and MSN did.<br>Considering the goals of the <strong>Voice Interoperability Initiative </strong>and its supporters, I think it’s fair to ask, how much closer to something comparable to a Web browser, did we just get?</p><h3>What came after CompuServe, AOL, and MSN?</h3><p>CompuServe, AOL, and MSN unsuccessfully tried to remain gatekeepers while also integrating the Web. Instead, users switched to independent Internet Service Providers (ISP), accessed the internet directly, and used sites like Yahoo.com as homepages so-called portals, which were customizable with relevant links (bookmarks) and content feeds.<br>Adding a skill to your Alexa profile is somewhat comparable to that. Saying <em>“Alexa”</em> is like opening Yahoo.com, saying <em>“open Spotify”</em> is like clicking on a bookmark, or saying <em>“what is my news brief”</em> can be compared to reading your pre-configured news items on a portal page.</p><h3>What is going to change?</h3><p>What the <strong>Voice Interoperability Initiative </strong>proposes is that devices like the Amazon Echo, will not only wake up when you say <em>“Alexa”</em> but also on many other (branded) words. I suppose you will have to actively enable the other wake-words. Those wake words will now allow you to communicate <strong>directly</strong> with the selected voice assistant.</p><h4>Example</h4><p>Instead of saying the propriety wake word(s) like <em>“Alexa”</em>, or <em>“Okay Google”</em>, followed by the invocation word (brand, name of the skill), followed by hearing a greeting, and finally saying the intent. You will be able to just speak the brand-name directly followed by your intent. E.g. <em>“Spotify play Cruel Summer by Taylor Swift.”</em></p><h3>What does this mean?</h3><p>Wake word recognition is implemented in hardware/firmware, meaning happening directly on the device and <strong>not</strong> performed on a remote server that received a recording of your voice over the Internet. The list of recognizable wake words is limited and most likely not instantaneously be updatable. <br>To draw another analogy to the Web, I think of wake words like domain names and the rush for getting popular wake-words registered and into the on-device recognizers will probably not be unlike the gold-rush for domain names.<br>The fight between companies that joined the <strong>Voice Interoperability Initiative </strong>and those outside (Apple, Google, and Samsung) will be the browser wars all over again.</p><p>When <strong>Siri</strong> was integrated into iPhone 4S at its <strong>release</strong> in October 2011, most of us knew that <em>Voice</em> was going to be a long game, like running a Marathon. With last week’s announcement of the <strong>Voice Interoperability Initiative</strong>, we suddenly seem a lot closer to the finish line.<br>With Voice-Biometrics already working pretty well for Speaker-Identification, Speaker-Authentication seems just around the corner. I.e., there are no more corners, the rest of the race is more like the New York City 5th Avenue Mile race, which takes runners down 20 blocks in one straight line of one of Manhattan’s most well-known streets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*v9dKwR1to5fKKB6hVOp3vA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13e879864ce8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chat-bots/a-universal-voice-browser-13e879864ce8">A Universal Voice Browser</a> was originally published in <a href="https://medium.com/chat-bots">Chatbots Magazine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From the Docks to the Gate]]></title>
            <link>https://medium.com/swlh/from-the-docks-to-the-gate-9e1792cc50fe?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e1792cc50fe</guid>
            <category><![CDATA[aws-ecr]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-fargate]]></category>
            <category><![CDATA[aws-ecs]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Thu, 12 Sep 2019 23:13:29 GMT</pubDate>
            <atom:updated>2019-09-16T22:00:24.723Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>This is a story about a simple web-service that answers only one question: if a given number is prime. The core problem is first solved with a Java class, which is then wrapped into a WebServlet and tested within a web server environment. The web server, however, does not get directly installed, but a docker image is created, containing all the mentioned components. Eventually, once sufficiently tested, the docker container is pushed into a container registry, from which it is deployed and run. The simple service is finally made public and available to the world, scalable, all without having to manage servers or clusters.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-k80jHQq6xty3mWPh35GQ.jpeg" /></figure><h3>1. Into the Elastic Container Registry we go ..</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*r1neBawtijlRmxEBY_XhZw.png" /></figure><p>My focus is not so much on Web-Services nor <a href="https://www.docker.com/">Docker</a>, still, as a starting point, we want to create a simple Web-Service, implemented in Java and made <a href="https://tomcat.apache.org/">available</a> via Tomcat, (a pure Java HTTP web server environment in which Java code can run.) This web server will then be put into a docker container and stored at the Amazon Elastic Container Registry (ECR), a private, but fully-managed container registry that makes it easy for developers to store, manage, and deploy Docker container images.</p><p>Steps to create a docker container image and store it in ECR include:</p><ol><li>Install Docker and create a Docker Account</li><li>Install the AWS and ECS Command Line Clients</li><li>Create an AWS account</li><li>Write the Web-Service Java-Code</li><li>Create a Docker Image</li><li>Push the Image into ECR</li></ol><h4>1.1. Installing Docker</h4><p>There are many good introductions into Docker available. All explaining the install process and how to get started:</p><ul><li><a href="https://www.freecodecamp.org/news/a-beginner-friendly-introduction-to-containers-vms-and-docker-79a9e3e119b/">A Beginner-Friendly Introduction to Containers, VMs and Docker</a></li><li><a href="https://medium.com/@kelvin_sp/docker-introduction-what-you-need-to-know-to-start-creating-containers-8ffaf064930a">Docker Introduction — What You Need To Know To Start Creating Containers</a></li><li><a href="https://docker-curriculum.com/">Docker for beginners</a></li><li><a href="https://docs.docker.com/">Docker Documentation</a></li></ul><p>Before moving on, make sure you have the needed tools installed, like so:</p><pre>docker --version <br>Docker version 19.03.1, build 74b1e89 </pre><pre>docker-compose --version <br>docker-compose version 1.24.1, build 4667896b</pre><h4>1.2. Installing the AWS and ECS Command Line Client</h4><p>Installing the AWS Command Line Client allows for quick and repeatable execution of tasks that you may otherwise do in AWS Web-UI. How to install the aws-cli depends on the operating system that is installed on your computer, but is explained in much detail over <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html">here</a>. If you are using Mac OS and have <a href="https://brew.sh/">HomeBrew</a>, the free and open-source software package management system installed, then there is an even easier way: <br><em>brew install awscli</em></p><p>As the result of this step, entering aws — version in terminal / command shell, should show something like this:</p><pre>aws --version <br>aws-cli/1.16.220 Python/3.7.4 Darwin/18.7.0 botocore/1.12.210</pre><p>We will also need the ECS Command Line Client. Again, how to install it depends on your operating system, but is explained in much detail over <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI_installation.html">here</a>. If you are using Mac OS and have HomeBrew, then there is an easier way:<br><em>brew install amazon-ecs-cli</em></p><pre>ecs-cli --version <br>ecs-cli version 1.15.1 (*UNKNOWN)</pre><h4>1.3. Creating an AWS account / or login if you already have one</h4><p>To use Amazon Web Services, you will need an AWS account, which can be created <a href="https://aws.amazon.com/">here</a>. If you already have an account, login using the “AWS Management Console” link in the <em>My Account</em>menu or use your company’s single sign-on solution.</p><h4>Create an IAM User</h4><p>Create an IAM User in your AWS Account / or skip, if you already have one that you want to use. Follow the steps here: <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_console">Creating IAM Users (Console)</a></p><p>E.g.:</p><ul><li>I used ‘<strong><em>edu_usr</em></strong>’ for the username</li><li>selected ONLY Programmatic access</li><li>created a group ‘<strong><em>edu_grp</em></strong>’</li><li>selected ‘<em>PowerUserAccess</em>’, and also ‘<em>IAMFullAccess</em>’ for a policy</li><li>clicked ‘Create group’</li><li>did not add any tags</li><li>clicked on “Create user’</li></ul><p>It’s important to download the csv file, which contains the access id and key, which the awscli will need going forward.</p><p>The <em>aws configure </em>command collects the id, key, region, and profile name from you and then creates the hidden ~/.aws directory and in there text-files with the names <strong><em>credentials </em></strong>and <strong><em>config</em></strong></p><h4>1.4. Writing the Web-Service Code</h4><p>Here is project that contains a simple Java class (Prime.java), which provides a static boolean method, returning <em>true</em>if a given number is prime.</p><pre>static boolean isPrime(final long n)</pre><p>The projects contains a second class (PrimeService.java), which wraps the aforementioned function into a web-service:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66233d9c602b502536ece941a5ada80e/href">https://medium.com/media/66233d9c602b502536ece941a5ada80e/href</a></iframe><h4>1.5. Creating a Docker Image</h4><pre># Simple Tomcat container with a custom war deployed<br>FROM tomcat:9.0.24-jdk11-openjdk-slim<br>MAINTAINER Wolf Paulus &lt;wolf@paulus.com&gt;<br>#re-configure tomcat<br>COPY conf/server.xml /usr/local/tomcat/conf<br><br># remove default webapps and deploy webapp<br>RUN rm -rf /usr/local/tomcat/webapps/*<br>COPY build/libs/ROOT.war /usr/local/tomcat/webapps<br>EXPOSE 80<br>CMD [&quot;/usr/local/tomcat/bin/catalina.sh&quot;, &quot;run&quot;]</pre><p><em>Dockerfile</em>: The container will be based on Tomcat 9.0.24 running on Java 11 openSDK. All default WEB apps are removed and a new ROOT.war is placed into the web container’s web-apps directory. Replacing the server.xml file, allows us to reconfigure Tomcat, to host the content on port 80 instead of the default port 8080. Finally, port 80 gets exposed and the web container is launched.</p><p>After building the project, which creates the ROOT.war file in ./build/libs, the docker images can be built with this command. docker build -t tomcatprime</p><p><strong>Seeing it running<br></strong>Issuing the docker-compose up -d<strong><em> </em></strong>command will launch the container and with the cool <a href="https://httpie.org/">HTTPie</a> tool installed (or with a web browser too if you like), we can see it working:</p><pre>docker-compose up -d <br>Creating network &quot;prime_default&quot; with the default driver <br>Creating prime ... done </pre><pre>http localhost/isPrime/17 <br>HTTP/1.1 200 <br>Content-Length: 22 Date: Wed, 04 Sep 2019 16:47:05 GMT<br> <br>17 is a prime number.</pre><h4>1.6. Pushing the Image into ECR</h4><p>Before pushing an image into AWS’ Container Registry, a repository needs to be created. This needs to be done only once. After that, an updated image gets pushed into the same repository.</p><h4>Creating a ECR Repository</h4><p>Here is the aws cli command that will create a repo with the name <em>prime_ws</em></p><pre>aws ecr create-repository — repository-name prime_ws — region us-west-2 — profile edu<br></pre><p>The response from this aws command should look something like this:</p><pre>{<br>    &quot;repository&quot;: {<br>        &quot;repositoryArn&quot;: &quot;arn:aws:ecr:us-west-2:17...&quot;,<br>        &quot;registryId&quot;: &quot;178....&quot;,<br>        &quot;repositoryName&quot;: &quot;prime_ws&quot;,<br>        &quot;repositoryUri&quot;: &quot;178.....dkr.ecr.us-west-2.amazonaws.com/prime_ws&quot;,<br>        &quot;createdAt&quot;: 1567436895.0,<br>        &quot;imageTagMutability&quot;: &quot;MUTABLE&quot;<br>    }<br>}</pre><h4>Tagging the Docker Image</h4><p>The image now needs to be tagged with the <strong>repositoryUri</strong>, found in the previous response.</p><pre>docker tag tomcatprime:latest 178....dkr.ecr.us-west-2.amazonaws.com/prime_ws:latest</pre><h4>Pushing the tagged image</h4><p>Finally the image can be pushed into ECR and as explained <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/ECR_AWSCLI.html">here,</a> to allow the docker command to access AWS ECR, it needs to be authenticated.</p><pre>eval $(aws ecr get-login --no-include-email --region us-west-2 --profile edu)<br>docker push 178....dkr.ecr.us-west-2.amazonaws.com/prime_ws:latest</pre><p>Which results in something like this:</p><pre>The push refers to repository [17.....dkr.ecr.us-west-2.amazonaws.com/prime_ws]<br>fa10a7d57c55: Pushed <br>95a3706fd247: Pushed <br>3cd10809670d: Pushed <br>3179f202140d: Pushed <br>cfd3a59028bd: Pushed <br>bbd09c44833e: Pushed <br>15d57950dad3: Pushed <br>2bf534399aca: Pushed <br>1c95c77433e8: Pushed <br>latest: digest: sha256:92707ba45130980539075989c5a63cf2228b4810c7f648a2c14f3ec436740b26 size: 2205</pre><p>Subsequent changes to the code base can now be build and pushed more easily like so:</p><pre>#!/usr/bin/env bash<br>tag_name=latest<br>img_name=tomcatprime<br>repo_uri=178....dkr.ecr.us-west-2.amazonaws.com/prime_ws:$tag_name</pre><pre>gradle clean<br>gradle build<br>docker build -t $img_name .<br>docker tag $img_name:$tag_name repo_uri<br>eval $(aws ecr get-login --no-include-email --region us-west-2 --profile edu)<br>docker push $repo_uri</pre><h3>2. Heading out the Fargate</h3><p>Next, we will implicitly create an Amazon Virtual Private Cloud (Amazon VPC) and use Amazon Elastic Container Service (Amazon ECS) to pull the container we created and pushed into the registry and make the service publicly available.</p><h4>2.1. Creating the Task-execution Role and an empty cluster</h4><p>To allow ECS to do things like logging, a role needs to be created (TASK_EXEC_ROLE) and the AmazonECSTaskExecutionRolePolicy attached to this role. We also want to create an Amazon ECS empty cluster, which can also implicitly create a VPC (Amazon Virtual Private Cloud) configured with two subnets. Moreover, to eventually allow the container to be accessed on its exposed port 80, a security group with the proper authorization needs to be created.</p><p>Executing <em>./setup.sh </em>will:</p><ul><li>create the Task-execution Role</li><li>attach the task execution role policy</li><li>create an Amazon ECS empty cluster, implicitly also a VPC configured with two public subnets</li><li>create a security Group, authorizing network access</li></ul><p>Navigating into the./implicit directory and executing./setup.sh will result in something like this: (you may want to change the values of the variables in the first few lines of the script, to match your setup)</p><pre>#!/bin/bash</pre><pre>AWS_PROFILE=&quot;edu&quot;<br>AWS_REGION=&quot;us-west-2&quot;<br>TASK_EXEC_ROLE=&quot;fargateTaskExecutionRoleV1&quot;<br>SECURITY_GRP_NAME=&quot;fargateSecurityGroupV1&quot;<br>CLUSTER_NAME=&quot;prime-cluster</pre><pre>./setup.sh</pre><pre>[*] [14:31:36] {<br>    &quot;Role&quot;: {<br>        &quot;Path&quot;: &quot;/&quot;,<br>        &quot;RoleName&quot;: &quot;fargateTaskExecutionRoleV1&quot;,<br>        &quot;RoleId&quot;: &quot;AROASTEGIYUJA4FRUGFWB&quot;,<br>        &quot;Arn&quot;: &quot;arn:aws:iam::178....:role/fargateTaskExecutionRoleV1&quot;,<br>        &quot;CreateDate&quot;: &quot;2019-09-12T21:31:36Z&quot;,<br>        &quot;AssumeRolePolicyDocument&quot;: {<br>            &quot;Version&quot;: &quot;2012-10-17&quot;,<br>            &quot;Statement&quot;: [<br>                {<br>                    &quot;Sid&quot;: &quot;&quot;,<br>                    &quot;Effect&quot;: &quot;Allow&quot;,<br>                    &quot;Principal&quot;: {<br>                        &quot;Service&quot;: &quot;ecs-tasks.amazonaws.com&quot;<br>                    },<br>                    &quot;Action&quot;: &quot;sts:AssumeRole&quot;<br>                }<br>            ]<br>        }<br>    }<br>}<br>[*] [14:31:37] &#39;AmazonECSTaskExecutionRolePolicy&#39; attached to role: &#39;fargateTaskExecutionRoleV1&#39;.<br>INFO[0000] Created cluster                               cluster=prime-cluster region=us-west-2<br>INFO[0002] Waiting for your cluster resources to be created... <br>INFO[0002] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS<br>INFO[0063] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS<br>VPC created: vpc-0d2549b5bfe9f1f16<br>Subnet created: subnet-0a0b35c477d45762d<br>Subnet created: subnet-03a23e0873c126e41<br>Cluster creation succeeded.<br>[*] [14:33:11] VPC created with VpcId: &#39;vpc-0d2549b5bfe9f1f16&#39;.<br>[*] [14:33:12] &#39;fargateSecurityGroupV1&#39; Security Group with ID &#39;sg-03a1e0e1990588967&#39; created.</pre><h4>2.2. Create/Update Docker-Compose and ECS-Params files</h4><p>Just like when running the docker container locally, we need to have a compose file, but this time referring to the container resource inside ECR.</p><h4>Docker-Compose File</h4><pre>version: &#39;3&#39;<br>services:<br>  prime-cluster:<br>    container_name: prime-container<br>    restart: unless-stopped<br>    image: &quot;178.....dkr.ecr.us-west-2.amazonaws.com/prime_ws:latest&quot;<br>    ports:<br>      - &quot;80:80&quot;<br>    logging:<br>      driver: awslogs<br>      options:<br>        awslogs-group: prime<br>        awslogs-region: us-west-2<br>        awslogs-stream-prefix: prime</pre><h4>ECS-Parameter File</h4><p>The ecs-params.yml file refers to the <em>subnets</em> that were created when executing ./setup.sh. <strong>Update the ecs-params.yml </strong>file with the subnets that were created with the VPC. Also update the <em>security_groups value, </em>with the one we created above.</p><pre>version: 1<br>task_definition:<br>  task_execution_role: fargateTaskExecutionRoleV1<br>  ecs_network_mode: awsvpc</pre><pre>  task_size:<br>    mem_limit: 0.5GB<br>    cpu_limit: 256</pre><pre>run_params:<br>  network_configuration:<br>    awsvpc_configuration:<br>      subnets:<br>        - &quot;subnet-08...&quot;<br>        - &quot;subnet-0a...&quot;<br>      security_groups:<br>        - &quot;sg-0f...&quot;<br>      assign_public_ip: ENABLED</pre><h4>2.3. Launch</h4><p>The Cluster in the implicitly created VPC is all set up and ready to go. We created the <em>fargateTaskExecutionRole</em>to allow the container to do stuff and a security role, allowing the container to be accessed via HTTP Port 80. We updated the docker-compose file, to now point to the container’s location in the ECR and put an ecs-params.yml in place, for those parameters that aren’t native to the Docker Compose files. Now it’s time to compose and bring up the service. Details about the <em>ecs-cli compose service</em> command can be found <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cmd-ecs-cli-compose-service.html">here</a>.</p><pre>./launch.sh <br>WARN[0000] Skipping unsupported YAML option for service...  option name=restart service name=prime-cluster<br>INFO[0000] Using ECS task definition                     TaskDefinition=&quot;implicit:2&quot;<br>INFO[0001] Created Log Group prime in us-west-2         <br>INFO[0001] Created an ECS service                        service=implicit taskDefinition=&quot;implicit:2&quot;<br>INFO[0002] Updated ECS service successfully              desiredCount=1 force-deployment=false service=implicit<br>INFO[0017] (service implicit) has started 1 tasks: (task 35f39288-2c1c-4027-9f66-a95f12c79156).  timestamp=&quot;2019-09-12 21:37:39 +0000 UTC&quot;<br>INFO[0032] Service status                                desiredCount=1 runningCount=1 serviceName=implicit<br>INFO[0032] ECS Service has reached a stable state        desiredCount=1 runningCount=1 serviceName=implicit<br>Name                                                State    Ports                     TaskDefinition  Health<br>8d53e293-0fdf-40dd-bed2-3b7f939a414b/prime-cluster  RUNNING  34.220.216.94:80-&gt;80/tcp  implicit:2      UNKNOWN</pre><p>The output is telling us the IP address, i.e., how to reach the service — and just like we did locally, we can now access the service via HTTPie or with a Web browser:</p><pre>http 34.220.216.94/isPrime/14<br>HTTP/1.1 200<br>Content-Length: 26<br>Date: Wed, 04 Sep 2019 20:13:08 GMT</pre><pre>14 is not a prime number.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*JKXNw8YIsqwpJzlEsZBXEw.png" /></figure><h3>3. Preexisting Conditions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*Y-6rIk6nqSWJrE_uB_WrzA.png" /></figure><p>Instead of having the Amazon Elastic Container Service (Amazon ECS) implicitly create an Amazon Virtual Private Cloud (Amazon VPC), lets first create a VPC and then use Amazon ECS to pull the container from ECR and make the service publicly available.</p><p>This may sound like the less exciting, but I think there might be a good chance that you are not always in control of creating your very own VPC, but must use one that has been created for you.</p><h4>3.1. Creating a VPN (or skip, if you already have one)</h4><p>Running the ./vpc.sh bash script does many things. So here we go, navigating into the ./explicit directory and executing the ./vpc.sh script will:</p><ul><li>create a VPC</li><li>add a name tag to VPC</li><li>create public Subnets and add name tags</li><li>create private Subnets and add name tags</li><li>create Internet gateway and attach it to the VPC</li><li>create Route Table</li><li>create route to Internet Gateway</li><li>associate public Subnets with Route Table</li><li>enable Auto-assign Public IP on Public Subnets</li><li>allocate Elastic IP Address for NAT Gateway</li><li>create NAT Gateway</li><li>create route to NAT Gateway</li><li>create a security Group</li><li>authorize traffic from same security group</li><li>create an application load balancer (alb)</li></ul><h4>3.2. Creating a Cluster</h4><p>Before running the./launch.sh script, the following variable values need to updated, to match those of the VPC, created or re-used:</p><pre>AWS_PROFILE=&quot;..&quot;<br>AWS_REGION=&quot;us-west-2&quot;<br>TASK_EXEC_ROLE=&quot;fargateTaskExecutionRoleV2&quot;<br>CLUSTER_NAME=&quot;..&quot;<br>TG_NAME=&quot;..&quot;<br>TG_PORT=&quot;80&quot;<br>HEALTH_CHECK_PATH=&quot;/..&quot;</pre><pre># Values from explicitly created or already existing VPC</pre><pre>VPC_ID=&quot;vpc-056...&quot;<br>SUBNET_PRIVATE1_ID=&quot;subnet-07c4...&quot;<br>SUBNET_PRIVATE2_ID=&quot;subnet-0296...&quot;<br>SECURITY_GRP_ID=&quot;sg-0156...&quot;<br>LOAD_BALANCER_NAME=&quot;prime-alb&quot;</pre><p>While the docker-compose file remains the same, the <em>ecs-params.yml </em>needs to be updated, again to match the VPC. Please note that <em>assign_public_ip </em>needs the be set to DISABLED.</p><ul><li>task_execution_role</li><li>subnets: (… private subnets)</li><li>security_groups:</li><li>assign_public_ip: DISABLED</li></ul><p>With the the launch script and the parameter file updated, we can create and compose the cluster:</p><p>The launch script:</p><ul><li>creates the Task-execution Role</li><li>attaches the task execution role policy:AmazonECSTaskExecutionRolePolicy</li><li>creates the cluster using the private subnets</li><li>creates a Target Group (which needs a health check path)</li><li>creates a Listener, which forward traffic from the Load Balancer to the Target Group</li><li>creates a task (using the docker-compose file) and runs one instance on your cluster</li><li>discovers the Load Balancer’s DNS NAME and performs an HTTP GET request using the DNS NAME and health check path</li></ul><p>Again, the last line of the script outputs how to reach the service. E.g.:</p><p>http prime-alb-199922134.us-west-2.elb.amazonaws.com/isPrime/14</p><p><strong>HTTP/1.1 200<br>Connection: keep-alive<br>Content-Length: 26<br>Date: Thu, 12 Sep 2019 17:32:29 GMT<br></strong>14 is not a prime number.</p><h3>The sky is the limit (?)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*hAXxdcOd-qsfu8OFBZtf_g.png" /></figure><p>We have arrived. Starting with a Web Service (implemented in Java and <em>configured</em> to become a docker-container), we ran the docker-container locally, before pushing it into the private AWS Elastic Container Registry (ECR). We then used Amazon’s Elastic Container Service (ECS) to implicitly create a Virtual Private Cloud (Amazon VPC), when it created an empty cluster. A slightly modified <em>docker-compose file</em>, which now pointed to the docker image in ECR, was used to create a task, which ran as one instance on the cluster.</p><p>We also created (or used and existing) Virtual Private Cloud as a starring point, which required a Target-Group to receive traffic from a load balancer and a slightly modified <em>ecs-params.yml </em>file, containing task parameters that aren’t native to docker compose files.</p><p>In summary, the sky is the limit is not entirely true in the case, the Amazon ECS Service has its <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service_limits.html">limits</a> and so does <a href="https://aws.amazon.com/blogs/compute/task-networking-in-aws-fargate/">Fargate</a>. No being able to attach to (opening a shell on) the running container is a limitation, but running a docker container scalable, without having to manage servers or clusters is very appealing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*NsMOgGZpsoM7HMSmld4XCg.png" /></figure><p><a href="https://github.com/wolfpaulus/dock2gate">https://github.com/wolfpaulus/dock2gate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e1792cc50fe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/from-the-docks-to-the-gate-9e1792cc50fe">From the Docks to the Gate</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Only speak when spoken to]]></title>
            <link>https://medium.com/chat-bots/only-speak-when-spoken-to-6db41b64932d?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6db41b64932d</guid>
            <category><![CDATA[chatbot-development]]></category>
            <category><![CDATA[speech-synthesis]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[emotions]]></category>
            <category><![CDATA[virtual-assistant]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 01:19:34 GMT</pubDate>
            <atom:updated>2018-12-12T17:02:49.715Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3Ar-cPSSDZSEq-47" /><figcaption>Photo by <a href="https://unsplash.com/@andredoesphoto?utm_source=medium&amp;utm_medium=referral">Andre Guerra</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It wasn’t Steve Jobs, but former Apple Computer CEO John Sculley, who in his book <a href="https://www.amazon.com/Odyssey-Pepsi-Journey-Adventure-Future/dp/0060157801"><em>Odyssey: Pepsi to Apple</em></a>, introduced us to the Knowledge Navigator, an astoundingly capable virtual assistant. Today, more than thirty years later, smart speakers are trying to implement at least some of the conversational concepts, envisioned in the <a href="https://youtu.be/umJsITGzXd0">Knowledge Navigator video</a>, which premiered in 1987 at Educom.</p><p><a href="https://www.canalys.com/static/press_release/2018/Press-Release-151118-Global-smart-speakers.pdf">According to Canalys</a>, 75 million smart speakers will be sold worldwide in 2018. Amazon Echo and Google Home devices have a market share of about 30% each and more than 50% of all devices are sold in the US.<br><a href="https://www.dashbot.io/2018/11/19/how-consumers-really-use-alexa-and-google-home-voice-assistants/">According to dashbot</a>, 75% of those who own a smart speaker use it daily, with 57% using their device many times a day.</p><p>Obviously, a smart speaker is no Knowledge Navigator, at least not yet. Listening to music, asking for weather information, and setting a timer are the most popular use cases. It’s doubtful that consumers spent a significant amount of time and effort, evaluating competing experiences, but instead go with the platform they are already invested in. Even so, imagine a level playing field, how would one decide?</p><p>Voice first or voice only experiences don’t have a traditional (graphical) user interface. In this new environment of ambient-computing, neither form factor nor looks matter. All other things being equal, it’s how a user perceives a response that might eventually determine the success of a voice platform or that of a skill or application running on one of those platforms. Not only what, but equally how a virtual assistant says it, will determine success.</p><h4>Likability becomes the ultimate differentiator in an otherwise un-differentiable experience.</h4><p>Creating a likable experience doesn’t mean that a virtual assistant should aspire or pretend to be human. You also don’t need to hire novelists, poets, comedians, and fiction writers, trying their very hardest to build personality quirks into the most mundane or rote activities. Simply put it is about making a connection with the user.</p><p>Currently, smart speakers are more like digital slaves, only allowed to speak when spoken to. Regardless, reading or hearing a kind response can be a delightful experience. But rather than being kind, it is important the intended attitude or sentiment comes across unambiguously. An example not to follow would be this response from a virtual assistant inside a maps app, announcing not with empathy but gleefully with obvious happiness in her voice:</p><blockquote>“There has been a fatal accident on the 101 North. You will arrive at your destination in two hours and fourteen minutes. You are on the fastest route.”</blockquote><p>Mistakes like that can easily be avoided, by matching the emotions and tones found in the text, with those recognizable in the voice.</p><h3>Emotion Recognition in Voice</h3><p>Paul Boersma, professor of Phonetic Sciences at the University of Amsterdam, (and author of the leading speech analysis software Praat) created a system that measures from voice input, whether the speaker sounds <em>happy</em>, <em>sad</em>, <em>afraid</em>, <em>angry</em>, or has a <em>neutral</em> state of mind. It can reach the performance level of a dedicated human listener, even if hearing a speaker’s voice for the first time.<br>While Boersma’s emotion recognizer was not created with speech synthesizers in mind, nothing prevents us from using it to evaluate synthesized speech.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Umv6XHCDeRyEfaicgzX9tA.png" /></figure><p>Changing stress and intonation by varying prosodic parameters for pitch, pitch range, volume and speech rate, can change how emotion in synthesized speech is perceived. A pitch increase, for instance, could be used to inject emotions with high excitation (anger, fear, and happiness), while a pitch decrease, or a narrowing of the pitch <em>range</em> is an option for emotions with little excitation (sadness or boredom). We tend to say positive things faster while slowing down at negative information.</p><h4>Speech Synthesis Markup Language (SSML)</h4><p>SSML Version 1.1 is an W3C recommendation since September 2010, but there still isn’t a single synthesizer that has implemented the entire specification. Moreover, the results of the already implemented features vary. Still, SSML allows us to adjust the speech synthesis, for instance, permitting to control <em>emphasis</em>, <em>pitch</em>, <em>pitch-range, </em>speaking <em>rate</em>, and <em>volume</em> of the speech output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gn6u_Yy96Xd4NrzlRueI5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-OwTxnwzD9C2tuqjD0D1NQ.png" /></figure><p>IBM extended SSML for its speech synthesizer, adding proprietary tags, allowing a more straightforward approach, targeting a whole sentence or phrase. Dubbed “Expressive SSML”, text can be wrapped into &lt;express-as&gt; tags and typed as ‘<em>GoodNews’</em>, ‘<em>Apology’</em>, or ‘<em>Uncertainty’</em>.</p><p>But long before diving into the cumbersome process of adjusting the perceivable emotion in synthesized speech, comes the task of finding the right tone in a text or script.</p><h3>Emotions and Tones in Text</h3><p>Before diving deeper into the sentiment of sentences, or the pleasantness, activation, and imagery of isolated words, let’s look at three sentences, all saying pretty much the same thing, but expressing a different attitude, maybe reflecting the attitude of the writer or speaker.</p><ul><li><em>If you don’t study for an exam, then don’t expect a perfect score.</em></li><li><em>You can’t expect to skip studying for an exam and still score perfectly.</em></li><li><em>Please recognize, studying for an exam helps to achieve a perfect score.</em></li></ul><p>Which of these similar sentences is most likable? Which best expresses the emotion the author wishes to convey? We have developed tools to help with these questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUk44hwdIvJnqMQoZHJPQQ.png" /></figure><h4>Visualizing pleasantness, activation, and imagery</h4><p>Using Cynthia Whissell’s Revised <a href="https://www.ncbi.nlm.nih.gov/pubmed/19928612"><strong>Dictionary of Affect in Language</strong></a>, words are marked-up based on their <em>pleasantness</em>, <em>activation</em>, and <em>imagery</em> (ability to form a mental picture).<br>Green and red tones are used to visualize the pleasantness of a word. Very pleasant words are rendered in bright green and very unpleasant words are rendered in bright red, and everything in between.<br>The font-size is used to visualize the activation of a word. Very active words are shown in a large font size, passive words are rendered in a smaller font. <em>Fun</em> or <em>cheerful</em> words have high scores in both, pleasantness and activation. <em>Sad</em> words have low scores in pleasantness and activation. <em>Nice</em> or <em>soft</em> words have a high pleasantness, but a low activation. <em>Nasty</em> words have a low pleasantness, but a high activation.<br>Reading an engaging story can prompt vivid imagery of the described events and reported feelings of emotion. <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3620013/">Research has confirmed this phenomenon</a> and demonstrates that text-driven imagery prompts heightened autonomic and somatic reactions consistent with affective engagement. <br>Highly imaged words, effectively, making a story more memorable, are rendered with a bold font. Poorly imaged words are rendered with a thin/light font.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SR7VB0cc3QDRKwt8uwfnRg.png" /></figure><h3>Sentiment Analysis</h3><p>Modern sentiment prediction systems don’t just look at words in isolation but build a representation of a sentence, based on its structure. A sentiment value can then be computed based on how words compose the meaning of longer phrases. Here, for example, I have charted the above-mentioned paragraph and analyzed by two distinct sentiment analyzers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ccdGTmCsVgdWel2y_AS0SA.png" /></figure><p>You might question the accuracy of sentiment predictions from systems like the <a href="https://nlp.stanford.edu/sentiment/">Stanford NLP</a> or the Valence Aware Dictionary and sEntiment Reasoner a.k.a. <a href="http://comp.social.gatech.edu/papers/icwsm14.vader.hutto.pdf">VADER</a>. We had the same question… <br>We extracted thousands of sentences from modern novels and ran them through sentiment analyzers, which put them into 5 buckets: very-positive, positive, neutral, negative, and very negative. After manually removing sentences that were just too graphic, we stopped at about 200 sentences in each set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*iNawOD17k-rYLoddXyiuvg.jpeg" /></figure><p>Next, we asked randomly selected people to read and determine the attitude expressed in those 1000 sentences: if it were <em>very positive, positive, neutral, negative, </em>or<em> very negative</em>. 156 people tagged a total of 7470 sentences (on average a participant looked at about 50 sentences, containing sentences from each of the 5 sets).<br><strong>91% of the responses matched exactly or were 1 off the sentiment analysis:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9U2eMm-rS18Vu02ZX0NznQ.png" /></figure><p>No matter how you look at it, predictions provided by sentiment analyzers are more often right than not.</p><h4>Tone and Engagement in Text</h4><p>Sometimes sentiment is not enough and off the shelf Tone in Text Analyzers can help to predict emotions and communication style in a text.<br>A Tone in Text Analyzer can be a very useful tool when verifying that a response, created to be displayed or uttered by a virtual assistant does not come across angry unless you meant it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jvlBKKicAa0BvjWue0sCfQ.png" /></figure><h4>Readability Score</h4><p>A readability score is a computer-calculated index, considering metrics like syllable count, sentence length and word difficulty, and can tell what level of education someone will need to be able to read a piece of text easily. The readability score might be even more important if the text will eventually be synthesized and a user has to listen to it. <br>We use different words and a different sentence length and structure in our written and spoken communication. Responses created for a virtual assistant need to keep that in mind as well. While it’s never unimportant to know your user base, it’s actually crucial to realize the education level required to comprehend the synthesized text, which a virtual assistant will then verbalize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KD2CE1-puyEqblRJpYo7yA.png" /></figure><h4>Summary</h4><p>When compared to the Knowledge Navigator, Alexa and Google Home may look simplistic and not all that <em>smart</em>, but undeniably, the smart speaker is a very exciting new application platform. Interestingly, competing offerings are perceived as very similar and traditional differentiators like a delightful graphical user interface don’t seem to apply as much as before. In an otherwise un-differentiable experience, likability may become the ultimate differentiator. Not only what, but how a virtual assistant says it, will determine success.</p><p>Most of the tools and techniques mentioned here were created and are used to analyze user input or make sense of customer feedback. But don’t let that discourage you from using them to validate that a virtual assistant’s or chatbot’s response carries exclusively the intended attitude or sentiment.</p><p>I have only anecdotal evidence that <em>“Please”</em> and <em>“Thanks”</em> is said less often than before to smart speakers. Let’s make sure the skill or bot you are building responds kindly, considerately and empathically if warranted, and thereby deserves its user’s politeness. The number of <em>“Thanks”</em> your bot hears, might tell you, if you are on the right track.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F58521e%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F58521e%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c90883b0516ddbe5c59960c12a04bc64/href">https://medium.com/media/c90883b0516ddbe5c59960c12a04bc64/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6db41b64932d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chat-bots/only-speak-when-spoken-to-6db41b64932d">Only speak when spoken to</a> was originally published in <a href="https://medium.com/chat-bots">Chatbots Magazine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Path to the CUI is Heavily Mined and Booby-Trapped]]></title>
            <link>https://medium.com/chat-bots/the-path-to-the-cui-is-heavily-mined-and-booby-trapped-bbbd3ec99aca?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbbd3ec99aca</guid>
            <category><![CDATA[conversational-ui]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[vui]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Fri, 03 Mar 2017 17:04:38 GMT</pubDate>
            <atom:updated>2017-03-03T17:04:38.485Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*eBalD3N1qPWRUpzlk7UQpw.jpeg" /></figure><p>The concept of the Conversational User Interface (CUI) is not really new. Wolfgang Wahlster of the German Research Center for AI, DFKI, wrote 12 years ago in his paper on <a href="http://www.wolfgang-wahlster.de/wordpress/wp-content/uploads/Conversational_User_Interfaces.pdf">Conversational User Interfaces</a>:</p><blockquote><em>“Conversational user interfaces allow various natural communication modes like speech, gestures and facial expressions for input as well as output and exploit the context in which an input is used to compute its meaning. The growing emphasis on conversational user interfaces is fundamentally inspired by the aim to support natural, flexible, efficient and powerfully expressive means of human-computer communication that are easy to learn and use.”</em></blockquote><h3>Conversational User Interfaces Have a Chance to Become the Next Platform</h3><p>Several trends support the idea that <strong>voice or textual user interfaces </strong>have a shot at becoming the next platform after mobile.</p><ol><li>Mobile devices have by nature a smaller screen, which makes typical GUI menu hierarchies harder to use.</li><li>Just saying what you want, can be a powerful and direct approach, which can dramatically simplify interactions, especially when considering context awareness. <em>“OK Google, Navigate Home”</em></li><li>Messaging apps are among the most popular applications on mobile devices; they are used for real-time text-chats between two or more users. Understandably, companies try to go where their customers are, trying to create a presence inside these messaging applications. Messaging app providers would gladly build their apps into platforms, envisioning to get filthy rich on transaction fees. But don’t confuse the popularity of messaging apps as an endorsement of chatbots — the once popular landlines didn’t imply IVRs (Interactive Voice Response Systems) were all the rage either.</li><li>Companies like Microsoft, which have no foothold in the mobile ecosystem (no mobile OS or popular mobile app) see the CUI as a new chance to (re-)gain influence, providing services necessary for a Conversational User Interface; i.e., speech recognition, intent extraction, natural language understanding, and speech synthesis.</li></ol><blockquote>Definition of the term “<strong>conversation”</strong> by Merriam-Webster<br><em>“oral exchange of sentiments, observations, opinions, or ideas“</em></blockquote><p>Uttering commands like <em>“What’s the weather in Mountain View tomorrow”</em> or <em>“Navigate Home”</em> hardly qualifies as a conversation. Corporate bots living inside messaging platform like Facebook Messenger, very often mimic the much hated behavior of IVRs. While there is some back and forth, it doesn’t quite qualify as a conversation either.</p><h3>Having a Conversation or Operating a Virtual Vending Machine?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*6CFqdhBZUvJ06tLAgQ7y_Q.jpeg" /><figcaption>1–800 Flowers bot integrated into Facebook Messenger</figcaption></figure><p>Providing an alternative to calling their 1–800 number, this chatbot represent a virtual vending machine that wants to be operated by text messages, but is this really representing or at least hinting at a platform shift?</p><h3>Defining ‘Platform’ Depends on Your Viewpoint</h3><p>A software or content developer may loosely define platforms simply as <strong>Desktop</strong>, <strong>Web</strong>, <strong>Phone</strong>, and now <strong>Bots</strong>. An end-user on the other hand, may have a slightly different view. Along time ago, he transitioned from text and keyboard to icons and mouse, then to the touch-screen of his smart phones, and now to something they may require him, to use his voice. A user may very informally think of those platform shifts, as going from <strong>type</strong> to <strong>click</strong> to <strong>touch</strong>, and now <strong>talk</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5uIut8JJKzZo6sWK4mxng.png" /></figure><p>Platform shift don’t happen over night. It took about 10 years to bring the GUI into the mainstream. At the beginning of a platform shift, it seems that different possible futures exist; like branches on tree. Many of us however, only see the direct path we are currently on.</p><p>The transition from text to a graphical UI had an evolutionary dead end. While it adopted colors, menus, and windows, it still used mainly the keyboard’s cursor keys for navigation and a character based display. This dead-end was evidently an evolution from DOS, but the revolutionary pixel based graphics and mouse pointer eventually triumphed.</p><p>At the time, this was not as obvious as we now belief. For instance, John C. Dvorak wrote in 1984: <em>“The Macintosh uses an experimental pointing device called a ‘mouse’. There is no evidence that people want to use these things. </em><strong><em>Why would I want this?”</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*upS2iAwyQVC6Ts5njPSPKw.png" /></figure><p>When the iPhone launched in 2007, the <strong>touch interface </strong>was revolutionary, but doubted by many. Even three years later, many, and almost all Motorola smart-phones (where I was working at the time), were on the evolutionary<strong> </strong>path from Palm and Blackberry devices, and came with a keyboard. Mike Lazaridis (RIM CEO), said on Nov. 1, 2007: <em>“Try typing on a touchscreen on an Apple iPhone, that’s a real challenge.”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nghB4hzyBxFi9_MXZqnSyQ.png" /></figure><p>I know this is controversial, especially to those, who are already heavily invested in chatbots, but at the beginning of this platform shift, there once again seems to be an evolutionary and a revolutionary future. This time it’s type vs talk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JGEHKg3l1tou3rJCqtkzbQ.png" /></figure><p>There is the notion that a Voice-User-Interface is just a chat-bot that has a speech-recognizer and synthesizer attached. I don’t think that’s quite right.</p><p>I couple month ago, I publish this graphic in an <a href="https://medium.com/@wolfpaulus/the-conversational-user-interface-is-a-minefield-edefa94cc1b2#.e8siwuyrz">article on medium</a>, showing how user-interfaces have expanded in their dimensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b7p1xANwL2B321UHKbBXZg.png" /></figure><p>We are all used to the traditional 2D environment (think desktop or mousepad.) With Virtual Reality devices however, we are now able to explore inside a three dimensional user interface.</p><p>On the other side we have chatbots, which are re-using many visual widgets from the 2D desktop, but forcing the user into a single dimension, allowing only to scroll back into the history.</p><p>The Voice User Interface is what I call a “Zero-D” experience, without visual cues, leaving the progress of a conversation to the user’s memory and ingenuity. It offers however <strong>the most frictionless form of communication</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p55NRFRyG320uxP8lzUQdw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbbd3ec99aca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chat-bots/the-path-to-the-cui-is-heavily-mined-and-booby-trapped-bbbd3ec99aca">The Path to the CUI is Heavily Mined and Booby-Trapped</a> was originally published in <a href="https://medium.com/chat-bots">Chatbots Magazine</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Conversational User Interface is a Minefield]]></title>
            <link>https://medium.com/@wolfpaulus/the-conversational-user-interface-is-a-minefield-edefa94cc1b2?source=rss-cc7885d0f40a------2</link>
            <guid isPermaLink="false">https://medium.com/p/edefa94cc1b2</guid>
            <category><![CDATA[conversational-ui]]></category>
            <category><![CDATA[speech-synthesis]]></category>
            <category><![CDATA[nlu]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[speech-recognition]]></category>
            <dc:creator><![CDATA[Wolf Paulus]]></dc:creator>
            <pubDate>Thu, 01 Sep 2016 15:43:31 GMT</pubDate>
            <atom:updated>2016-09-02T16:36:46.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*knR0lhRD6nwtgXVkS6qPHA.jpeg" /></figure><p>The path to an acceptable Conversational User Interface is heavily mined and booby-trapped. Let’s not fall into the IVR trap, but create a humanized and personalized user experience. [IVR — Interactive voice response is a technology that allows a computer to interact with humans through the use of voice and DTMF tones input via keypad. — Think about calling your insurance company …<em> ‘To file a claim, press 2’</em>]</p><p>While they can benefit greatly from each other, there is no need to create a dependency between a Conversational User Interface (CUI) and Machine Learning (ML). It is not hard to imagine how a CUI can be put to good use with a currently existing service infrastructure. In fact, I think it is a good idea to apply the principal of <em>“separation of concerns”</em> and <strong>not</strong> merge the already difficult task of creating a CUI with new or untested ideas for services and solutions.</p><p>Accessing and interacting with a complicated system in a simple and imprecise way has the potential of creating an emotional connection. Even more so, if the conversational user interface responds empathetically, showing the ability to understand and share the feelings that a user might have, while interacting with such a system. However, a bunch of cruddy IVR bots is the shortest path to nuking this nascent opportunity. The community will have to rally to identify those use cases that provide customer benefit and delight, and truly work in a conversational UI. At the same time, we better show restraint, to not fall into the trap of re-creating the much hated IVR experience, for instance by reaching for the lowest hanging fruits, implementing solutions for use cases that are unfavorable for CUIs.</p><blockquote>We are strong<br>No one can tell us we’re wrong<br>Searching our hearts for so long<br>Both of us knowing<br>Love is a battlefield<br>Love is a battlefield, written by Neil Giraldo and Patricia Benatar • Copyright © Chrysalis Music Group Inc.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TvYtlaL83V6r4SWtyVXPsQ.jpeg" /></figure><p>With Virtual Reality User Interfaces, we leave the two dimensional communication (mouse pad) behind. At the same time, traditional UI widgets, like checkboxes and radio-button-lists, find their way into ChatBot experiences, creating a simplified, one dimensional user experience that is more sequential and resistant to context switching.<br>The Voice User Interface on the other hand, doesn’t provide anything that would allow for the reuse of the old models and metaphors, no buttons, sliders, or switches to click or touch; here we very directly need to say what we mean or want.</p><h3>From Text to Graphical to Conversational and Voice User Interfaces</h3><p>The last user interface revolution led us from the text to the graphical user interface and was enabled by new hardware (high-resolution graphic displays, computer mice) and a new software paradigm (object oriented programming). This time, the breakthroughs are noise cancelling array microphones, the streaming of voice sound into the recognizer, while the user is still speaking, and a declarative approach to natural language understanding (NLU). Natural language understanding has recently been solved nicely by several companies (incl. Facebook, Amazon, Microsoft) interestingly in the very same declarative way (and here it is again, using the <em>separation of concerns</em>), but only for the very task of identifying user intent, which seems to work well, when dealing with structured data inside of small domains.</p><p>Synthesized speech is still distinguished easily from that of a human speaker. Still, speech synthesis has become far more than good enough, i.e., does not annoy listeners, when it is used for just a few short paragraphs. Moreover, the next leap forward is very much in reach, where we can synthesize text and also convey an emotion or sentiment.</p><h3>Attributes of good Voice and Conversational User Interfaces</h3><p>A good CUI maintains context, for instance by carrying-over entities from one request to the next. It is adaptable, of instance by providing less guidance to the user, who has very recently mastered a similar intent successfully.<br>A good CUI shares control of the conversation, for instance by not only answering questions, but also making reasonable suggestions of its own. It is personal and personable, for instance by addressing the user by his name and using language that if run through sentiment analysis, would show that is matched the emotional state of the user.<br>A good CUI shows appropriate personalized empathy, by knowing how the information it just presented to the user, made him feel. It acts randomly, surprises, and has (almost) complete coverage of its domain. <br>By performing tasks beyond answering questions, it encourages frequent (daily) usage (talking to a bot is unlike riding a bicycle, i.e., is disremembered quickly).</p><h3>Attributes of good Voice and Conversational Interface Use Cases</h3><p>A voice or conversational user interface doesn’t provide the visual cues, users became to rely on, when using GUIs. Infrequent and/or rare use of a CUI won’t lead to efficient and productive interactions and instead users will have to re-learn (feeling out boundaries, establishing trust, ..) how to best communicate. Therefore, use cases that are performed frequently, ideally daily, are favorable candidates.</p><p>For multiple reasons (including the number of entities, complexity, response time, error rate, etc.), favorable use-cases require little verbal input. At least for the near term, a possible rule of thumb could be:</p><p><strong>number of words out &gt; number of words in</strong></p><p>Favorable use cases do more than answering questions or volunteering insights and advice, instead performing tangible tasks for the user, like augmenting, sending, ordering, etc., thereby creating a sense of accomplishment.</p><p>Favorable use cases for a CUI are optimized in some specific way. They can be performed faster, or more conveniently, or with less effort, or more directly, or performed simultaneously with other tasks, when compared to a more “traditional” execution.</p><p>I hope to have identified some of the attributes that a friendly CUI should have and also provided some ideas for how to identify use cases that are favorable to be implemented in a CUI.<br>According to Gartner, “Natural Language Q&amp;A” is already in the phase of disillusionment and will be hitting bottom soon. It is up to us now, to make it out of there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0u2AV0RSgU5HHF4-goEcEg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edefa94cc1b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>