<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Danny Sebastián Díaz Padilla</title>
    <description>The latest articles on DEV Community by Danny Sebastián Díaz Padilla (@magodyboy).</description>
    <link>https://dev.to/magodyboy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1617453%2Fe6d43eb5-30f4-4dd5-b796-6d9f4a8f40f5.png</url>
      <title>DEV Community: Danny Sebastián Díaz Padilla</title>
      <link>https://dev.to/magodyboy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/magodyboy"/>
    <language>en</language>
    <item>
      <title>Dungeons and Twilio</title>
      <dc:creator>Danny Sebastián Díaz Padilla</dc:creator>
      <pubDate>Mon, 24 Jun 2024 06:47:55 +0000</pubDate>
      <link>https://dev.to/magodyboy/dungeons-and-twilio-2bm4</link>
      <guid>https://dev.to/magodyboy/dungeons-and-twilio-2bm4</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/twilio"&gt;Twilio Challenge &lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;This project demonstrates the integration of Twilio's communication services with OpenAI's GPT-3.5 and DALL-E models to create an interactive and engaging virtual Dungeon Master (DM) experience for a single-player Dungeons and Dragons (D&amp;amp;D) adventure. The system leverages Twilio for managing incoming and outgoing messages, while OpenAI's models generate narrative responses and creative images based on player inputs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Impact:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The project offers a unique, AI-driven interactive storytelling experience for D&amp;amp;D players, enhancing their engagement and immersion in the game. By combining natural language processing and image generation capabilities, it provides personalized and entertaining gameplay that can adapt dynamically to the player's actions and decisions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyj2oqxkjny0h29yvmgr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyj2oqxkjny0h29yvmgr.png" alt="Web Whatsapp sample"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm using Twilio Sync, a LLM from open AI, DALL-E and Twilio Functions to capture the webhook from whatsapp.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feo0xv5aboyzhv3ui53e5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feo0xv5aboyzhv3ui53e5.png" alt="Architecture"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/Magody/DungeonsAndTwilio/tree/main" rel="noopener noreferrer"&gt;Code&lt;/a&gt;:  &lt;a href="https://github.com/Magody/DungeonsAndTwilio/tree/main" rel="noopener noreferrer"&gt;https://github.com/Magody/DungeonsAndTwilio/tree/main&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the demo:&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://drive.google.com/file/d/1LTQk7Asf1iT82ue-K1ntaL5WR3jyLEez/preview" rel="noopener noreferrer" class="c-link"&gt;
          Dungeons and Twilio.mp4 - Google Drive
        &lt;/a&gt;
      &lt;/h2&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fssl.gstatic.com%2Fimages%2Fbranding%2Fproduct%2F1x%2Fdrive_2020q4_32dp.png"&gt;
        drive.google.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Twilio and AI
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Main Functionalities
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Message Handling with Twilio
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Incoming Message Processing:&lt;/strong&gt; Captures incoming messages from players via Twilio's messaging service, extracting key information such as the sender's profile name, phone number, and message content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Message Storage:&lt;/strong&gt; Utilizes Twilio Sync to store and retrieve the history of messages, ensuring a consistent narrative flow and context-aware interactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Chat History Management
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sync Map Creation:&lt;/strong&gt; Messages are stored in a Sync Map with unique keys based on timestamps, allowing easy retrieval and organization of chat history.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual Chat History Preparation:&lt;/strong&gt; Prepares a structured chat history for OpenAI's language model, including the system's instructions and previous messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  AI-Powered Dungeon Master (DM)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI GPT-3.5 Integration:&lt;/strong&gt; Generates dynamic, context-aware responses to player inputs, guiding them through the adventure with engaging and humorous narratives. Ensures the AI follows D&amp;amp;D rules and keeps the game interactive and fun.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Storytelling:&lt;/strong&gt; The AI asks the player about their actions, offers choices, and adapts the storyline based on the player's decisions, creating a personalized gaming experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Image Generation with DALL-E
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Creative Image Generation:&lt;/strong&gt; Uses OpenAI's DALL-E model to generate humorous and magical images based on the player's narrative inputs, enhancing the visual aspect of the game.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Media Messaging:&lt;/strong&gt; Sends the generated images to the player via Twilio's messaging service, enriching the storytelling experience with visual elements.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Additional Prize Categories
&lt;/h2&gt;

&lt;p&gt;I think this app falls into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Twilio Times Two: I use Twilio WhatsApp integration with web hooks to a Twilio function, also Twilio Sync to temporary store a database&lt;/li&gt;
&lt;li&gt;Entertaining Endeavors: The best of Dungeons and Dragons for me, it is to create a unique story. Generative AI is perfect for this, and could generate as much as you want.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>twiliochallenge</category>
      <category>ai</category>
      <category>twilio</category>
    </item>
    <item>
      <title>Lifeline Support</title>
      <dc:creator>Danny Sebastián Díaz Padilla</dc:creator>
      <pubDate>Mon, 24 Jun 2024 04:43:49 +0000</pubDate>
      <link>https://dev.to/magodyboy/lifeline-support-19cg</link>
      <guid>https://dev.to/magodyboy/lifeline-support-19cg</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/twilio"&gt;Twilio Challenge &lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;In a world where mental health issues are becoming increasingly prevalent, our mission is to offer a safe, supportive, and non-judgmental space for individuals to share their struggles and receive immediate, compassionate guidance.&lt;/p&gt;

&lt;p&gt;I would have liked to have had something like this on hand; some years ago. Also, the inspiration comes from the lyrics of this song: Logic - 1-800-273-8255&lt;/p&gt;

&lt;p&gt;Harnessing the capabilities of Flask for our web framework, Twilio for seamless voice and SMS communication, and the advanced language models from OpenAI, I have created a tool that listens, understands, and responds with empathy and care.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Real-time voice Emotional Support: Users can reach out at any time by &lt;strong&gt;calling&lt;/strong&gt; a dedicated number, where they are greeted by a responsive and empathetic voice ready to listen and help.&lt;/li&gt;
&lt;li&gt;Supportive and Non-judgmental: Every interaction is crafted to be positive and supportive, creating a safe space for users to open up about their feelings.&lt;/li&gt;
&lt;li&gt;Summarizing Advice: If a user decides to end the conversation, the chatbot provides a summarized advice via &lt;strong&gt;SMS&lt;/strong&gt;, ensuring the user has a tangible reminder of the support received.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The system looks like this, I developed a microservice to handle the real time interaction and logic:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd54tgtia93wijz4qsmq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd54tgtia93wijz4qsmq3.png" alt="System Architecture" width="772" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside de service, there is a graph of LLMs collaborating to produce a helpful system:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhjs3u8tqrfxr0a01ll4y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhjs3u8tqrfxr0a01ll4y.png" alt="Service flow" width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/Magody/TwilioLifeLineSupport/tree/main"&gt;Code&lt;/a&gt;: &lt;a href="https://github.com/Magody/TwilioLifeLineSupport/tree/main"&gt;https://github.com/Magody/TwilioLifeLineSupport/tree/main&lt;/a&gt;&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://drive.google.com/file/d/18sTIw3wWpvZvecz1zeyJX45Z4bKBcRsa/preview" rel="noopener noreferrer" class="c-link"&gt;
          LifeLineSupportDemo.mp4 - Google Drive
        &lt;/a&gt;
      &lt;/h2&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--QRcP2nCr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png" width="32" height="32"&gt;
        drive.google.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://drive.google.com/file/d/1BypmvvApB5jOd4fEONuuZum9oe4jl3xp/preview" rel="noopener noreferrer" class="c-link"&gt;
          LifeLineSupportProject.mp4 - Google Drive
        &lt;/a&gt;
      &lt;/h2&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--QRcP2nCr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png" width="32" height="32"&gt;
        drive.google.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;If you want to try it, you probably want to call to: +16183270085. SMSs only are enabled geographically on: Canada, US, Mexico, Ecuador, Colombia, Chile. In &lt;a href="https://console.twilio.com/us1/develop/sms/settings/geo-permissions"&gt;https://console.twilio.com/us1/develop/sms/settings/geo-permissions&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Twilio and AI
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Twilio&lt;/strong&gt;&lt;br&gt;
A. Voice Communication:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Voice Calls&lt;/li&gt;
&lt;li&gt;Twilio Voice Response (TwiML): I utilized Twilio’s Voice Response capabilities to handle incoming calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;B. SMS Communication:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sending Summaries: The system uses Twilio to send a summarized SMS containing the key points of the advice provided.&lt;/li&gt;
&lt;li&gt;Follow-Up Messages: Twilio’s SMS service is also used to send follow-up messages, providing additional resources or encouragement as needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;AI Integration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A. Natural Language Processing (NLP):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding User Input: OpenAI’s language models enable the chatbot to accurately understand and process the user’s spoken words.&lt;/li&gt;
&lt;li&gt;Generating Compassionate Responses: The AI generates responses that are compassionate and empathetic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;B. Context-Aware Conversations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintaining Continuity: The AI keeps track of the conversation’s context by storing previous interactions in text files. &lt;/li&gt;
&lt;li&gt;Handling Crisis Situations: The AI can recognize when a user might be in crisis and responds with appropriate, comforting messages, encouraging the user to seek professional help if necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Additional Prize Categories
&lt;/h2&gt;

&lt;p&gt;I think the projects is in the following categories&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Twilio Times Two: The project uses 2+ Twilio APIs (Call, SMS).&lt;/li&gt;
&lt;li&gt;Impactful Innovators: The project drives positive social impact.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>twiliochallenge</category>
      <category>ai</category>
      <category>twilio</category>
    </item>
    <item>
      <title>The Halting Problem</title>
      <dc:creator>Danny Sebastián Díaz Padilla</dc:creator>
      <pubDate>Sun, 16 Jun 2024 19:06:52 +0000</pubDate>
      <link>https://dev.to/magodyboy/the-halting-problem-41c3</link>
      <guid>https://dev.to/magodyboy/the-halting-problem-41c3</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/cs"&gt;DEV Computer Science Challenge v24.06.12: One Byte Explainer&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explainer
&lt;/h2&gt;

&lt;p&gt;The halting problem asks whether there can be a machine that determines whether a program will halt or continue indefinitely. It cannot exist; if we add a negation to this machine and evaluate it on itself, it will always fail because of its contradiction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Context
&lt;/h2&gt;

&lt;p&gt;Solved by Alan Turing. Explaining this concept is complicated, since it requires the use of several compound functions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Extended Explanation&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"H" which can determine whether any program 𝑃 stops or continues given an input.&lt;/li&gt;
&lt;li&gt;We use "H" to create a program "D" that takes as input the code of a program "P".&lt;/li&gt;
&lt;li&gt;"D(P)" calls "H(P, P)", evaluating "P" with its own code as input.&lt;/li&gt;
&lt;li&gt;If "H(P, P)" says "yes" (P stops at P), "D(P)" enters an infinite loop.&lt;/li&gt;
&lt;li&gt;If "H(P, P)" says "no" (P does not stop at P), "D(P)" stops.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Paradox:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Passing "D" to itself as input: "D(D)":

&lt;ul&gt;
&lt;li&gt;If "H(D, D)" says that "D(D)" stops, "D(D)" enters an infinite loop (contradiction).&lt;/li&gt;
&lt;li&gt;If "H(D, D)" says that "D(D)" does not stop, "D(D)" stops (another contradiction).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>devchallenge</category>
      <category>cschallenge</category>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
