Current section: Real World Examples 15 exercises

Navigating APIs Documentation with AI

AI assistants are pretty good at is helping you understand APIs that you're not familiar with.

For example, when using Sentry I was seeing errors from Chrome extensions that I'm not in control over. I wanted to filter them out, but I didn't know how to do it with the Sentry API.

Instead of digging

Loading lesson


00:00 Something AI is pretty good at is helping you understand APIs that you're not familiar with. So I've got a problem with my Sentry here. In production I'm getting a bunch of error messages in Sentry that say something something Chrome extension. Like I don't have control over the

00:16 Chrome extensions and the errors those things throw. Like that garbage code who I didn't I don't have control over that. And so I don't want to see those in my Sentry but I don't know how to filter those things out. Now I could go digging through the Sentry docs or I could just use my

00:33 AI assistant. So here we're going to open a quick chat and I'm going to say I'm getting errors in my

00:40 Sentry showing errors from Chrome and Firefox extensions. How do I filter those out? And we'll

00:54 let Copilot do all the work here looking through its understanding of the Sentry API from all the code that has been trained on. And it's saying oh you use this before send option and here is the updated code. So it's going to say before send right here if it's a extension or check the

01:12 original exception yada yada yada whatever the case may be. The point is that you can use your AI assistant and its knowledge of the code that it has learned from the open source world and everything else to very quickly find a solution. Now it's important for you to remember as you're

01:30 doing this that you don't want to necessarily trust it right from the get-go. It would probably be a good idea to go and look up the before send option in Sentry to make sure that is still accurate. This is actually where having TypeScript comes in really handy because you can just stick

01:47 it right in here and if you're getting TypeScript errors then you say oh okay so there's something else I might have to think about here. And there could be other ways to do this as well. So sometimes what I'll do is I will say I'll just select this and we'll open the quick chat. I'll

02:05 clear that out and then I'll say is this the best way to detect an error from a browser extension? And then it will take that as part of its context and we just ask it. It's the one who generated

02:22 this code but then we can ask it again to finesse the solution a little bit. And that actually also can be quite helpful. It says there's no definitive way to do this but this works out pretty well,

02:36 whatever. And so then you can based on this information you can then go and do further searches online to solidify your understanding of everything that it's telling you to do.

02:49 So AI assistance can really help you in using APIs that you're unfamiliar with.