Conf42 Prompt Engineering 2024 - Online

- premiere 5PM GMT

How I Prompted AI to Build a Pregnancy App I Could Trust

Video size:

Abstract

Tired of pregnancy apps selling out your privacy? Join me to discover how I used AI to build a truly secure maternal health app. Learn about privacy pitfalls, AI-guided development, and open-source tools that put moms in control.

Summary

Transcript

This transcript was autogenerated. To make changes, submit a PR.
Hey everyone, my name is Razelle Scarlett and today I'm going to be talking to you about prompting AI to build a pregnancy app that I could trust. All right, so let me just give you a little bit of background. For me, in my opinion, I don't think we talk about pregnancy in the workplace enough. It's a taboo topic. It's also a very sensitive subject for many pregnant women, of course, are birthing people. But I also think, because of the lack of discussion, this also leads to poor maternity leave policies because a lot of our industries like tech are so male dominated. And then that leads to overworked expecting moms and also I think we've ended up developing a lot of pregnancy invasive app or privacy invasive pregnancy apps try saying that three times but basically I think we a lot of the tech industry will be like oh let's get into this area in the 2020s or 2015s or whatever like let's get into this area where it seems underserved let's make these apps for, feminine personal health data. And then they figure out, Ooh, like we don't care that much, or at least as a user, you figure out, Whoa, they don't really care that much for my privacy. this is nice to track, but it's also sharing my data with a ton of different, platforms. before I go any further, my name is Rizal Scarlett. I'm a staff developer advocate at Block. I'm very passionate about open source and AI. And I'm passionate about the data privacy as well, which almost seems opposite of each other. And one of the reasons I'm interested in this particular topic today is I'm 35 weeks pregnant. And with that, I will tell you the agenda as well. So we're going to talk about lack of data privacy online, something I found called the centralized web nodes. AI agents tips and tricks for using AI agents. We'll do a bit of a demo and I'll show you all some resources. So it's going to be lots of fun. So I'm already used to, and you all are probably as well, apps that just collect massive amounts of personal data about you. And really we just accept it for what it is. and oftentimes we accept it for what it is because that's just how the internet has been, but. That shouldn't be how it always is, right? I started thinking this is really weird when I downloaded A app when I decided oh, I think I want to start a family and tiktok instagram reels facebook target Everyone youtube every commercial had to do with becoming a mom And i'm like dang, how do you guys already know? I just downloaded the app And nothing else has occurred besides downloading the app and I figured this can be also annoying and very invasive if someone has experienced a miscarriage and now they're being constantly reminded by this, by different applications about motherhood. So the question that I pose to you all is who should really own your data? And from my perspective, it should be you. You should own your own data. so one thing I looked into it is called DWNs or decentralized web nodes. They're open source. They are, basically a personal data storage mechanism. So you can think of it like a Dropbox, but it's encrypted and you as the user have ownership over it and you can control who has access to different types of data in it and how that's made possible is with something called protocols. These are javascript objects or json objects where here you can see you can define who can do certain things, who can read, who can write, who can query your data and all of that. So in this particular situation they're saying for this web app. Anyone can create a chat, but only the author and the recipient can read that chat. And you can, if you've made a pregnancy app or anything like that, you can say, Oh, I only want the provider to be able to read this, or I only want my partner, my, parents or just myself to be able to have access to this data So I thought of like a wild kooky idea. Can I use ai to help me build this app? that uses decentralized web nodes partially i'm a little lazy. So let's see what we could do and I decided to look into different types of ai tools. I've used github copilot heavily I wanted to try something new so i'm trying out goose today and goose is a developer So Agent local to your machine. It's available in your terminal. Also available in your ideas like Visual Studio Code or IntelliJ. And like I said, it's open source and it ends up having full context of your project. Now I do want to emphasize it's not an LLM and we're used to LLMs, which are Known as large language models, they're trained on large amounts of data and use prediction algorithms to generate, summarize, translate, and analyze Content so that content can be anything images video code or just text and we probably most used to using like GPTs from OpenAI like GPT 3, GPT 4, Sonnet, Gemini. Maybe you don't even realize you're using it because sometimes it's abstracted away with a user interface such as ChatGPT or Cloud or GitHub Copilot or Midjourney or Google or Dolly or all these different things. But we're interacting with LLMs behind the scenes. Instead, as I mentioned, Goose is an And now, the AI world, we're having a tough time with definitions right now. So people are struggling with figuring out what exactly is an agent, but the way I've defined it, at least in the context of boost is that it's software that can execute operations without human intervention. Or what little human intervention, and basically their agents are given a goal. They decide on what actions need to be made to reach that goal. And they take that action to reach the goal. So in my personal opinion, I think Goose is more of a semi autonomous agent because it can do everything for you. But it does take some time to pause and check in if you're okay with some of the commands. And I like that because I know that AI hallucinates like I recognize that I know that it makes mistakes so I feel safer knowing that I'm maintaining some level of control. so I also wanted to know just for my personal gain is like agents The way it sounds, it's just automation, but what's the difference? So agents are more given goals to achieve, and then they learn, adapt, and make decisions to achieve those goals. Whereas with automation, it's given a situation, response to the predetermined action, if the situation matches one of its recipes. The way that Goose works in particular is you bring your own LLM, whatever you prefer to use. Do you like OpenAI's GPT's or do you like to use Sonnet by Claude or whatever it is? You bring the one that you think is good for your situation and the one that you like to use. Then you prompt Goose and you say something like, hey, I want to create some unit tests and Goose It goes to the LLM and it's yo, LLM, yo GPT-4 row, Brazil wants to create some unit test. How do I do that? I need you to make a plan for me and then the LL m's, okay, first you're gonna install React testing library. Then you're going to look at this first method and you're going to write a unit test for this and that and so on and so forth. Goose comes back to you, it communicates the plan to you, and then it executes the plan through shell commands. Now we know sometimes shell commands fail, right? Maybe sometimes it didn't type in the right thing. Or your environment's weird or whatever. So we have some different options or goose has different options for what it does when a command fails, it might ask the LLM for an updated plan. It might be like, yo, when I installed react, test and library didn't work. And then it might be like the LLM might be like, Oh, I forgot to specifically tell you which version to install. Sometimes the command might be running too long and it'll stop and tell you, Hey, can you. Tell me what command I need to run or can you run the command yourself? It might be a little bit faster or sometimes the command might need elevated permissions like your password and it might be like yo It asks for your password. I don't know it. Can you run it on your end and tell me when you're done? So just letting you know this demo, the demos I'll be doing will not be perfect because AI is non deterministic, meaning it's unpredictable, likely to have a different result each time. So no matter how much I practiced before, it might show me something crazy. So we're going to switch over to that in a quick second, and start the demo. Okay. So I switched back over to my terminal. because this is where I'm going to interact with Goose. and I made a directory and everything. So what I'm going to go ahead and do is instead of necessarily, so to start a session, I'm going to say Goose session start. And instead of me deciding to create a pregnancy web app, we're like, More relatable first, then we're going to do the pregnancy web app just to see how Boost acts, right? So it started up a session for me and I'm going to say, let's create a collaborative real time drawing web app using Next. js. So right now when it's responding it's going chatting with that llm coming up with a plan for me And it's going to be able to print that plan out and show and communicate that with me. So we'll see it's taking a bit probably because I have a whole bunch of stuff running. Oh, perfect So it came up with a plan. It's it's going to do some basic setup. It's going to set up canvas. It's going to, implement a web socket in the backend. And then it starts creating the project, with these files and all of that for me, which is super exciting. And it's okay, just go ahead and run the project. for me. Oh my God. Perfect. for the sake of time, I actually just, had, my own on the side running or I already used goose to do this. This is you watch a cooking show and they're like, we made some cupcakes. But we already made some cupcakes. So I did use goose to create this beforehand, just for the sake of time, since this is supposed to be a 15 to 20 minute talk. And here we have a collaborative drawing app. It's nothing too crazy, simple. We can always go back and say, Hey, add color, add buttons for toggling erasers and stuff like that. But we have something that we see works. All right. Next thing I want to show y'all is the actual creation of the pregnancy web app, but I want to Do something a little bit more like it's a little bit different here and what i'm gonna do is I recognize that decentralized web nodes. They're not like this common technology They're new, not a lot of people are using them yet, and so therefore the LLM and Goose may not have information about decentralized web nodes like that. So what I did instead is I created what is called a Goose hints file. So I'm going to go ahead and recreate that with you guys and let's see, we're going to do touch Goose hints. And I'm going to open this up in Vim. All right, so in my Goosens file, you can give context to your, to Goose, so it can know how to operate on things. What I did is I went to the documentation for DWNs, and I'm like, I copied and pasted all the relevant parts. So I'm going to go ahead and do that. And let's exit this drawing web app. I'm going to go ahead and copy and paste this so it knows what to do and when to do it. All right, cool. So now we've inserted it and I'm going to do right. Okay, awesome. So we have our goose hints while giving goose a bit of context, but we also want to, or at least I want to make a plan. So we saw goose make its own plan, but you can also make your own plan for goose if you wanted to. and I think of this as the, Oh, I know what to do, but I'm just lazy to manually do it and I want Goose to do this for me. So I'm going to create another, file called a plan. yaml. And, alrighty. And we're going to open it up. We're going to say touch plan. yaml. And, Oh, I already did that. let me see if I have made two. I'm gonna do vi. I'm gonna open it up and say vi plan not yaml. All right now in my plan, I made this ahead of time just for the sake of time We have a kickoff message telling it what we're going to do We're going to create a next. js web app that acts as a pregnancy due date calculator and I gave it tasks I'm like first create a directory install this project or dependency create a ui where users can input their The first day of their last cycle, all of that stuff. And then we're going to say, quit already. Now we can start a square, a goo session, an SQ goo session. We can say SQ goo session, star dash plan. And then we can say plan. yaml. So we're saying, started with this particular plan. and it's supposed to see what I did wrong. Oh, okay. Let's put you in that yammer with a because that's how I spelled the end of the extension So now it's going to go ahead and follow what I told it to do, right? It's making that directory it's cd'ing into the directory and it is going to install all the things I told it to install, like Next and React and Web5 API for the DWN and all of that. Now, for the sake of time, again, like I said, these run pretty long. I've already Done this again and we see the code that it wrote for it. I've already done this on the side Just to make things a little bit faster. It says run npm run dev. I'm already doing that So we can see what it made. I'm gonna bring it over here. It's pretty plain It's pretty plain, but let's say if Your last cycle the first day of your last cycle was I don't know Oh, let's pick a random date April 4, 2024. When you calculate the date, that would say that you're 30 weeks pregnant. your due date will be Wednesday, January 8, 2025. But the thing we care about is, okay, it's been written into our decentralized web node. How do we know that for sure? I told it to print out. If it worked, or to print out the data that it printed to the decentralized web node, and it did. So we have a record here, and this is something I would expect, what my, experience with decentralized web nodes is where it has all the stuff in here, all the encoded data and the record ID. So it was successful, which is really exciting. And actually, I have some time to show you all the web app that I actually had made. So I'm going to cancel all of this Exit so that was just a demo one, but I made a more flourishing one so localhost 3002 A little bit more detailed and we have time to show this. I'm so glad that we do. So this web app, it's not the cutest, but I thought it was cool that I made this with AI. It took time to be a little bit more detailed. And so I'm like, all right, if I get started, click here to log in. And then I put in what would be my username and I want to be. I'm signing in as self, not provider, not partner. Set my username. And then here is where I can like, track my cycle. if I wanted to. So I could say, oh, Monday, October 28. And then maybe the end date. Was Wednesday the 30th and then I can put The flow types maybe started heavy Medium light or something like that. It shows the colors for it or not the colors But the indicators for it and we know it was saved in my personal decentralized web node because it gets printed out here I'm saying that it was it was Added successfully and we can see that same object that I expect to see from a decentralized web node so That was like something I did on the side with ai it would take way too long for me to show you or with goose in particular, and for the designs, I actually used vo. dev So i'll show you all that vo. dev. This is owned by verselle and you can think of oh How would I? how would I like prototype or design like a little web app? This is pretty nice and fun to use. and I want to go back and just show you all if you wanted to get into a goose or try out. AI agents a little bit. I would encourage you to go to github.com/block/goose to check out the repo and install it. And then we have documentation@block.github.io slash goose. thank you so much and I hope this was an interesting talk for you. Bye.
...

Rizel Scarlett

Staff Developer Advocate @ TBD (Block)

Rizel Scarlett's LinkedIn account Rizel Scarlett's twitter account



Join the community!

Learn for free, join the best tech learning community for a price of a pumpkin latte.

Annual
Monthly
Newsletter
$ 0 /mo

Event notifications, weekly newsletter

Delayed access to all content

Immediate access to Keynotes & Panels

Community
$ 8.34 /mo

Immediate access to all content

Courses, quizes & certificates

Community chats

Join the community (7 day free trial)