Transcript for:
Apresentação sobre o Fabric e Prompts de IA

have you ever struggled with crafting effective AI prompts only to see disappointing results having worked with numerous AI projects I've seen firsthand a value of effective prompts and how a mediocre prompt can just hold users back and it doesn't matter if you're using olama or any of the online services instead like chat jbt everyone can get better answers from their AI Services if they just ask better questions but coming up with those questions is actually really hard in this video we're going to look at great ways to ask all the common questions it's all done with a tool and Library called fabric by Daniel misler this could be the ticket to letting AI actually be helpful in your life when we work with AI we just want to ask a simple question and hope that the AI will know what we want that it will read our minds and give us the right answer but then we might get answers that suggest using glue on Pizza a prompt that simply asks to summarize this or Analyze That leaves so much for the model to assume that you're most likely going to get something you weren't expecting and then you come to the likely conclusion that AI is no more than a toy let's say you want to take a YouTube video and get a summary of what was said and what was covered there are a few parts to that request Quest first you have to get the transcript of what was said but the most obvious part is asking the model to analyze the content and spit out a summary take a look at this markdown document that describes an opinionated way of how to summarize something everything is spelled out and described in detail it looks like it's written for a human to read and be able to perform the task and for the most part that's how models work though any incentives a human may need won't do anything for a model this is just one example of what are called patterns in fabric let's take a look at the list of patterns in the GitHub repo create command extract ideas rate response summarize paper each of these folders include at least a markdown document describing the system prompt for a model and sometimes also a read me as well even if this is all you use from fabric it will provide a huge amount of value so what is Fabric and why did it get created Daniel misler created fabric to collect really great prompts and provide a tool that runs them on whatever service or local model that you want to use it also provides a few other helpers that enable you to get the content that the models need to do something useful everything in fabric is done at the command line you obtain text somehow and send it to the fabric command usually as a pipe then you might pipe the output from fabric to another fabric command or to a file to save the answer so let's install Fabric and get started with it this video is being recorded at the end of June 2024 and about a month ago Daniel stated the project will migrate from python to to goang this is mostly an implementation detail that you don't really need to worry about but the result is that it'll make it far easier to install and use but for now it's a little bit awkward so the first step is to clone the repo to your local machine to do this you need to have git installed and in The Next Step you'll also need to have pipex installed so run get clone and the URL of the repo as shown here now change into the new directory and now run pipex install dot then you you can run fabric D- setup this is going to prompt you for API keys for any of the services that you want to use you can enter something or ignore it and just press enter entering nothing means you'll just use ama if you don't have olama visit ama.com and follow the instructions to install it on whatever platform you're using okay so what just got added to your system first there are a few executables that have been added to tolbin directory off of your user directory so you have to make sure that that's in your path this includes the main fabric executable as well as YT for grabbing content from YouTube save for generating a markdown file for obsidian and other tools with front matter Ts for transcribing audio files as well as some tools for running a server I'll take a look at those server Tools in a future video it also created a do config fabric directory also off of your user directory and this includes a EnV file for setting environment variables an include file which lists aliases for running the patterns more easily as well as the patterns themselves the include file has already been added to the bashrc file as well as I think the zshrc file if you use those shells if you use fish instead and I highly recommend the massively useful upgrade to the fish shell you'll just need to add that to your config fish file yourself but it'll work just fine as is okay so let's try this out if you plugged in an API key for YouTube you should be able to run the YT command and give it a video URL I'll do that for my recent video about two updates if I just call YT followed by that URL I'll get a Json blob that lists the transcript as well as some other things to get just the the transcript add the transcript flag now you can pipe that to extract wisdom and we get a summary of what was said this is super useful another Super useful one for YouTube specifically is to create video chapters if we run this we get the text that will be able to paste into the YouTube description to automatically create the chapters for viewers whether you want to do that or not is debatable and there are lots of reasons to never want to do that and and a bunch for the opposite approach as well now this is all pretty useful on its own but other than to demonstrate fabric for this video I never plan to use the executables ever again but I expect to use fabric almost every day this might be a bit confusing well working with AI is almost always going to be more powerful if you're able to create something yourself and the olama API makes working with AI super easy when using python or JavaScript now some folks are going to say that they aren't developers and they aren't capable of learning which is flat out not true having taught both a class of sixth graders in Boston Public Schools as well as groups of adults in Seattle anyone can learn this stuff so let's take a look at part of my workflow for researching video ideas one of the first step is to find well-performing videos and get a summary of each one I can use the YouTube API to get all the videos that match a specific query using something like this this and then I can feed each one to the extract wisdom prompt and I get a report of relevant videos and what they covered when adding extract wisdom to The Prompt for the model I could just import the file directly from fabric but that would imply that I think the prompts are amazing as they are and well I don't I think they are incredible as a starting point the ideas they leverage in each of the prompts are super cool but sometimes they're a little bit too worried dir to be really useful in all cases or or really apply to a specific use case that I don't have so I take the source pattern copy it to my code and tweak as necessary then that becomes my prompt and thus part of my workflow I think fabric is an amazingly cool project and I can't wait to see how they improve on it going forward I hope the community working on the patterns grows and they get even better over time I really hope that other uis start to incorporate fabric patterns within their tools as well there is so much potential here and I hope that you'll take advantage of it in fact I think there are at least two other videos that I'm going to make about fabric first I plan to look at some of the other patterns available in Fabric and when you might use them and then I want to try out using these server tools as well because I think that could be really interesting for lots of folks out there what do you think have you used fabric yet are you doing anything cool with it I would love to hear more about what you're up to if it's part of your workflow you can leave a comment down below thanks so much for watching goodbye