Latest / Talk Python To Me / #440: Talking to Notebooks with Jupyter AI
Transcript
- 0:00We all know that LLMs and generative AI have been working their way into many products.
- 0:05Well, it's Jupyter's turn to get a really awesome integration.
- 0:08We have David Kui here to tell us about Jupyter AI.
- 0:11Jupyter AI provides a user-friendly and powerful way to apply generative AI to your notebooks.
- 0:17It lets you choose from many different LLM providers and models to get just the help that you're looking for.
- 0:23And it does way more than just add a chat pane in the UI.
- 0:27Listen in to find out.
- 0:29This is Talk Python To Me, episode 440, recorded October 30th, 2023.
- 0:34Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:52This is your host, Michael Kennedy.
- 0:54Follow me on Mastodon, where I'm @mkennedy and follow the podcast using @talkpython.
- 0:59Both on Bostodon.org.
- 1:01Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
- 1:06We've started streaming most of our episodes live on YouTube.
- 1:10Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows and be part of that episode.
- 1:19This episode is sponsored by Posit Connect from the makers of Shiny.
- 1:23Publish, share, and deploy all of your data projects that you're creating using Python.
- 1:27Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quattro, Reports, Dashboards, and APIs.
- 1:34Posit Connect supports all of them.
- 1:36Try Posit Connect for free by going to talkpython.fm/posit.
- 1:41P-O-S-I-T.
- 1:42And it's also brought to you by us over at Talk Python Training.
- 1:46Did you know that we have over 250 hours of Python courses?
- 1:51Yeah, that's right.
- 1:52Check them out at talkpython.fm/courses.
- 1:57David, welcome to Talk Python To Me.
- 1:59Awesome to have you here.
- 2:00Yeah, thank you, Michael.
- 2:01I'm really excited to see what the AIs have to say today.
- 2:04The AIs?
- 2:05Yeah, language models, sure.
- 2:06Yes, exactly, exactly.
- 2:08Now, you've built a really cool extension for Jupyter that plugs in large language models for people.
- 2:15And it's looking super interesting.
- 2:17So I'm excited to talk to you about it.
- 2:19Yeah, I'm excited to talk about Jupyter AI, too.
- 2:21I've actually presented this twice at one set.
- 2:24Actually, three times.
- 2:26I did a short demo at this tech meetup thing in Seattle.
- 2:30That was actually the first time Jupyter AI was shown to the public.
- 2:33And then I presented at PyData Seattle at Microsoft's Redmond campus.
- 2:38And then I got to present again at JupyterCon in Paris this May.
- 2:43It was a really wonderful experience.
- 2:45But yeah.
- 2:46Wow.
- 2:46Yeah, you're making the rounds.
- 2:47Yeah.
- 2:48I love to talk about Jupyter AI.
- 2:50It happens to get me some plane tickets.
- 2:52Just joking.
- 2:55Honestly, that's like half the bonus of conferences is like awesome places you get to go.
- 2:59The other half probably is the people you meet.
- 3:02You know, it's really cool.
- 3:02Oh, for me, it's like almost like all the people.
- 3:05Like the people are just so great, especially JupyterCon.
- 3:08Yeah.
- 3:08And the JupyterCon videos are now out for JupyterCon 2023.
- 3:12And there's a ton of good looking talks there.
- 3:14Yeah.
- 3:15Lots of really smart people.
- 3:16I mean, like I was chatting to a few folks there.
- 3:20And that's like the only place where you're going to find like people who work at these hedge funds and trading firms just lounging so idly and casually.
- 3:29Right.
- 3:29Like.
- 3:31Yeah.
- 3:32The market's opening and they're chilling.
- 3:33It's all fine.
- 3:34Yeah.
- 3:34Yeah.
- 3:34It's a, there's a lot of smart people there.
- 3:36Yeah.
- 3:37Jupyter more than a lot of programming technologies bring people from all sorts of different places together, different backgrounds.
- 3:44There's like a huge, yeah, there's like a lot of reasons behind that.
- 3:48But long story short, Jupyter's pretty awesome.
- 3:51And that's kind of why I work to contribute to it.
- 3:53Awesome.
- 3:53Well, let's start this whole conversation with a bit of background about yourself.
- 3:57And for people who didn't see your talk and don't know you yet, tell them a bit about you.
- 4:02I didn't really give much of an intro there either, but sure.
- 4:05Yeah.
- 4:06So I've worked for AWS as a software engineer.
- 4:09And I've been with AWS, specifically the AI ML organization at AWS.
- 4:15I've been with them for almost two years now.
- 4:17Right now, I, my manager is actually Brian Granger, who's the co-founder of Project Jupyter.
- 4:23He also works for AWS.
- 4:25Yeah.
- 4:25So he's been offering some technical and product guidance for the things that we're building.
- 4:31And he's a fantastic gentleman to work with.
- 4:35Cool.
- 4:35Yeah.
- 4:35It's a really neat, neat to have him available as a resource, you know, as a colleague.
- 4:40Yeah.
- 4:40You know, it's funny.
- 4:41Like I actually, yeah, I met him internally.
- 4:44So when I first joined, I wasn't working for him, but at tech companies, you can do this internal
- 4:49transfer thing.
- 4:50And basically my old team was kind of the team I just joined right after I joined, it sort
- 4:56of started to dissolve a little because they just launched a product at reInvent, which happens
- 5:01in like December.
- 5:03And then, so I joined in December and it's like, oh, hi.
- 5:07So then I, yeah.
- 5:09And then I joined, I messaged, I saw just, saw Brian Granger's name somehow and I messaged
- 5:14him and I didn't even know that he was the co-founder of Project Jupyter.
- 5:18I just wanted to work for him because I used it before.
- 5:21And yeah, it's a pretty funny story.
- 5:23Indeed.
- 5:24I imagine that project is, is really, you know, this Jupyter AI is a great example, but
- 5:29I just thinking of being say a founder of Jupyter or, or something like that.
- 5:34And these things take on a life of their own.
- 5:36And he's probably in awe of all the stuff happening and all the things going on.
- 5:41And there's probably a lot of stuff in Jupyter.
- 5:43He doesn't even know about, right?
- 5:44It's like, that's happening.
- 5:45Yeah, it's huge.
- 5:46And yeah.
- 5:47And like the leadership structure has changed to accommodate that.
- 5:50So Brian is no longer the benevolent dictator for life.
- 5:54Jupyter Project Jupyter is now governed by a committee decentralized and democratized just
- 5:59to allow it to scale.
- 6:00Yeah, of course.
- 6:01Let's start by talking about a bit of the role of AI and data science.
- 6:07I don't know how you feel about it.
- 6:09Obviously you must be somewhat of an advocate putting this much time and energy into bringing
- 6:14it to Jupyter.
- 6:14Wow.
- 6:15However, personally, when I want to know something, I don't think there's a great specific
- 6:22search result for it straight to ChatGPT or friends.
- 6:27I think there's, there's such a, such a wealth of information there from, I need to take
- 6:31this paragraph and clean it up and make it sound better to, I have this program.
- 6:35I want to convert to another language, or I have this data in this website.
- 6:41How do I get it?
- 6:42You know, like just, you can ask so many open-ended questions and really get great answers.
- 6:47So it seems to me, especially coming from, like I mentioned before, those diverse backgrounds,
- 6:51people not necessarily being like super deep in programming, maybe they're deep in finance,
- 6:56but they do programming that having this AI capability to ask like, Hey, I know I
- 7:01can, but how, what do you think for data science in particular?
- 7:05This is an interesting topic, right?
- 7:09Because I think the whole power of language models stems from their ubiquity and versatility
- 7:13and how they can sort of be very generally applicable.
- 7:16So like the thing about language models is that they're basically statistical models that have
- 7:22been trained on a very, very, very large corpus of data.
- 7:25And that's really to the computer.
- 7:28The computer doesn't really understand English.
- 7:31It doesn't really understand natural language.
- 7:32It has, it's basically making, it has like, when it's trained, it has like knowledge of the
- 7:40distribution of information and how information sort of interacts with other information.
- 7:45Because of that, it's a very, it has a very general applicability, right?
- 7:49And I don't think that's utilities limited to data science.
- 7:53Now, if we're talking about the field of data science specifically, I think language models
- 7:58have extraordinary utility and explanatory natural language tests, which I think everybody is
- 8:05aware of now, now that ChatGPT has been out for almost a year.
- 8:08But I think in the field of data science and other like deep technical fields, they're especially
- 8:14applicable because of how complicated some of the work is.
- 8:18ChatAI can also help analyze and debug code, which JupyterLab also allows you to do.
- 8:24I know it's statistics, but when you look at it, it seems like it understands, right?
- 8:28It seems like it understands my question.
- 8:31And I think one of the really interesting parts is the fact that these LLMs have a context.
- 8:37I would like you to write a program in Python.
- 8:39Okay, great.
- 8:40Tell it to me.
- 8:41I want a program that does X, Y, Z, and then it writes it in Python, which sounds so simple.
- 8:46But up until then, things like Siri and all the other voice assistants, they seemed so
- 8:53disjointed and so not understanding.
- 8:55You're like, I just asked you about the weather.
- 8:57And when I ask you how hot it is, you know, like, how do you not understand that that applies
- 9:01to the weather, right?
- 9:02There's just in the fact that you converse with them over a series of interactions is pretty
- 9:08special.
- 9:08The context.
- 9:09Yeah.
- 9:10It's basically implemented just by passing the history, the whole history appended to your
- 9:15prompt.
- 9:16So, yeah.
- 9:16It's not like any super staple magic or whatever, but it's still very interesting, like, how
- 9:23far you can take it.
- 9:24And yeah, definitely, like, the context allows you to interact with the AI a lot more conversationally
- 9:32and humanly.
- 9:33Like, you don't have to pretend like you're talking to an AI.
- 9:36You can actually just kind of treat it like a human and it still answers questions very well.
- 9:41There was even at Google, there was that engineer who said they thought it had become sentient.
- 9:46And there was that whole drama around that, right?
- 9:49This is such a crazy coincidence.
- 9:50But my roommate is actually friends with that gentleman.
- 9:54Oh, really?
- 9:55I know.
- 9:55Wow.
- 9:56Absolutely crazy coincidence.
- 9:58Like, it's just fun.
- 9:59I just thought it was really funny you bringing it up.
- 10:01It was that, it was a Cajun gentleman, a senior engineer at Google, right?
- 10:05Yeah.
- 10:05Yeah.
- 10:06Very funny, Mike.
- 10:07It's been a little while.
- 10:08I don't remember all the details, but yeah, I mean, it's pretty wild and pretty powerful.
- 10:12I think I've recently read, I'm trying to quick look it up, but I didn't find it.
- 10:16I think they just used LLMs to discover, like, a new protein folding.
- 10:21And it's that kind of stuff that makes me think, like, okay, how interesting that it's, you know,
- 10:26that knowledge wasn't out there in the world, necessarily.
- 10:29I have a lot to say on that subject.
- 10:31So personally, I don't believe that language models are actually intelligent.
- 10:35I think that people are conflating, well, they're certainly not conscious, right?
- 10:41Absolutely.
- 10:41Yeah.
- 10:41As to whether they're intelligent, I don't think they are.
- 10:44I think that intelligence has a, like, intelligence as we know it, as humans know it, has some
- 10:50different characteristics that language models don't really exhibit.
- 10:53They're best thought of as, like, really, really, really good statistical models.
- 10:57Like, are you familiar with the mirror test?
- 11:00Maybe, but I don't think so.
- 11:01Yeah.
- 11:01So it's, like, this idea in animal psychology, but, like, if a cat sees a mirror, it thinks
- 11:07it's another cat because it doesn't recognize its own inflection.
- 11:10Right.
- 11:10You see them all get, like, big and, like, trying to, like, act big and tough to chase it off,
- 11:15and it's just them, yeah?
- 11:16Language models are kind of like that, but for humans, right?
- 11:19Like, if something mimics human-like qualia closely enough, very tempting to think of it
- 11:24as human.
- 11:25Yeah.
- 11:25We see faces on Mars when it's really just erosion, stuff like that.
- 11:29Exactly.
- 11:30I could talk about this, like, for a full hour, but yeah, we should totally move on to
- 11:34another topic before I go on a tirade.
- 11:36Well, when you're saying it's not that intelligent, I'm wondering if maybe you've misnamed this project.
- 11:42Maybe it should just be Jupyter A, like the I?
- 11:45Do you got to drop the I?
- 11:46I don't know.
- 11:47We're just following convention, right?
- 11:48So I still use the term AI.
- 11:50Of course.
- 11:51You got to talk to people.
- 11:52Yeah.
- 11:52Emphasize the artificial, huh?
- 11:54Before we get to Jupyter AI, what came before?
- 11:57How did people work with things like ChatGPT and other LLMs in Jupyter before stuff like Jupyter AI came along?
- 12:03I think initially it was a combination.
- 12:06So the initial motivation for this project came through a combination of sort of a demo put together by Fernando Perez, who is another, I believe.
- 12:16I think he's another co-founder.
- 12:17another co-founder of Project Jupyter, and he put together this demo called Jupyter, which is, it's like spelled like Jupyter, except the last letter is an E.
- 12:27And it's a pun of like ChatGPT, right?
- 12:30Jupyter.
- 12:31There was a combination of that demo project set by Fernando and some motivation from my manager, Brian, who also was, you know, as a leader in the AWS AI organization.
- 12:46You know, he's always trying to think of fancy, fancy new ideas, right?
- 12:51And this is a pretty fun idea to work out.
- 12:54So I put together, I think this was sometime in early January, I put together the first demo.
- 13:00It was private.
- 13:01And I showed it off to the team and they were like, wow, this has a lot of potential.
- 13:05Let's see if we can grow it a bit more.
- 13:07And then as we worked on it for the next few months, it became clear like, oh, wow, this is actually really significant.
- 13:15Let's keep working on this.
- 13:16So it's definitely been a collaborative effort to bring Jupyter AI to where it is today.
- 13:23Sounds like it.
- 13:24Definitely a lot of contributors over on the GitHub listing.
- 13:26Let's get into it.
- 13:27What is Jupyter AI?
- 13:28People can guess, but it's also different in ways than maybe just plug it in a chat window.
- 13:34Jupyter AI is actually, right now, it's two packages.
- 13:38But it's best thought of as just a set of packages that bring generative AI to Project Jupyter as a whole.
- 13:44So not just Jupyter Lab, but also Jupyter Notebook and IPython.
- 13:48Even the shell.
- 13:49How do you, I guess you invoke it by doing like the magic there as well.
- 13:53It's the IPython shell, which is not the same as like a bash shell for instance, your terminal.
- 13:58Interesting.
- 13:59You could dive into a little bit more detail on what these two packages are.
- 14:03So we have the base Jupyter AI package, which is spelled exactly as you might imagine it.
- 14:09It's Jupyter hyphen AI.
- 14:11That is a Jupyter Lab extension that brings a UI to Jupyter Lab, which is the screenshot that you're showing on your screen.
- 14:19But for viewers without a screen, it basically is the package that adds that chat panel to the left-hand side and allows you to speak conversationally with an AI.
- 14:30And then the second package is Jupyter AI magics, which is spelled the same, except at the end, it's spelled hyphen magics.
- 14:38And that is actually the base library that implements some of the AI providers we use and brings things called magic commands to the IPython shell.
- 14:48And magic commands basically let you invoke the library code, aka like calling link, using it to like call language models, for instance.
- 14:56And that allows you to do it inside an IPython context.
- 15:00So what's crazy is that if you run IPython in your terminal shell, you can actually run Jupyter AI from your terminal, which is pretty cool.
- 15:09Yeah, I didn't realize that.
- 15:10I mean, it makes sense, of course, but I hadn't really thought about it.
- 15:14Yeah, I thought more of this like kind of a GUI UI type of thing that was alongside what you were doing.
- 15:18Yeah.
- 15:19We try to make it flexible.
- 15:20And there's reasons for the magic commands, which I can talk about that later, though.
- 15:24This portion of Talk Python To Me is brought to you by Posit, the makers of Shiny, formerly RStudio, and especially Shiny for Python.
- 15:34Let me ask you a question.
- 15:36Are you building awesome things?
- 15:38Of course you are.
- 15:39You're a developer or a data scientist.
- 15:40That's what we do.
- 15:41And you should check out Posit Connect.
- 15:44Posit Connect is a way for you to publish, share, and deploy all the data products that you're building using Python.
- 15:50People ask me the same question all the time.
- 15:54Michael, I have some cool data science project or notebook that I built.
- 15:57How do I share it with my users, stakeholders, teammates?
- 16:00Do I need to learn FastAPI or Flask or maybe Vue or React.js?
- 16:05Hold on now.
- 16:06Those are cool technologies, and I'm sure you'd benefit from them.
- 16:09But maybe stay focused on the data project?
- 16:11Let Posit Connect handle that side of things?
- 16:14With Posit Connect, you can rapidly and securely deploy the things you build in Python.
- 16:18Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quattro, Reports, Dashboards, and APIs.
- 16:24Posit Connect supports all of them.
- 16:27And Posit Connect comes with all the bells and whistles to satisfy IT and other enterprise requirements.
- 16:33Make deployment the easiest step in your workflow with Posit Connect.
- 16:37For a limited time, you can try Posit Connect for free for three months by going to talkpython.fm.
- 16:43That's talkpython.fm/P-O-S-I-T.
- 16:47The link is in your podcast player show notes.
- 16:49Thank you to the team at Posit for supporting Talk Python.
- 16:54Now, one thing, you said this, but I want to emphasize it a little bit in that this will run anywhere IPython kernel runs, which is JupyterLab notebook, but also Google Colab, VS Code, other places as well, right?
- 17:09So pretty much it comes to you wherever your Jupyter type of stuff is, right?
- 17:13Yeah, and the same goes for your lab extensions.
- 17:15So the great thing about lab extensions is that they work anywhere where the product is just sort of built on top of JupyterLab, right?
- 17:23So Google Colab is essentially what Google has is a, well, I can't obvious, I obviously can't attest to what they're actually doing.
- 17:31But most likely, it's like a set of extensions or CSS themes that are built on top of JupyterLab.
- 17:37But like the underlying code is still JupyterLab.
- 17:39It's still mostly JupyterLab.
- 17:41So you can actually just install extensions and they work just fine, which is another reason why JupyterLab is just pretty awesome.
- 17:49Yeah, it sure is.
- 17:51Yeah, JupyterLab itself is basically a pre-selected, pre-configured set of extensions, right?
- 17:57That's pretty cool.
- 17:57That is true, yeah.
- 17:58Giving preference to or showing just what I play with mostly, which is ChatGPT.
- 18:04There's actually a lot of language models that you can work with, right?
- 18:07One of the big things, and this is something I'll circle back to later, is that Jupyter AI is meant to be model agnostic, meaning that we don't discriminate against the choice of model or model provider.
- 18:18Because as an open source project, it's very imperative that we maintain the trust of our users, right?
- 18:24Users have to be sure that this isn't just some product that exists to force them and force or pigeonhole them into using a certain model provider like OpenAI or Anthropic.
- 18:36It's the product makes no opinions.
- 18:38We simply try to support everything as best as we can.
- 18:41And we've written a lot of code to make sure that all of these models and just play nicely together, essentially.
- 18:49Like every model provider, like let's say from Anthropic or AI21 or Cohere, every one of these APIs kind of has its own quirks.
- 19:00Every one of these Python SDKs has its own quirks.
- 19:02And we work very hard to basically iron out the surface and make everything have the same interface.
- 19:09We can talk about that later, though.
- 19:11Sure.
- 19:11And it also makes it pretty easy to try them out, right?
- 19:13If you switch from one to the other.
- 19:15You're like, I wonder how Hugging Face versus OpenAI would do to solve this problem, right?
- 19:21Absolutely.
- 19:21Like that's kind of one of the ideas is like while, you know, certain model providers, they might offer a UI if they're very well funded by their investors.
- 19:32For example, OpenAI to have a UI.
- 19:34But that UI only allows you to compare between different models from OpenAI, which, you know, like as an independent third party looking to use an AI service, like that information is obviously a little biased, right?
- 19:49Like you want to see like what other providers have to offer.
- 19:52Like what does AI21 have?
- 19:53What does Anthropic have?
- 19:55And right now it's really, there really is no like cross model provider like UI or like interface in general.
- 20:04But like that's kind of one of the use cases that Jupyter AI was intended to fit.
- 20:09Yeah.
- 20:09Provides a standard way to interact with all these and sort of compare them.
- 20:13And it's also a UI for them.
- 20:14And if you're using JupyterLab, yeah.
- 20:16I'm not familiar with all of these different models and companies.
- 20:20Do any of those run locally, like things like GPT for all, where it's a local model versus some kind of cloud?
- 20:27Where's your key?
- 20:28Where's your billing details and all that?
- 20:30We actually recently just merged a PR that adds a GPT for all support.
- 20:35Okay.
- 20:36That's included in the release.
- 20:37However, back when we first implemented this a few months ago, I had a few issues with the platform compatibility.
- 20:44So like it wouldn't, so like some of the binaries that we downloaded from GP for all didn't seem to work well on my M1 Mac, for instance.
- 20:53I'd say, yes, we do have local model support, but it's a bit experimental right now.
- 20:58We're still like ironing out the edges and testing, like seeing how we can make the experience better.
- 21:03Like does it sometimes only get bad output because we forgot to install the shared library?
- 21:08Those are the type of questions that our team is wrangling with right now.
- 21:12I see. And maybe I just jumped right into it, but maybe tell people what GPT for all is just real quickly.
- 21:17GPT for all offers a few local models.
- 21:20Actually, they offer several, I believe, not just a few.
- 21:23I think they offer maybe like 10 to 15.
- 21:26It's the numbers getting quite large.
- 21:28Yeah.
- 21:28To the point where I don't know what the right choice is.
- 21:30I'm like, which one do I download?
- 21:32There's they say they're all good.
- 21:33Of course, they're going to say they're good.
- 21:34I'll be frank.
- 21:35I don't actually have that much experience with GPT for all.
- 21:38It's we mainly use them as sort of a provider for like these free and open source language models.
- 21:44Yeah.
- 21:44I think they offer UI as well for multiple platforms.
- 21:48I've only played with them a little bit, just started checking it out.
- 21:50But it's basically a local.
- 21:52You download the model.
- 21:54You run it locally.
- 21:54You don't pay anything because it's just just running on your machine.
- 21:58As opposed to, say, OpenAI and others where you've at least got rate limiting and a certain amount of queries before you have to pay and maybe potentially access to better models like ChatGPT-4 versus 3.5 and so on.
- 22:12That's also taking the characteristics of these service providers for granted, right?
- 22:18So, yes, definitely, while it does hurt the wallet to pay for usage credits, right?
- 22:26It's also pretty remarkable how small the latency has gotten with some of these APIs.
- 22:31I've gotten sub-500 millisecond latency on some of these APIs.
- 22:35And that's really incredible because when I was using GPT-4-All, the latency was a little bit high on running locally with limited compute resources.
- 22:44It's really remarkable how fast these APIs are.
- 22:48It is pretty insane.
- 22:49Sometimes it drives me crazy.
- 22:51I'm just only, again, referring to ChatGPT because I don't have the experience with the others to the degree.
- 22:56But it drives me crazy how it artificially limits the response based on the speed of the response so it looks like it's chatting with you.
- 23:04I'm like, no, I have four pages of stuff because you just get it out.
- 23:08You know, it'll say something like, you can ask, I gave you a five-page program.
- 23:14Let's call it X.
- 23:15If you say, what is X?
- 23:17It'll just start printing it slowly, line by line.
- 23:19Like, you know you just are echoing it back.
- 23:21Just get it out.
- 23:22I want to ask you the next question.
- 23:24You know what I mean?
- 23:25In that case, that's actually a feature request that we've gotten because it doesn't actually slow down.
- 23:31Like, it's not just like a pointless animation.
- 23:33Yeah, the servers are streaming essentially token by token, right?
- 23:37As the language model generates output.
- 23:39So it's kind of more like a progress indicator than a superfluous animation.
- 23:44Yeah.
- 23:44Yeah, of course.
- 23:45But if you've got something large, large blocks of text you're working with, it can be a drag.
- 23:50All right.
- 23:51I wanted to kind of touch on some of the different features that I pulled out that I thought were cool.
- 23:56I mean, obviously it goes without saying that Jupyter AI is on GitHub.
- 24:01I mean, because it's software.
- 24:03And so it's open source, which I don't know if we said that, but obviously free open source on GitHub.
- 24:09BSD3 license.
- 24:11But it's also noteworthy that it's officially under the JupyterLab organization, not under the David account.
- 24:19You know what I mean?
- 24:20It's officially part of the JupyterLab subproject.
- 24:23And yep, as you pointed out, we're under the JupyterLab GitHub org as well.
- 24:27Yeah, that's awesome.
- 24:28Let's talk about some of the different things you can do with it.
- 24:32Some of them will be straightforward, like just like, how do I write a function, Jupyter AI?
- 24:36And others, I think, are going to be a little more interesting.
- 24:40So let's start with asking something about your notebook.
- 24:43Tell us what people can do here.
- 24:45Asking about your notebook basically means like you can actually teach Jupyter AI about certain files, right?
- 24:51So the way you do this is via a slash command in the chat UI.
- 24:55So you type slash learn and then file path.
- 24:58And it essentially teaches the Jupyter AI about that file.
- 25:03Now, it works best with files that are written in natural language, right?
- 25:08So like text files or markup or markdown rather.
- 25:11Yeah.
- 25:12So like those, like, especially like developer documentation as well, right?
- 25:16It works really well with those.
- 25:18It works best with those kinds of files.
- 25:20And after Jupyter AI learns about these files, you can then ask questions about the files.
- 25:27It's learned by prefixing your question with the slash ask command.
- 25:32That is so cool.
- 25:33It is pretty cool.
- 25:34I know it's so cool because what I've done a lot of times, if I want ChatGPT to help me, it's like, I'm like, all right, well, let me copy some code.
- 25:41Right.
- 25:42Then I'm going to have a conversation about it.
- 25:44But a lot of the context of, well, it's actually referencing this other function.
- 25:48And what does that do?
- 25:49Or just a broader understanding of what am I actually working on is missing, right?
- 25:55Because I've only copied it.
- 25:56You can't paste, you know, 20 files into ChatGPT and start talking about it.
- 26:01But with this, you can, right?
- 26:02You can say, learn about, you can say, learn about different things, right?
- 26:06You can say, learn about your notebook, but you can also probably tell it like, learn about my documentation or learn about my data set.
- 26:13And now let me talk to you about it.
- 26:14What's interesting is that the right now, while it works best for natural language documents, we are working on improving the experience for code.
- 26:23From our testing, like the code is mostly the capabilities of Jupyter AI after learning code is right now mostly limited to explaining what code does, but sort of like explains it from the doc screen.
- 26:36So we're working on a way to format the code in a manner that is more interpretable to a language model.
- 26:43Sure.
- 26:44We're working on ways to improve the experience for code.
- 26:47But yeah, definitely the long-term vision is to have Jupyter AI literally be able to learn from the whole directory of files or possibly even a URL, like a remote URL to like, like a documentation page.
- 27:01Yeah.
- 27:01We have some big ideas there.
- 27:02We're still working on them.
- 27:03I want to work with a new package XYZ.
- 27:06Like, I don't know what XYZ is.
- 27:07You know what?
- 27:08Here's where you can learn about it.
- 27:10Go and figure it out.
- 27:11Like, query the PyPI API, get the docs page from the metadata, and then go to that URL, scrape it.
- 27:18Like, lots of things we're exploring.
- 27:20It's still kind of early days for this, right?
- 27:22You've been at it about a year or so?
- 27:23It's been out for a while.
- 27:25Recently, I've had to work on a few other things as well, like Jupyter AI.
- 27:29Unfortunately, I cannot give my entire life to Jupyter AI.
- 27:33So I've been working on a few other things these past few months.
- 27:36But yeah, there are a lot of things that I envision for Jupyter AI.
- 27:41I have a much bigger vision for what I want this project to be and what it can be capable of.
- 27:46Exciting.
- 27:47So this screenshot that you got here in the section that I'll link to in the show notes
- 27:52is cool because you can select a piece of a portion, not even a whole cell,
- 27:56but a portion of code in a cell.
- 27:59And then you can ask, what does this code do?
- 28:01We have an integration with the JupyterLab editor APIs.
- 28:05So you can select a block of code and then include that in your prompt.
- 28:10And it will be appended to your prompt below, right?
- 28:13Right.
- 28:13It's appended to Bob, sorry.
- 28:14You can basically ask, like, so you can select a block of code.
- 28:17So in this screenshot right here, there's this block of code that computes the least common
- 28:23multiple of two integers, right?
- 28:25And you can select that and then click Include Selection and then ask Jupyter AI,
- 28:30what does this do?
- 28:31Which is pretty awesome.
- 28:33Another checkbox is Replace Selection.
- 28:35I'm guessing that is like, help me rewrite this code to be more efficient or if there's
- 28:40any bugs, fix it.
- 28:41So the Replace Selection checkbox is totally independent.
- 28:44So you can actually use both at the same time.
- 28:47And one of the use cases for this is refactoring.
- 28:50And I've actually applied this in practice a few times where you can basically select a
- 28:55block of code and then click both Include and Replace Selection.
- 28:59And then you can format your prompt to say, refactor this block of code.
- 29:03Do not include any additional help or text.
- 29:06And when you send that prompt over, it will actually refactor the code for you in your
- 29:11notebook, which is, yeah, like is, it's pretty great.
- 29:15That's pretty awesome.
- 29:16You know, you could do things like refactor this to use guarding clauses.
- 29:20So it's less nested and less, less arrow code or whatever, right?
- 29:24Yeah.
- 29:25Or like add a doc string, right?
- 29:27Summarize this purpose of this function and then enclose that in the doc string and add it
- 29:32to the function.
- 29:33Right.
- 29:33Or this code is pandas code, but I'd like to use Polars.
- 29:36Please rewrite it for Polars, which is not a super compatible API.
- 29:39It's not like Dask to pandas, where it's basically the same.
- 29:42Yeah.
- 29:42And this kind of circles back to that question that you had asked earlier.
- 29:45I think I went on a tangent there and didn't fully answer.
- 29:48But like, what is like the utility of Jupyter AI to like data practitioners, right?
- 29:53So we're talking data scientists, machine learning engineers, like this, the Include Selection
- 29:57features.
- 29:58We've heard great feedback about how helpful it is to like actually explain a data.
- 30:03So sometimes like you're working with a test set and it's not immediately clear what the
- 30:09features of this test set are or like what this even does, because sometimes it's like
- 30:13high dimensional data and they can literally select it and then click Include Selection
- 30:17and say, and tell Jupyter AI, explain to me what this does.
- 30:21Just like, what is this like data frame stuff?
- 30:24Like, whoa, we got data frames in data frames.
- 30:25Like what's going on here?
- 30:27Like what even is the structure?
- 30:28That's awesome.
- 30:29And I think it's super valuable.
- 30:30I think the, and this is like a little bit I was getting to before one of the features
- 30:33that I think is cool.
- 30:34Whereas if you just go with straight ChatGPT, you copy your code, you paste it into the chat.
- 30:40Hopefully it doesn't say it's too much text and then you can talk about it.
- 30:43But then when you get an answer, you've got to grab it, move it back over.
- 30:46And this just, this fluid back and forth is really nice.
- 30:50Yeah.
- 30:50And that's actually one of the design principles that we worked out when first starting this
- 30:56project officially is the idea that Jupyter AI should be human centered.
- 31:00As in, you shouldn't be expected to be a developer to know how to use this tool.
- 31:05Like this tool is for humans, not, not for any specific persona, just for humans in general.
- 31:10That's awesome.
- 31:11Yeah.
- 31:11So in this case, you select the function that does the lowest common denominator bit and
- 31:16you ask it what it does, it says the code will print out the least common multiple of
- 31:21two numbers passed to it.
- 31:22Super simple, very concise.
- 31:24Okay, great.
- 31:25Now we can go on to the next thing, right?
- 31:27Yeah.
- 31:28There's this LCD function that we're kind of talking about here.
- 31:32This example is recursive, which I think recursion is pretty insane, right?
- 31:39As just a concept for people to get their head around.
- 31:42This is the iterative version.
- 31:43So this is after they, yeah, this is the iterative.
- 31:46Oh, this is after.
- 31:46Yeah.
- 31:46So if we go back up.
- 31:48Oh, one of the things you ask it is things like an example is rewrite this function to
- 31:52be iterative, not recursive.
- 31:54Right.
- 31:54Which is actually really, really awesome.
- 31:56Right.
- 31:57You're like, this is breaking my brain.
- 31:58Let's, let's see if we can not do that anymore.
- 32:01This portion of talk Python to me is brought to you by us.
- 32:06Have you heard that Python is not good for concurrent programming problems?
- 32:11Whoever told you that is living in the past because it's prime time for Python's asynchronous features.
- 32:16With the widespread adoption of async methods and the async and await keywords, Python's ecosystem
- 32:22has a ton of new and exciting frameworks based on async and await.
- 32:26That's why we created a course for anyone who wants to learn all of Python's async capabilities,
- 32:31async techniques and examples in Python.
- 32:33Just visit talkpython.fm/async and watch the intro video to see if this course is for you.
- 32:39It's only $49 and you own it forever.
- 32:42No subscriptions.
- 32:43And there are discounts for teams as well.
- 32:48Another thing I wanted to talk about, and you talked a fair amount about this in your presentations that you did.
- 32:54I can't remember if it was the JupyterCon or the PyData one that I saw, but one of those two.
- 32:59You talked about generating new notebooks and how it's, it's actually quite a tricky process.
- 33:06You got to break it down into little steps because if you ask too much from the AI, it kind of doesn't give you a lot of great answers.
- 33:12Tell us about making new notebooks.
- 33:13Like why would I even use, like I can go to JupyterLab and say file new, it'll make that for me, right?
- 33:18So what's this about?
- 33:19The generate capability is great because it generates a file that is essentially a tutorial,
- 33:25that can be used as a tutorial to teach you about new subjects, right?
- 33:28So like you could, for example, submit a prompt, like slash generate a notebook about asyncio
- 33:34or a demonstration of how to use Matplotlib.
- 33:38And after, so this will take a bit of time, but eventually Jupyter AI is done thinking and generates a file
- 33:45and it names a file up and generates a notebook.
- 33:48And the notebook has a name, it has a title, it has like sections, table of contents,
- 33:53and each of the cells within it, like is tied to some like topic that is determined to be helpful
- 33:59and to answer the user's question.
- 34:02Awesome.
- 34:03Could I do something like, I have weather data in this format from the US weather service.
- 34:10Could you generate me a notebook to plot this XYZ and help me answer these questions?
- 34:15Or like, could I ask it something like that?
- 34:17Not at the moment.
- 34:18So like that would best be done.
- 34:20That would be done best if, since the data is already, like, I'm assuming that the data is already
- 34:26available, right?
- 34:27In some kind of like format.
- 34:29So like in a notebook, you could use a chat UI to like select that entire, select that selection
- 34:34and then tell it, tell Jupyter AI to generate code to plot that data set.
- 34:40So right now, generate only takes a natural language prompt as its only argument.
- 34:45I see.
- 34:46So it's kind of like stateless in that regard.
- 34:48So in this case, you can say slash generate a demonstration of how to use matplotlib.
- 34:53And then the response is great.
- 34:54I'll start working on your notebook.
- 34:56It'll take a few minutes, but I'll reply when it's ready.
- 34:58In the meantime, let's keep talking.
- 35:00So what happens behind the scenes that takes a few minutes here?
- 35:05This is a bit interesting.
- 35:06It does kind of dive deep into like the technical details, which I'm not sure if, which do you
- 35:12want to just like dive?
- 35:13Yeah, let's go tell us how it works.
- 35:14Probably a good chance to explore that.
- 35:16Yeah.
- 35:16Yeah.
- 35:16So slash generate, the first thing is that the prompt is first expanded into essentially
- 35:22a table of contents.
- 35:23So basically we tell the language model, generate us a table of contents conforming to this JSON
- 35:29schema.
- 35:30And when you pass a JSON schema included in your prompt, the language model will be much
- 35:36more, will have a much higher likelihood of returning exclusively a JSON object that matches
- 35:42that JSON schema that you had initially provided.
- 35:45So in our case, we generate a table of contents.
- 35:49And then we take that table of contents.
- 35:51And then we say for each section, we do this in parallel, like generate us some code cells
- 35:56that are appropriate for teaching this section of the document.
- 36:00So for example, for matplotlib, right?
- 36:03Like maybe the first section is your first, like generating your first plot, plotting 3D functions.
- 36:08And the next one is like plotting complex functions with phase or something like that.
- 36:13And then with each of these sections, we then send another prompt template to the language
- 36:18model for each of these sections, asking it to generate the code.
- 36:21And then at the end, we join it all together and then we save it to disk and then emit that
- 36:26message and say, we're done.
- 36:27Maybe the English literature equivalent would be instead of just saying, write me a story about
- 36:33a person who goes on an adventure and gets lost.
- 36:35It's like, I want, give me an outline, bullet points of interesting things that would make
- 36:41up a story of how somebody goes on an adventure and gets lost.
- 36:44And then for each one of those, you're like, now tell this part of the story.
- 36:47Now tell this part.
- 36:47And somehow that makes it more focused and accurate, right?
- 36:51The main limitation is that because we're a model agnostic, language models are limited
- 36:56in how much output they can generate, right?
- 36:59Yeah.
- 36:59The issue we were running into when we were trying to do the whole thing all at once, like generate
- 37:04mean the whole notebook is that some language models just couldn't do it.
- 37:07In an effort to, you know, sort of stay model agnostic, we deliberately implemented, we deliberately
- 37:12broke this process down into like smaller subtasks, each with its own like prompt template in order
- 37:18to accommodate these models that may lack the same token size windows that other models have.
- 37:26I think just even for ones that have large token spaces, I think they still, the more specific
- 37:32you can be, the more likely you're going to get a focused result instead of a wandering vague result.
- 37:38Teach me about math or teach me how to factor, you know, how to integrate this differential,
- 37:44solve this series of differential equations or physics.
- 37:47Like you're going to get a really different answer to those two questions.
- 37:50Yeah.
- 37:51That's also circles back to like a topic I didn't, I did want to call out, but I don't, I don't think
- 37:56we hit on it.
- 37:56Is that the chat UI actually does support rendering in both Markdown and LaTeX, which is a markup
- 38:03language for math.
- 38:04So you can ask it both complex engineering and mathematical questions, like asking it to explain
- 38:10you like, yeah.
- 38:11So like there might be a demo here.
- 38:13I'm not sure if it's on this page though.
- 38:16So if I had a Fourier, fast Fourier transform in LaTeX and I put it in there and say, what
- 38:22is this?
- 38:22It'll say it's a fast Fourier transform or something like that.
- 38:25Yes.
- 38:25And it also works the other way around.
- 38:27You can also use it to say like, Hey, explain to me what the 2D Laplace equation is, or explain
- 38:33to me like, what does this do?
- 38:35Right.
- 38:35And it will actually generate and format the equation inside the chat UI, which is really
- 38:42remarkable.
- 38:43I love that feature.
- 38:44It's actually really awesome.
- 38:45And it's also really appropriate for a scientific oriented thing like Jupyter, right?
- 38:50The remarkable thing is that because chat UBT and like other such language models, like the
- 38:56ones from Anthropic and AI21, because like they are founded on the premise of where like their
- 39:02functionality comes from having such a large corpus of data.
- 39:05They know a remarkable amount of information.
- 39:07So like we've tried like some example notebooks of quantum computing and explained those really
- 39:13well.
- 39:13We try, I tried one of like the Black Scholes options pricing model used in financial engineering.
- 39:19It's really remarkable.
- 39:21Like the utility that it offers just by being there in the side panel.
- 39:25Like you essentially have like a math wizard available to you and to your lab all the time.
- 39:30It's probably better than a lot of math professors in terms of not necessarily in the depth of
- 39:35one area.
- 39:36But, you know, if you ask somebody who does like abstract algebra about real analysis, they're
- 39:42like, I don't really do that part.
- 39:43Or if you ask somebody about real analysis about number theory, like I don't really, you can
- 39:46hit on all the areas, at least a generalist professor sort of thing.
- 39:50We talked about the slash learn command.
- 39:53That's pretty excellent already and where that's going.
- 39:56So I'm pretty excited about that.
- 39:58Yeah.
- 39:58It actually does have a lot of interesting technical tidbits to it.
- 40:02Like the implementation.
- 40:03Okay.
- 40:04Yeah.
- 40:04Actually, this is one of the really challenging things with these chat bots and things.
- 40:09For example, I've tried to ask ChatGPT if I gave it one, just one of the transcripts from
- 40:14the show.
- 40:15I want to have a conversation about it.
- 40:16It says, ah, that's too much.
- 40:17I can't do it.
- 40:18You know, it's just, it's just one, one show.
- 40:21And in doc, like in your documentation, there might be a lot of files in there, right?
- 40:25More than just one transcript levels worth.
- 40:28So that alone, I think it's kind of interesting just how to ingest that much data into it.
- 40:32Yeah.
- 40:32And you know, this is a very interesting subject and it actually is a bit complex.
- 40:38I'm sure it is.
- 40:39I think there are some other features you want to discuss.
- 40:41Let's dive into this for just a minute because I think it is interesting.
- 40:44How do you make, because this makes it yours, right?
- 40:46It's one thing to ask vaguely, like, tell me about the Laplace equation and how does it
- 40:50apply to heat transfer?
- 40:51Like, okay, great.
- 40:52I have a specific problem with a specific library and I want to solve it.
- 40:56And you don't seem to understand about enough of it.
- 40:58So it really limits the usefulness if it doesn't, if it's not a little closer to what you're
- 41:03actually doing.
- 41:03And I think this brings it closer.
- 41:04So yeah, tell us about it.
- 41:06Language models aren't just governed by like their intelligence, however you measure that,
- 41:11right?
- 41:11They're also governed by how much context they can take.
- 41:14So one of the reasons ChatGPT was so remarkable is that it had a great way of managing context
- 41:19through conversation history.
- 41:20And that seemingly small leap and seemingly small feature is what made ChatGPT so remarkably
- 41:30disruptive to this industry is because of that additional context.
- 41:34And we think about extending that idea.
- 41:37How do we give an AI more context, make it even more human-like and personal?
- 41:41Well, the idea is similar.
- 41:44We add more context and that's what learning does, right?
- 41:47And so the way learning works is that we're actually using another set of models called
- 41:52embedding models.
- 41:53And embedding models are very, very underrated in the AI-like modeling space, right?
- 42:00These are really remarkable things.
- 42:02And they have this one, I'll only cover like the most important characteristic of embedding
- 42:07models, which is embedding models take syntax and map it to a high-dimensional vector space
- 42:15called a semantic space.
- 42:16And inside of the semantic space, nearby vectors indicate semantic similarity.
- 42:23I know that's like a lot of words, so I'm going to break that idea down, right?
- 42:26So like canine and dog, let's take these two words as an example, right?
- 42:30These two words are completely different.
- 42:32They don't even share a single character and similarity together, right?
- 42:36They don't have a single letter in common with one another.
- 42:39And yet we know as humans that these two dogs, these two words mean the same thing.
- 42:44They refer to a dog.
- 42:46So like they have different syntax, but the same semantics, the same semantic meaning.
- 42:51So their vectors would be...
- 42:52Would be mapped close.
- 42:53Would be very close by whatever metric you're using, yeah.
- 42:56If you extend this idea and like you imagine, okay, what if you split a document?
- 43:01What if you split a file into like one to two sentence chunks?
- 43:05And then for each of these like sentences, let's just say sentences, for example.
- 43:08Let's say we split a document to sentences and then we take each of those sentences and then map,
- 43:14use an embedding model to compute their embedding and then store them inside of a vector store.
- 43:19Like basically like a local database that has, that just stores all of these vectors in like a file or something, right?
- 43:26Now imagine what happens if we then take a prompt, like a question that we might have,
- 43:31encode that as an embedding.
- 43:33And then we say to the vector store, okay, for this prompt embedding,
- 43:37find me all of the other embeddings are close to this.
- 43:41Well, what you've just done in this process is called a semantic search.
- 43:46So it's kind of like syntax search, except instead of searching based off of key words or tokens or other syntactic traits,
- 43:53you are searching based off the actual natural language meaning of the word.
- 43:59This is much more applicable when it comes to like natural language prompts and natural language,
- 44:04like corpuses of data, because this is like the actual information that's being stored.
- 44:09Not, we don't care about the characters.
- 44:11We care about the information that they represent, right?
- 44:14The essence of it, yeah.
- 44:15And these vectors are computed by the larger language model?
- 44:18The vectors, the embeddings are computed by an embedding model.
- 44:22And they're actually a separate category of model that we have our own special APIs for.
- 44:27So in our settings panel, you can change the language model.
- 44:31And I think we already discussed that, right?
- 44:33Yeah.
- 44:33But what's interesting is that underneath that, you'll also see a section that says embedding model.
- 44:38And you can change the embedding model to like, we also offer that same principle of model agnosticism there.
- 44:45Yeah.
- 44:46This is very interesting.
- 44:47Very interesting.
- 44:48Let's talk a little bit about the format.
- 44:49You said, obviously, that you can do LaTeX, which you say in, you say math, right?
- 44:54You tell us, give me math.
- 44:56Yeah.
- 44:56Give me math.
- 44:56Which is, yeah, it's pretty interesting.
- 44:58But you can do images, markdown, code, HTML, JSON, text.
- 45:02There's a lot of, a lot of different formats you can get the answer back in.
- 45:05When you use the AI magics, we can pass them to like a renderer first before we show the output to the user.
- 45:13Yeah.
- 45:13And with the AI magic, the %AI in the cell, you can also specify, that's where you put the format potentially,
- 45:20but you can also specify the model and the service, I guess, for the provider.
- 45:25The IPython magics are basically stateless in the sense that you always have to specify the model explicitly.
- 45:32They don't operate off the premise that you are using JupyterLab.
- 45:36They don't run off the premise that you have JupyterLab installed or are using the lab extension that we offer.
- 45:42Because of that, like the model is stated explicitly every time.
- 45:46That's by design.
- 45:47When you sit down, what is your JupyterAI provider set to?
- 45:53What's your favorite?
- 45:54As a developer, I like literally pick a random one to give the most test coverage at all times.
- 46:01And that's actually a great way of finding bugs.
- 46:03So, yeah, I don't have a favorite one.
- 46:05My favorite one is the one that works.
- 46:07And hopefully that should be all of them.
- 46:09So.
- 46:09I guess you can also tell it to forget what I was talking about.
- 46:14We're going to start over.
- 46:15That's pretty interesting that you can do that along the way because you maybe had a bunch of conversations.
- 46:20And we talked about the benefit of it, like knowing the history of that conversation.
- 46:24But you're like, all right, new idea.
- 46:25Switching topics.
- 46:27Chat.
- 46:27I think the last one I wanted to talk about specifically was interpolating prompts.
- 46:32Kind of almost like f-strings where you can put in the prompt text, you can put a variable and then other parts of your notebook or program can set that value.
- 46:43Yeah.
- 46:43Tell us about this.
- 46:44You can define a variable in your IPython kernel, right?
- 46:48So, like, and that's just dumb, but just like how you define any other variable.
- 46:52But what's interesting is that IPython is actually aware of the variables that you are defining.
- 46:57So, we can programmatically access that when we implement the magic, right?
- 47:02Basically, if you define any variable at the top level scope, like let's say poet equals Walt Whitman, right?
- 47:09So, we have a name variable called poet.
- 47:10And then you can send a prompt over, like, write a poem in the style of curly braces poet and curly braces.
- 47:18And when that is run, the value of that variable is interpolated and substitutes around the curly braces.
- 47:27So, the final prompt becomes write a poem in the style of Walt Whitman.
- 47:31And when that prompt is sent, well, you can imagine it generates a poem of Walt Whitman.
- 47:35The variable interpolation that we offer in IPython is very useful for, like, very quick, like, debugging.
- 47:42So, you can actually reference a cell in the notebook directly.
- 47:47I think a lot of people don't know this, but, like, in a Jupyter notebook, there's, like, the in and out indicators to the left of each cell.
- 47:54So, it'll say, like, in dot one, out dot one, right?
- 47:57So, those are actual variables.
- 47:59And you can use them here, too.
- 48:01So, you can reference, like, debug.
- 48:03Tell me why this code is failing.
- 48:05Curly braces in dot one.
- 48:07That's, you just, on the screen there, just scroll there.
- 48:11Explain what this does, the in bracket 11, or what went wrong in out bracket 11, or, yeah, something like this.
- 48:19Right.
- 48:19It's fine long as you don't go and rerun that cell.
- 48:22Yeah.
- 48:22But, like you said, this is not for long term.
- 48:25You can make it independent of the order of execution just by, like, assigning whatever variable that is to, whatever, like, content that is to a named variable.
- 48:35That way, no matter what order you run them, like.
- 48:38People might be thinking, when you describe this interpolation thing, just bracket, boom, bracket, curly brace, curly brace, you're like, we already have that in Python.
- 48:46You just put an F in front of the string, and so on.
- 48:48But this is in the message that goes to the AI cell magic, not straight Python, right?
- 48:55That's the relevance.
- 48:55That's why this is interesting, right?
- 48:57Yes.
- 48:57I guess it really comes down to the different models that you select.
- 49:00So, you opt into this a little bit, or maybe you need to understand it that way.
- 49:05But talk to us a bit about privacy.
- 49:07If I select something and say, what does this do?
- 49:10What happens?
- 49:11Something important to emphasize here is that whenever you use a language model that's hosted by a third party, so, like, it's running on their servers, right?
- 49:21Regardless of whether this model is free or not.
- 49:24Like, the fact that you're sending data to a third party over the internet, like, that's where the privacy and security concerns happen, right?
- 49:33And that happens, like, whenever, like, you're sending data across the wire over the internet.
- 49:37But we have some special safeguards in place here, specifically to assuage fears of, like, concerns over privacy and security that a lot of open source users have.
- 49:49And one of the important ideas here is that Jupyter AI is both transparent and traceable.
- 49:54So, when we send a prompt to a language model, that's always captured in the server logs by default.
- 50:02So, that's always being logged.
- 50:03That's always being captured.
- 50:04Yeah.
- 50:05So, like, it's always going to be traceable.
- 50:07There's no secret back channel.
- 50:09Like, you tell them, people, this is happening, okay?
- 50:11Yeah.
- 50:12So, if, like, an operator needs to audit, like, oh, dang, like, let me check just to make sure nothing scary was sent over to OpenAI.
- 50:20Well, the operator can review the server logs and make sure that all usage is compliant with whatever privacy policy their company has, right?
- 50:30And Jupyter AI is also exclusively user-driven, meaning that we will never, by default, send data to a language model, even if you selected one, right?
- 50:43Like, we will never send data to that language model until explicit action is done by the user.
- 50:48So, in this case, like, clicking the send button, clicking shift, enter, and running to sell.
- 50:53Yeah.
- 50:53Nothing is sent to language model or embedding model until that happens.
- 50:57That's really all you can do.
- 50:58That sounds great.
- 50:59Because you don't control what happens once it hits OpenAI or Anthropic or whatever, right?
- 51:04That's why the transparency is so important, right?
- 51:06And, oh, I forgot to touch on traceability.
- 51:09So, like, with these AI-generated cells, right, so, like, the output cells, in the metadata, we indicate that with, like, the model that was used to generate an output cell, if it comes from the Jupyter AI magic.
- 51:21So, that way, it's also, like, traceable not just in the logs, but, like, in the actual files metadata and stuff as well.
- 51:28That's cool, because it'd be really easy to say, have the cell magic, and then, you know, how notebooks store their last output.
- 51:35Like, if you upload them to GitHub, they'll keep their last output, unless you say clear all cell outputs.
- 51:40Depending on which model you have selected, you might not get the same output, not even close to the same output.
- 51:46So, you might want to know, like, well, how did you get that picture?
- 51:49Oh, I had Anthropic selected and not the other, right?
- 51:52Like, that is really nice.
- 51:53I've actually used the server logs myself to debug, like, prompt templates, for instance, right?
- 51:58So, like, because what we show in the logs is the full prompt.
- 52:02Like, after applying our template, after applying, like, the edits, like, that's what's actually shown.
- 52:07So, that's really also really helpful for developers who need to debug what's happening.
- 52:12Yeah, of course.
- 52:12Or if you're a scientist and you're looking for reproducibility, I doubt there's much guaranteed reproducibility even across the versions of the same model.
- 52:20But at least you were in the same ballpark, you know, at least I know what model it came from.
- 52:25You can set the temperature to zero, but it won't generate very fun output.
- 52:29That is a workaround if you truly need a reproducibility.
- 52:33I suppose, yeah.
- 52:34The temperature being the ability to tell it how creative do you want to be or how focused do you want the answer to be, right?
- 52:41It's a hyperparameter that basically governs the randomness, like, how far away from the mean it's willing to deviate.
- 52:49Kind of, yeah, vaguely describable as creativity, yeah.
- 52:52Yeah, I suppose.
- 52:53I guess if you're looking for privacy, the GPT for all might be a good option.
- 52:58Oh, yeah, absolutely.
- 52:59For that, right?
- 52:59Because that's not going anywhere.
- 53:01Yeah.
- 53:01However, some of them do have license restrictions.
- 53:04And that's also why we have also taken it this low when it comes to adding more GPT for all support is because different models are licensed differently.
- 53:14And that's another consideration we have to take in mind.
- 53:17Yeah.
- 53:17Yeah, of course.
- 53:18You're playing in a crazy space with many different companies evolving licenses.
- 53:22Yeah.
- 53:23Let's close it out with one more thing here.
- 53:25Maybe two more things.
- 53:26One is there's a lot of interest in these agents.
- 53:30And it sounds, for example, your create a notebook that does this sort of thing, like teach me about Matplotlib, is a little bit agent driven.
- 53:38Thinking of like LangChain and stuff like that, or even GPT engineer.
- 53:43What's the story?
- 53:45Do you have any integrations with that?
- 53:46Any of those types of things?
- 53:47We're working on one where basically you won't need to use slash commands anymore.
- 53:52So this is like, again, like we're just kind of playing around with this, seeing how well it behaves.
- 53:58But we are trying to use agents to, for example, remove the need to use slash commands.
- 54:02So when you say, like generate a notebook, like it will just generate one.
- 54:07You don't have to note a slash command for that.
- 54:09Like it will just know.
- 54:10So like, yeah.
- 54:11However, we don't have any, we don't use agents at the present moment now.
- 54:15And the reason for that is that they have very, they're not very model agnostic, at least the ones from our research.
- 54:23Like they only work well for a specific model and a specific prompt template.
- 54:27But beyond that, it's hard.
- 54:29All right.
- 54:29Last question.
- 54:30Running out of time here.
- 54:31Yeah.
- 54:32What's your favorite thing you've done with Jupyter AI?
- 54:33Not like a feature, but what have you made it do to help you that you really like?
- 54:38Teach Jupyter AI about Jupyter AI.
- 54:40That's an easy one.
- 54:42So we have the documentation.
- 54:44What did it learn?
- 54:44Well, learn about itself.
- 54:46So like I was at a conference and I, so this was at PyData and I actually got enough questions to the point where I did, I just downloaded, I had the documentation already available in my home directory because of some other previous.
- 55:00Or restructured text them.
- 55:01Yeah.
- 55:02And the markdown source.
- 55:03Okay.
- 55:03The markdown source.
- 55:04Right.
- 55:05And then I just had slash learn.
- 55:07I just learned that doc.
- 55:08And then I just had that laptop on the side and told people, like, if you have any questions, try answering that.
- 55:14Yeah.
- 55:15In case you don't want to wait in line.
- 55:17So yeah, that was, yeah, it's pretty remarkable.
- 55:21Yeah.
- 55:21The learn feature by far is definitely my favorite.
- 55:24And it's the one I want to spend the most time developing and pushing it better.
- 55:28I think there's massive possibility there because to deeply understand what you're working on in a multifaceted way.
- 55:36What are the documentations?
- 55:37What is the code?
- 55:37What is the data?
- 55:38What is the network topology and servers I can work with?
- 55:41Like all of that kind of stuff or pick your specialty.
- 55:44Yep.
- 55:45And that's how we make AI more human.
- 55:47Right before it takes over.
- 55:48So no problem there.
- 55:49Oh, yeah.
- 55:49Just kidding.
- 55:50Just kidding.
- 55:51Yeah.
- 55:51Let's wrap it up.
- 55:52I think we're out of time, David.
- 55:53So final question.
- 55:55Some notable PyPI package, maybe something awesome you discovered to help you write Jupyter AI.
- 56:00Anything you want to give a shout out to?
- 56:02We definitely use LangChain a lot.
- 56:04And it has some pretty fantastic integrations.
- 56:07And we're actually built on top of LangChain, really.
- 56:10But also Dask.
- 56:12Dask is really nice.
- 56:13Yeah.
- 56:13Dask has some great visualization capabilities for when you're doing parallel compute.
- 56:18It has a great dashboard that's also available in Jupyter Lab.
- 56:22Yeah.
- 56:22That shows it running and distributing the work in Jupyter Lab.
- 56:26It's amazing.
- 56:26And one of the contributors also reached out once.
- 56:29He had heard that I was integrating Dask into Jupyter AI.
- 56:33He actually reached out to help us and offer direct one-on-one guidance with using Dask.
- 56:38And yeah, it's just been a fantastic experience using Dask.
- 56:42Yeah.
- 56:43I have no complaints.
- 56:44It's just pretty awesome that somebody has finally made parallel and distributed compute better in Python.
- 56:50For sure.
- 56:52Yeah.
- 56:52Yeah, Dask is cool.
- 56:53Dask is very cool.
- 56:53All right.
- 56:54Well, final call to action.
- 56:55People want to get started with Jupyter AI.
- 56:57What do you tell them?
- 56:57I can install Jupyter AI or Konda.
- 56:59Konda install works too.
- 57:01It's on both.
- 57:02Awesome.
- 57:02Well, really good work.
- 57:03This is super interesting.
- 57:04And I think a lot of people are going to find value in it.
- 57:07So I can see some nice comments in the audience that people are excited as well.
- 57:11So thanks for being here.
- 57:12Yeah.
- 57:13Thank you so much.
- 57:13Yeah.
- 57:13See you later.
- 57:14Bye-bye.
- 57:14Bye.
- 57:15This has been another episode of Talk Python To Me.
- 57:18Thank you to our sponsors.
- 57:20Be sure to check out what they're offering.
- 57:21It really helps support the show.
- 57:23This episode is sponsored by Posit Connect from the makers of Shiny.
- 57:29Publish, share, and deploy all of your data projects that you're creating using Python.
- 57:33Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quattro, Reports, Dashboards, and APIs.
- 57:40Posit Connect supports all of them.
- 57:42Try Posit Connect for free by going to talkpython.fm/posit.
- 57:46P-O-S-I-T.
- 57:48Want to level up your Python?
- 57:50We have one of the largest catalogs of Python video courses over at Talk Python.
- 57:55Our content ranges from true beginners to deeply advanced topics like memory and async.
- 58:00And best of all, there's not a subscription in sight.
- 58:02Check it out for yourself at training.talkpython.fm.
- 58:06Be sure to subscribe to the show.
- 58:07Open your favorite podcast app and search for Python.
- 58:10We should be right at the top.
- 58:12You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the
- 58:17direct RSS feed at /rss on talkpython.fm.
- 58:21We're live streaming most of our recordings these days.
- 58:24If you want to be part of the show and have your comments featured on the air, be sure to
- 58:28subscribe to our YouTube channel at talkpython.fm/youtube.
- 58:32This is your host, Michael Kennedy.
- 58:34Thanks so much for listening.
- 58:35I really appreciate it.
- 58:36Now get out there and write some Python code.
- 58:38Bye.
- 58:39Bye.
- 58:40Bye.
- 58:40Bye.
- 58:40Bye.
- 58:41Bye.
- 58:41Bye.
- 58:41Bye.
- 58:42Bye.
- 58:43Bye.
- 58:44Bye.
- 58:45Bye.
- 58:46Bye.
- 58:46Bye.
- 58:46Bye.
- 58:46Bye.
- 58:46Bye.
- 58:47Bye.
- 58:48Bye.
- 58:48Bye.
- 58:48Bye.
- 58:48Bye.
- 58:48Bye.
- 58:48Bye.
- 58:49Bye.
- 58:50Bye.
- 58:50Bye.
- 58:50Bye.
- 58:50Bye.
- 58:51Bye.
- 58:52Bye.
- 58:52Bye.
- 58:52Bye.
- 58:53Bye.
- 58:54Bye.
- 58:54Bye.
- 58:55you
- 58:56you
- 58:56you
- 58:57Thank you.
- 58:59Thank you.