Talk Python To Me - 第528期:利用LLM构建模块开发Python应用 封面

第528期:利用LLM构建模块开发Python应用

#528: Python apps with LLM building blocks

本集简介

在本期节目中,我与Vincent Warmerdam探讨如何将大语言模型(LLM)视为Python应用中普通的API接口——通过明确边界划分、精简功能端点和完善监控机制。我们将深入探讨接口封装模式、响应缓存与检查策略,以及如何评估LLM API在架构中的实际价值。 节目赞助商 Seer:AI调试工具,代码TALKPYTHON NordStellar Talk Python课程 节目相关链接 Vincent的X账号:@fishnets88 Vincent的Mastodon账号:@koaning Python课程《LLM构建模块》:training.talkpython.fm 2024年Top Talk Python节目:talkpython.fm LLM应用-Datasette:llm.datasette.io DiskCache磁盘缓存文档:grantjenks.com smartfunc文档转LLM函数工具:github.com Ollama本地AI平台:ollama.com LM Studio本地AI工具:lmstudio.ai marimo新一代Python笔记本:marimo.io Pydantic数据验证库:pydantic.dev Instructor复杂模式验证工具:python.useinstructor.com marimo与PydanticAI深度解析:youtube.com Cline AI编程助手:cline.bot OpenRouter统一LLM接口:openrouter.ai Leafcloud云服务:leaf.cloud OpenAI通过Atlas浏览器寻求"谷歌Chrome时刻":arstechnica.com YouTube观看本期节目:youtube.com 第528期深度解析:talkpython.fm/528 节目文字稿:talkpython.fm 主题曲:开发者说唱 🥁 Flask容器呈现 🎸:talkpython.fm/flasksong ---== 保持联系 ==--- YouTube频道:youtube.com/@talkpython Bluesky账号:@talkpython.fm Mastodon账号:@talkpython@fosstodon.org X.com账号:@talkpython Michael的Bluesky:@mkennedy.codes Michael的Mastodon:@mkennedy@fosstodon.org Michael的X.com:@mkennedy

双语字幕

仅展示文本字幕,不包含中文音频;想边听边看,请使用 Bayt 播客 App。

Speaker 0

在本期节目中,我将与Vincent Wormerdam探讨如何将LLMs视为Python应用中又一个有明确边界、专注小端点且监控良好的API。

In this episode, I'm talking with Vincent Wormerdam about treating LLMs as just another API in your Python app with clear boundaries, small focused endpoints, and good monitoring.

Speaker 0

我们将深入探讨封装这些调用的模式、缓存与检查响应的方法,以及如何判断LLM API在架构中真正发挥价值的位置。

We'll dig into patterns for wrapping these calls, caching and inspecting responses, and deciding where an LLM API actually earns its keep in your architecture.

Speaker 0

这里是《TalkPython to me》第528期,录制于2025年10月23日。

This is TalkPython to me, episode 528 recorded 10/23/2025.

Speaker 1

Python对我来说。

Python to me.

Speaker 1

没错。

Yeah.

Speaker 1

我们准备好了。

We ready to roll.

Speaker 1

升级代码。

Upgrading the code.

Speaker 1

无惧岁月流逝。

No fear of getting old.

Speaker 1

不会在空中沉没。

Ain't sinking the air.

Speaker 1

新框架已现眼前。

New frameworks in sight.

Speaker 1

极客说唱已就位。

Geeky rap on deck.

Speaker 1

夸特团队。

Quart crew.

Speaker 1

是时候团结一致了。

It's time to unite.

Speaker 1

我们从金字塔起步。

We started in pyramid.

Speaker 1

巡航在老派轨道上。

Cruising old school lanes.

Speaker 1

拥有那个稳固基础。

Had that stable base.

Speaker 1

是的,

Yes,

Speaker 0

欢迎收听TalkPythonomy,这是面向Python开发者和数据科学家的头号播客。

Welcome to TalkPythonomy, the number one podcast for Python developers and data scientists.

Speaker 0

我是主持人Michael Kennedy。

This is your host, Michael Kennedy.

Speaker 0

我是一位拥有超过25年编程经验的PSF研究员。

I'm a PSF fellow who's been coding for over twenty five years.

Speaker 0

让我们在社交媒体上保持联系。

Let's connect on social media.

Speaker 0

你可以在Mastodon、BlueSky和X(原推特)上找到我和TalkPython。

You'll find me and TalkPython on Mastodon, BlueSky, and X.

Speaker 0

所有社交媒体链接都在节目备注中。

The social links are all in the show notes.

Speaker 0

你可以在talkpython.fm上找到过去十年的所有节目内容。

You can find over ten years of past episodes at talkpython.fm.

Speaker 0

如果你想参与节目录制,可以加入我们的直播环节。

And if you wanna be part of the show, you can join our recording livestreams.

Speaker 0

没错。

That's right.

Speaker 0

我们会在YouTube上直播每期节目的原始未剪辑版本。

We livestream the raw uncut version of each episode on YouTube.

Speaker 0

只需访问talkpython.fm/youtube即可查看即将录制的时间安排。

Just visit talkpython.fm/youtube to see the schedule of upcoming events.

Speaker 0

记得订阅并开启通知铃铛,这样每次我们开始录制时你都会收到提醒。

And be sure to subscribe and press the bell so you'll get notified anytime we're recording.

Speaker 0

本节目由Sentry赞助播出。

This episode is brought to you by Sentry.

Speaker 0

别让那些错误悄无声息地溜走。

Don't let those errors go unnoticed.

Speaker 0

就像我们TalkPython一样使用Sentry吧。

Use Sentry like we do here at TalkPython.

Speaker 0

立即在talkpython.fmcentry注册。

Sign up at talkpython.fmcentry.

Speaker 0

本节目由Nordstellar赞助播出。

And it's brought to you by Nordstellar.

Speaker 0

Nordstellar是Nord Security家族推出的威胁暴露管理平台,该团队也是NordVPN的开发者,它整合了暗网情报监测、会话劫持防护、品牌与域名滥用检测以及外部攻击面管理功能。

Nordstellar is a threat exposure management platform from the Nord Security family, the folks behind NordVPN, that combines dark web intelligence, session hijacking prevention, brand and domain abuse detection, and external attack surface management.

Speaker 0

了解更多并开始为您的团队提供安全保障,请访问talkpython.fm/nordstellar。

Learn more and get started keeping your team safe at talkpython.fm/nordstellar.

Speaker 0

嘿。

Hey.

Speaker 0

欢迎来到Talk Python。

Welcome to talk python me.

Speaker 2

嗨。

Hi.

Speaker 2

欢迎回来。

Welcome back.

Speaker 2

很高兴来到这里。

Pleasure to be here.

Speaker 2

是的。

Yeah.

Speaker 2

这应该是我们第二次在Talk Python节目上交流了,我想。

It's it's been like this is our second talk python interview, I think.

Speaker 2

我们之前在社交媒体上也有过互动。

We've interacted before also on socials and all that.

Speaker 2

不过,是的,这是第二次了。

But, like, yeah, second time.

Speaker 2

耶!

Yay.

Speaker 2

很高兴来到这里。

Happy to be here.

Speaker 0

耶!

Yay.

Speaker 0

是啊。

Yeah.

Speaker 0

你能回来真是太让人兴奋了。

It's very exciting to have you you back.

Speaker 0

我...你知道,我正试着回忆。

I you know, I'm trying to remember.

Speaker 0

我之前写了一篇博客文章,关于去年最受欢迎的几期节目。

I did an app blog post on the most popular episodes of last year.

Speaker 0

如果我没记错的话,我记得

And I think, if I do recall correctly

Speaker 2

我...是的。

I I yeah.

Speaker 2

对。

Yeah.

Speaker 2

去年排名第一的应该是我们关于spay的那次交流,我想。

The the the number one last year was our interaction, I think, on spay.

Speaker 2

是的。

Yep.

Speaker 2

那是那是

That's That's

Speaker 0

不算太糟,对吧?

not terrible, is it?

Speaker 2

是啊。

Yeah.

Speaker 2

没错。

Yeah.

Speaker 2

那可是值得炫耀一天的事。

It was a bragging right for a day.

Speaker 0

对。

Yeah.

Speaker 0

是的。

Yeah.

Speaker 0

这挺酷的。

It's pretty cool.

Speaker 0

所以你的那一期节目让你有了双重吹嘘的资本。

So your episode and and double bragging rights.

Speaker 0

你的节目是在...我不记得具体时间了。

As your episode was released in I don't know when that was.

Speaker 0

大概是去年十月左右,差不多正好一年前的这个时候。

Something like October or something, almost exactly a year ago to the day.

Speaker 0

而且它仍然是全年下载量最高的一期。

And still, it was the number one most downloaded for the whole year.

Speaker 0

太棒了。

So fantastic.

Speaker 0

我认为这可能暗示着我们即将进入另一个非常激动人心的话题,对吧?

And I think that might be an indication of where we're going, to another very exciting topic, you know?

Speaker 2

是啊。

Yeah.

Speaker 2

是啊。

Yeah.

Speaker 2

比如,机器学习和人工智能只会上涨。

Like, ML and AI only went up.

Speaker 2

对吧?

Right?

Speaker 2

所以,你

So so You

Speaker 0

知道吗?

know what?

Speaker 0

我很想听听你对这个的看法。

I I would love to get your thoughts on this.

Speaker 0

我在网上看到一些观点,想提出这个作为对这种想法的反驳。

I I'm seeing out on the Internet, and I wanna put this up as kind of a to counter this this thought or whatever.

Speaker 0

但我看到很多人对AI的存在感到非常沮丧。

But but I'm seeing a lot of people get really frustrated that AI is a thing.

Speaker 0

你知道,OpenAI刚发布了他们的Atlas浏览器,我对此并不特别兴奋,但这就像是他们基于Chromium打造的AI浏览器版本。

You know, OpenAI just released their Atlas browser, which I'm not super excited about, but it's like their version of what an AI browser wrapping Chromium looks like.

Speaker 0

你懂我意思吗?

You know what I mean?

Speaker 0

而且它还行吧。

And it's it's fine.

Speaker 0

但Ars Technica上的评论通常比较中立,现在却全是人们抓狂的反应

But the comments in Ars Technica, which are usually pretty balanced, are just like people losing it

Speaker 2

就因为

over the fact

Speaker 0

它搭载了AI功能。

that it has AI.

Speaker 0

人们是不是已经厌倦这些东西了?

Are people tired of this stuff?

Speaker 0

或者说——我真正想问的是——你觉得为什么会有这种反应?

Or or why do you think that's the reaction, I guess, is really what I wanna ask you.

Speaker 2

我是说,我想我有几个不同的看法。

I mean, I guess I have, like, a couple of perspectives.

Speaker 2

但是,我觉得可以说,我们都厌倦了每个科技产品都在想方设法把AI塞进去。

But, like, I do like, I think I could say, like, we are all tired of, like, every tech product out there is trying its best to find a way to put AI in the product.

Speaker 2

比如,随便一个Gmail、日历应用都要加入AI功能,这确实有点让人疲惫。

Like, oh, any any Gmail, any calendar app, let's put AI in there, and it gets a bit tiring.

Speaker 2

现在就算消防水管和冰箱都带AI功能,我也不会太惊讶。

Like, I wouldn't be too surprised if, like, fire hoses and refrigerators also come with AI features these days.

Speaker 2

这感觉确实有点疯狂。

Like, it's that feels a bit nuts.

Speaker 0

我懂。

I know.

Speaker 0

就像,我的冰箱要AI功能有什么用?

It's like, what what is my I have a refrigerating AI for it?

Speaker 2

是啊。

Yeah.

Speaker 2

或者,比如说,足球或者随便什么东西。

Or, like, soccer ball or whatever object.

Speaker 2

感觉人们现在对AI的应用有点过头了。

Like, it it feels like people are overdoing the AI thing.

Speaker 2

所以,好吧,这确实可能成为让人沮丧的合理原因。

So, okay, that that can be, like, legitimate source of frustration.

Speaker 2

但这也带点个人情感因素,因为我能想象如果你全心投入想成为优秀工程师,认真对待互联网,视之为某种神圣事物——毕竟它对你的职业生涯帮助很大,那我完全能理解那种'天啊,请别把这东西搞砸'的心情。

But then it also becomes a little bit personal because I can also imagine if you put your heart and soul into being a good engineer and you want to take the internet serious, you consider it something as somewhat sacred because it helped you so much in your career, then I definitely can also imagine like, oh my god, please don't turn that into a slob.

Speaker 2

比如,怎么在这种环境下建立职业生涯?

Like, how build a career on that?

Speaker 2

这可能就是所有这些情绪的根源。

So that might be the source of all these things.

Speaker 2

我想我主要的应对方式更像是:好吧,这个精灵已经不可能被塞回瓶子里了。

I guess like my main way of dealing with it is more along the lines of like, okay, this genie is not gonna go back into the bottle in a way.

Speaker 2

但如果我们能用这些大语言模型做更多事,如果它们能自动化更多样板工作,那我或许也能尝试提升自己的'自然智能',而不是一味追求人工智能。

But if we're able to do more things with these LLMs, if they're able to automate more boilerplate and that sort of a thing, then it seems that then I can try and get better at natural intelligence as well instead of this artificial intelligence.

Speaker 2

所以,我现在可以用代码搞定所有这些事了。

So like, okay, I can five code all these things now.

Speaker 2

那么瓶颈就在于,我是否有好的想法?

So the bottleneck is just, do I have good ideas?

Speaker 2

也许我应该在好点子上多下功夫。

And maybe I should invest in good ideas.

Speaker 2

哦,也许我其实可以学学JavaScript,但不该纠结语法,而应该关注浏览器和CSS的工作原理。

And oh, maybe I can actually learn about JavaScript, but then I should not focus on the syntax, but I shouldn't focus maybe on the browser and like how does CSS work.

Speaker 2

对了,或许我该用闪卡做些练习,只要记住足够多的语法方便复习就行。

And oh, I should actually maybe do a little bit stuff with flashcards just so I know the syntax just enough so I can review.

Speaker 2

好吧。

Okay.

Speaker 2

但我会尽量保持这种清醒的认知方式。

But like, I try to be very conscious about it that way.

Speaker 2

这大概就是我的主要应对之道。

That's kind of my approach more.

Speaker 2

I

Speaker 0

人很容易变得懒惰,对吧?

It's easy to get really lazy, right?

Speaker 0

然后只是按下按钮说做下一件事,而不是把它当作一个机会,比如,哦,它做了些我不知道的事情。

And just push the button and say do the next thing and not use it as an opportunity like, oh, it did something I didn't know.

Speaker 0

让我来交流一下,试着理解。

Let me have a conversation and try to understand.

Speaker 0

是的。

Yeah.

Speaker 0

我认为

I think

Speaker 2

这里的关键词是你要有意识地去做这件事。

that the keyword here is you wanna be deliberate about it.

Speaker 2

就像,我觉得如果你能某种程度上说,好吧,我有意识地使用这些东西的方式,同时也在做的过程中学习。

Like, I I think if you can sort of say, like, okay, I'm deliberate about the way I use this stuff and I'm also learning as I'm doing this.

Speaker 2

比如,我特别喜欢做的一件事就是给大语言模型布置一个疯狂的前端任务,我自己都不知道该怎么解决,然后研究它的输出。

Like, one thing I really like to do is I just give give like some sort of bonkers front end task to the LLM that I have no idea how I would solve it and then study the output.

Speaker 2

这确实是我偶尔会做的事情。

Like, that's the thing I actually do once in a while.

Speaker 2

不过,我确实理解人们对它有着复杂的情绪。

But, yeah, I mean, I do get it that, like, people have mixed emotions about it.

Speaker 2

这完全没问题,很正常。

And that's totally cool and fine.

Speaker 2

只是对我来说,在我的处境下,这就是我的应对方式。

It's just that for me, in my situation, this is how I deal with it.

Speaker 0

是啊。

Yeah.

Speaker 0

我觉得这很合理。

I think that's fair.

Speaker 0

我也觉得,我早就厌倦了每个邮件应用都要用AI重写内容,结果通常会把邮件搞得一团糟。

I think also I I definitely have long since been tired of, like, every email app having to rewrite this with AI, and it usually destroys the email.

Speaker 0

你知道的,比如,把所有格式都删掉了。

You know, like, removes all the formatting.

Speaker 0

然后你就知道,总会有那种漫画场景,我写了封要点式的邮件。

And then you just you know, there's always the cartoon of, I wrote an email as bullet points.

Speaker 0

我让AI扩展它。

I asked AI to expand it.

Speaker 0

我把它发给你。

I sent it to you.

Speaker 0

你会觉得,好长的邮件啊。

You're like, what a long email.

Speaker 0

我要让AI总结一下这个。

I'm gonna ask AI to summarize this.

Speaker 0

我们本应该直接发要点的。

We should just send the bullet points.

Speaker 2

是啊。

Yeah.

Speaker 2

我是说,但我确实担心那些低质量内容的泛滥。

I mean, I do fear the amount of slop though.

Speaker 2

就像,现在几乎感觉没有多少优秀的科技类YouTuber了,因为他们都在做AI相关的内容,而不是真正优秀的编程内容。

Like, I do it almost feels like every good tech YouTuber there aren't a lot of good tech YouTubers anymore because they're all doing AI stuff instead of doing, like, actual really great programming.

Speaker 2

还是有一些的。

There's still a few.

Speaker 2

比如Anthony Writes Code,他现在依然是个非常优秀的创作者。

Anthony Writes Code is, like, a really good one still.

Speaker 2

他真的很棒。

Like, he's awesome.

Speaker 2

如果你想学Python,一定要关注他。

Definitely follow him if you wanna learn Python.

Speaker 2

他做的内容很酷。

He does cool stuff.

Speaker 2

但说实话,从我个人自私的角度来看,YouTube以前更好,因为现在全是关于AI的内容。

But, yeah, like, the the main thing, I guess, from my, like, selfish perspective, YouTube used to be better because nowadays it's all about the AI.

Speaker 2

你总能看到这种缩略图:一个人抓狂地扯自己头发,天哪。

You've always got this thumbnail of a guy pulling his hair out, like, my god.

Speaker 2

这将改变一切。

This changes everything.

Speaker 0

是啊。

Yeah.

Speaker 0

没错。

Yeah.

Speaker 0

我很想

I would love

Speaker 2

看到不是那种内容的视频。

to see a video that's maybe not that.

Speaker 0

你听说了AI泡沫即将破裂的消息吗?

Have you heard that there's an AI bubble that's gonna burst?

Speaker 2

听说了。

Yeah.

Speaker 2

好吧,我们拭目以待究竟能走多远

We'll well, we'll see exactly how far

Speaker 0

其实我觉得是这样

that I think so, actually.

Speaker 2

我不这么认为

I don't think so.

Speaker 2

我们可以推测一下

We we can speculate.

Speaker 2

比如,我可以论证它已经被过度投资了

Like, I I I can argue that it's been overinvested.

Speaker 2

我也可以说它还有很大潜力

I can also argue there's still so much potential.

Speaker 2

不过我要说的是,我们已经有了云端工具,大家都期待着氛围编程

The one thing I will say, though, we have cloud kinds of tools and we're all looking forward to the vibe coding.

Speaker 2

哦,现在比以往任何时候都容易,诸如此类

Oh, it's never been easier and that sort of thing.

Speaker 2

但我本以为会伴随着大量优秀应用的爆发式增长。

But I would have expected an explosion of awesome apps to be going along with it.

Speaker 2

虽然理论上我们拥有了更好的工具,但感觉上我们的软件并没有明显变得更好。

And it doesn't necessarily feel like we have much better software, even though we supposedly have way better tools.

Speaker 2

这让我有些怀疑,但也可能只是因为那些正在开发的应用目标用户并不是我。

So something about that is making me a little bit suspicious, but it might also just be that the apps that are being built that I'm not the target audience for.

Speaker 2

因为我能想象这种情况。

Because I can imagine that.

Speaker 2

比如说,可能有一款为牙医开发的优秀CRUD应用是用Claude构建的,但我不是牙医。

Because let's say you have something awesome for dentists that can still be an awesome crud app that you could build with Claude, but I'm not a dentist.

Speaker 0

哇,现在有很多很酷的新牙科管理应用。

Wow, there's a lot of new cool dentistry management apps.

Speaker 0

你是

You're

Speaker 2

对的。

right.

Speaker 2

我是说,如果一个牙医能编程,我确实相信这种说法——作为牙医,你可能最适合为牙医开发应用,对吧?

Mean, if a dentist can out program, Like I do believe in the story that oh, as a dentist, you might be best equipped to write an app for dentists, right?

Speaker 2

如果他们现在更有能力用代码做些事情,这意味着每个细分专业领域都可能出现能用Claude开发该行业应用的人。

And if they're now more empowered to maybe do some stuff with code, mean, there's a story there that every single niche y profession will have someone who can do enough clods to make the app for that profession.

Speaker 2

时间

Time Yeah.

Speaker 2

会证明一切。

Will tell.

Speaker 0

过去你需要同时具备编程技能和一些牙科经验,才能构建这种专业垂直领域的应用。

It used to be that you have to have a programming skill and a little bit of, let's say, dentistry experience to, like, build the right sort of specialized vertical.

Speaker 0

而现在我认为情况可能反过来了。

And now I think it maybe is reversed.

Speaker 0

你需要大量牙科知识和一点点编程技能,再结合AI就能做到。

You need a lot of dentistry and a little bit of coding skill to go along with an AI.

Speaker 2

是啊。

Yeah.

Speaker 2

角色属性表过去是这边80点那边20点,现在变成了那边80点这边20点。

The character sheet used to be 80 points here, 20 points there, and now it's 80 points there and 20 points here.

Speaker 0

是的。

Yes.

Speaker 0

没错。

Exactly.

Speaker 0

这正是我所想的。

That's exactly what I was thinking.

Speaker 0

就像,我觉得在你这么说之前可能已经发生了这种转变。

Like, I think maybe that's actually shifted until you said that.

Speaker 0

我从未真正思考过这个问题,但或许确实如此。

I've never really thought about it, but it just maybe.

Speaker 0

我想向听众们指出一点。

I do wanna point out for people listening.

Speaker 0

我们不会过多讨论如何使用代理工具来为我们编写代码。

We're not going to really talk too much about, like, using agentic tools to write code for us.

Speaker 0

比如,我们一直在讨论这个理论上的牙医案例。

Like, we have been speculating about this theoretical dentist.

Speaker 0

但我们要做的是,文森特,和你聊聊如何像使用库或API那样运用LLM,为现有的数据科学工具或网页应用添加功能、特性和行为,无论我们正在构建什么。

But what instead we're gonna do is we're gonna talk to you, Vincent, about how can I use an LLM like a library or an API to add functionality, features, behaviors to an existing data science tool or to an existing web app or whatever it is we're building?

Speaker 0

对吧?

Right?

Speaker 2

是的。

Yes.

Speaker 2

所以...那个...大家可能已经知道了,我为TalkPython制作了一门课程,当然,我们会讨论其中的一些细节。

So the the the the also, people might probably know it, but I I made a course for TalkPython, of course, and we're we're gonna talk about some of those details.

Speaker 2

但那门课程的初衷并不是教'如何用LLM来为我编写软件'。

But the idea for that course was not necessarily like, how can I use LLMs to build me software?

Speaker 2

而是更侧重于'如何开发内置LLM功能的软件'。

It's more, oh, how can I build software that also use LLMs under the hood?

Speaker 2

比如如果我有一个生成摘要的应用,如何确保摘要的可靠性?

Like if I have an app that makes a summary, how can I make sure the summary is reliable?

Speaker 2

基本上就是为这些基础构建模块开个头。

And basically get the ball rolling on those building blocks.

Speaker 2

这就是那门课程的主要内容。

That's what that course is about.

Speaker 2

这也可能是本话题的核心骨架,而不是牙医鲍勃和他创办新科技初创公司的雄心壮志。

That's also probably going to be the main bones of this topic as opposed to a dentist Bob and his ambitions to make a new tech startup.

Speaker 0

没错。

Exactly.

Speaker 0

要是现在能搞定软件,我们都能长出新牙了。

We're going to grow new teeth if we just could get the software Now yeah.

Speaker 0

那么具体该怎么做呢?

So how do you do that?

Speaker 0

我们接下来就要讨论这个问题。

And we're gonna talk about that.

Speaker 0

在深入探讨实现细节之前,我想先给大家个机会,简单了解下你最近的动态。

Before, I just wanna give you a chance before we really dive too far into the details of how we make that work is just, you know, give people a sense of what you've been up to lately.

Speaker 0

你在comcode.io上做了很多很酷的事情。

You've done a lot of cool stuff with comcode.io.

Speaker 0

我看得出你的YouTube频道在这里发展得很不错。

You I can see your YouTube game is growing strong here.

Speaker 0

而且你还在Marimo做了很多数据科学方面的工作。

What and you've been doing a lot of data science at Marimo.

Speaker 0

比如,是啊,什么...

Like, yeah, what's

Speaker 2

对。

Right.

Speaker 2

是的。

Yeah.

Speaker 2

所以我们确实...

So we yeah.

Speaker 2

我们已经一年没见了,也许我们应该叙叙旧。

We we haven't spoken in a year, so maybe we should catch up.

Speaker 2

长话短说,CommCode依然是我在维护的一个项目。

So long story short, CommCode is still a project that I maintain.

Speaker 2

它基本上99%都是关于Python的免费教育内容。

It's basically 99% free educational content on Python.

Speaker 2

这个项目基本上可以自我维持运行。

That thing is just gonna maintain itself.

Speaker 2

我非常乐意继续维护它。

Super happy to keep maintaining it.

Speaker 2

现在我在做的主要事情是,每隔两个月就换一家云服务提供商——纯粹因为我可以这么做,这样我就能了解另一边的体验如何。

The main thing I'm doing with that nowadays is just every two months I switch cloud providers just because I can, and then I can sort of see what it's like on the other side.

Speaker 2

这就是我现在做的事。

So that's the thing that I do.

Speaker 2

从Calm Cold Go开始,我想我也可以开个YouTube频道,结果这个频道虽然还是会讲Python相关的内容,但主要变成了讨论这些花哨的人体工学键盘——因为我之前有些重复性劳损问题。

From Calm Cold Go, I figured I might also start a YouTube channel, and that ended up being a YouTube channel where I still talk about Python stuff, but I mainly talk about these fancy ergonomic keyboards because I had a couple of RSI issues.

Speaker 2

一年时间里,我的订阅者从100人增长到了5000多人。

In a year's time, I went from a 100 subscribers to 5,000 something.

Speaker 2

所以这件事算是有点起色了。

So like this thing kind of took off.

Speaker 2

这太棒了。

That's awesome.

Speaker 2

我现在居然有赞助商了。

I actually have sponsors now.

Speaker 2

现在亚洲有几家公司会寄他们定制键盘给我评测。

So I actually have a couple of companies in Asia sending me their custom boards for me to review.

Speaker 2

这段旅程真的非常有趣。

So like that's been like a really fun journey.

Speaker 2

不过自从上次我们聊过后,我换了雇主。

But since last time we spoke, I also switched employers.

Speaker 2

可能有人听说过Jupyter。

So people might have heard of Jupyter before.

Speaker 2

就是Python里可以做交互式编程的那个环境。

Like that's an environment in Python where you can do interactive things.

Speaker 2

我现在就职于一家开发Remo的公司,这是一个非常受欢迎的替代方案。

And I work now for a company that makes Remo, which is a alternative, a very likable one.

Speaker 2

它的运作方式完全不同。

It does work completely differently.

Speaker 2

吸引人们使用它的主要原因之一是,这类笔记本底层实际上是Python文件。

One of the main things that attracts people to it is the fact that these kinds of notebooks are, Python files under the hood.

Speaker 2

它们还更具交互性一些。

They're also a little bit more interactive.

Speaker 2

你可以通过用户界面进行更快速的原型设计。

You can do more rapid prototyping with UI.

Speaker 2

你可以很好地将其与Python结合使用。

You can blend Python with it very nicely.

Speaker 2

可以说我现在所有的快速原型设计,尤其是与LLMs相关的,都是在Marimo中完成的,这样就能轻松地将Python与用户界面融合。

So I will say like all of my rapid prototyping, especially with LLMs, I do that in Marimo nowadays just so you can blend Python with UIs very easily.

Speaker 2

网站上还有演示,大家可以随时查看。

And there's demos on the site that people can go ahead and check out.

Speaker 2

不过确实是这样。

But that's yeah.

Speaker 2

这也是我今年创建的第二个YouTube频道。

That's also the second YouTube channel I made this year.

Speaker 2

我通过Remo做了很多事情。

I do a lot of stuff from Remo.

Speaker 2

我现在更多是偏重增长方面的工作,而非硬核的工程开发。

I'm a little bit more on the, like, growth side of things than, the hardcore engineering side of things.

Speaker 2

当然,我还是会为Remo开发很多插件。

I still make a lot of plugins from Remo, of course.

Speaker 2

这基本就是我目前的主要工作内容。

But that's a little bit more of what I do nowadays.

Speaker 2

确保更多人了解Marimo。

Making sure that people learn about Marimo.

Speaker 2

现在可以在笔记本上实现以前想都不敢想的功能。

Can do things in a notebook now that you couldn't think of before.

Speaker 2

我现在在笔记本里写命令行应用,不只是因为可以这样做,还因为它确实很方便。

I write my command line apps in a notebook nowadays because it's actually not just because I can, but because it's convenient too.

Speaker 2

等会儿我们聊到LLM时会详细讨论这个,不过这就是我去年的主要工作概况。

So we'll talk a little bit about that later when we talk about LLMs, but that's effectively the short story of what I've been doing last year.

Speaker 0

不错。

Nice.

Speaker 0

好的。

Alright.

Speaker 0

我是Marimo的粉丝。

I am a fan of Marimo.

Speaker 0

真的很高兴听到

It really Happy to hear

Speaker 2

它。

it.

Speaker 0

是啊。

Yeah.

Speaker 0

是的。

Yeah.

Speaker 0

是的。

Yeah.

Speaker 0

我今年参加了一个数据科学课程,学习了数据科学家所需的Python和软件工程基础知识。

I I did a data science course this year, just enough Python and software engineering for data scientists.

Speaker 0

就是,你知道的,如何从软件工程的角度出发,让你的数据工程和数据科学工作更加可靠。

Like, you know, what could you bring from the software engineering side to, like, sort of make your your data engineering, data science stuff a little more reliable.

Speaker 0

我当时很纠结,我到底该不该用这个,还是

Well, I was right on the fence of should I should I use this or

Speaker 2

不用呢?

should I not?

Speaker 0

因为我觉得它显然更好。

Because it's I think it's clearly better.

Speaker 0

但同时,我也想用大家都在用的工具。

But at the same time, I also wanna use what people are using.

Speaker 0

所以我最终没有选择它,但它的用户界面确实很棒。

So I didn't quite go for it, but I just the UI is fantastic.

Speaker 0

它利用抽象语法树或其他技术来理解单元格间的关系,确保它们不会出现潜在的同步问题,这种可复现性和可靠性非常出色。

The reproducibility reliability of it where it uses the abstract syntax tree or whatever to understand relationships across cells so they don't get out of sync potentially.

Speaker 0

是的。

Yeah.

Speaker 0

我觉得这真的很不错。

I think it's really nice.

Speaker 0

我请过阿克沙伊上节目,你们也一起共事过,对。

I had Akshay on the show who you work with also Yep.

Speaker 0

来讨论这个话题。

To talk about it.

Speaker 2

嗯,Jupyter中有一点...我是说,或许我该先说,Jupyter仍然是一个非常棒的项目。

The well, so the the one thing in Jupiter that's I mean, let me maybe start by saying, Jupiter is still a really cool project.

Speaker 2

回想过去十年,这个项目为我的职业生涯带来的所有好处,不仅是作为用户的直接体验,还有间接影响——正是因为我们突然拥有了一个足够好的交互环境(这是前所未有的),才催生了许多算法的发明。

Like, if I think back of the last decade, like, all the good that that project has brought to my career, not just directly as a user, but also indirectly, all the algorithms that got invented simply because we had a good enough, like, interactive environment suddenly, which we never had before.

Speaker 2

它创造了奇迹。

It's done wonders.

Speaker 2

所以,我们确实应该心怀感激。

So, like, we we should definitely be thankful.

Speaker 0

是啊。

Yeah.

Speaker 0

我也不是在批评它。

I'm not bashing on it either.

Speaker 2

对。

Yeah.

Speaker 2

没错。

Yeah.

Speaker 2

不。

No.

Speaker 2

但我总是想确保功劳归于应得之人,因为这个产品确实产生了巨大影响。

But I'd like I I do always wanna make sure that I give credit where credit is due because the the the product had a lot of impact.

Speaker 2

不过Jupyter有个特别烦人的问题,除了文件格式可能让你有点不爽之外。

But there is this really annoying thing with Jupyter though, besides like, you know, you can be a bit grumpy about the file format, sure.

Speaker 2

但最烦人的是你可以写下x等于10,然后下面所有单元格都依赖这个x。

But the one thing that's very annoying is you can write down x is equal to 10, and then have all sorts of cells below it that depend on x.

Speaker 2

然后你删除这个单元格时,笔记本根本不会提醒你。

You could then delete the cell and the notebook will not complain to you about it.

Speaker 2

即使其他人尝试重新运行笔记本时,X已经不存在了,代码无法运行,你的笔记本就废了,再也没法分享。

Even though if anyone else tries to rerun the notebook, X is gone, it won't run, and your notebook is broken and you can't share the thing anymore.

Speaker 2

而现在,多年之后,我们有了UV这类工具。

And nowadays, fast forward like many years later, and we've got stuff like UV now.

Speaker 2

因为Marimo就是个Python文件,我们可以添加元数据来声明依赖,这让笔记本变得超级可复现。

So we can add metadata to a Python file to add dependencies and oh, wait, because Marimo is a Python file, we can add dependencies to the notebook that makes it super reproducible.

Speaker 2

现在我们可以重新思考所有这些事情,仅仅因为我们有了一个仍然是Python文件的好笔记本格式。

There's just all these all this stuff that you can rethink now simply because we have a good notebook format that is still a Python file.

Speaker 2

这才是真正的杀手级功能。

Like that's really the killer feature here.

Speaker 2

是啊。

Yeah.

Speaker 2

如果你感兴趣的话,我们可以多聊聊这个,不过这个话题我能说上好久。

We we can we can talk more about it if you like, but I can talk for ages about this topic.

Speaker 2

先提醒你一下。

Just warning you.

Speaker 2

也许最后再提一点关于软件工程方面的事,因为你刚才提到了。

One final thing maybe also for the software engineering side of things, because you did mention it.

Speaker 2

举个我们最近新增功能的例子:如果在Marimo里有个单元格,里面有个以test_开头的函数,我们会自动将其识别为Pytest测试。

Just to give an example of something we added recently, if you have a cell in Marimo and there's a function in there that starts with test underscore, we will automatically assume it's a Pytest.

Speaker 2

这样你就可以直接在笔记本里添加单元测试了。

So you can actually add unit tests to your notebook as well.

Speaker 2

然后如果你运行python notebook。

And then if you say python notebook.

Speaker 2

py,pytest就会自动运行所有测试,当然你也可以在CICD流程中内联运行这些测试。

Py, then pytest will just run all the tests for you, even though you can also run the tests in line in your CICD as well.

Speaker 2

所以我们可以添加所有这些Python特有的功能,毕竟它只是一个Python文件。

So there's all sorts of these Python specific things that we can add, again, because it's just a Python file.

Speaker 0

是啊。

Yeah.

Speaker 0

这有点像后发优势或者说第n个进入者的优势(n>1),当你看到某些优秀设计时,就会想'这个很赞'。

It's sort of the second mover advantage or nth mover advantage or n is greater than one where you see, okay, that was awesome.

Speaker 0

可能这里有点小瑕疵,我们该怎么优化或改进它呢?

Maybe this was a little bit of a rough edge and what what would we do to work around that or smooth it out.

Speaker 0

对吧?

Right?

Speaker 2

嗯,而且我们也很幸运诞生在UV(可能指Jupyter)时代。

Well, and also we we're also lucky that we're born in the age of UV.

Speaker 2

我得说,笔记本体验的很多生活质量改进,

I I gotta say, like, a lot of, like, quality of life improvements to a notebook.

Speaker 2

很大程度上也得益于UV的存在。

A lot of that is also due to the fact that UV is around.

Speaker 2

这无疑也是一个巨大的帮助。

That's definitely a huge help as well.

Speaker 0

本期《Talk Python》由Sentry的SEER为您呈现。

This portion of Talk Python to me is brought to you by Sentry's SEER.

Speaker 0

我很高兴向大家介绍SEER的新工具。

I'm excited to share a new tool from SEER.

Speaker 0

SEER是您的人工智能结对编程助手,能比以往更快地发现、诊断并修复Python应用中的代码问题。

SEER is your AI driven pair programmer that finds, diagnoses, and fixes code issues in your Python app faster than ever.

Speaker 0

如果您已经在使用Sentry了,对吧?

If you're already using Sentry, you are already using Sentry, right?

Speaker 0

那么启用SEER就像在现有项目中开启一个功能那么简单。

Then using SEER is as simple as enabling a feature on your already existing project.

Speaker 0

SEER能充分利用Sentry收集的丰富错误上下文信息。

SEER taps into all the rich context Sentry has about an error.

Speaker 0

包括堆栈追踪、日志、提交记录、性能数据——基本上涵盖所有内容。

Stack traces, logs, commit history, performance data, essentially everything.

Speaker 0

随后它会运用其智能AI代码能力来诊断问题所在。

Then it employs its agentic AI code capabilities to figure out what is wrong.

Speaker 0

这就像有位资深开发者在与你结对编程,共同修复漏洞。

It's like having a senior developer pair programming with you on bug fixes.

Speaker 0

SEER随后会生成代码补丁作为解决方案,甚至直接在GitHub上发起拉取请求。

SEER then proposes a solution generating a patch for your code and even opening a GitHub pull request.

Speaker 0

这仍将决策权交予开发者,因为最终需要他们来审核通过这个PR。

This leaves the developers in charge because it's up to them to actually approve the PR.

Speaker 0

但它能大幅缩短从错误发现到修复的时间。

But it can reduce the time from error detection to fix dramatically.

Speaker 0

试用过的开发者反馈,它能一次性解决原本需要数小时调试的报错问题。

Developers who've tried it found it can fix errors in one shot that would have taken them hours to debug.

Speaker 0

其根本原因识别准确率高达94.5%。

Boasts a 94.5% accuracy in identifying root causes.

Speaker 0

SEER还会通过可操作性评分系统来优先处理具有可执行性的问题。

SEER also prioritizes actionable issues within actionability score.

Speaker 0

这样你就知道该优先修复哪些问题。

So you know what to fix first.

Speaker 0

这能将Sentry的错误报告转化为可执行的修复方案,把一堆错误报告变成有序的待办清单。

This transforms Sentry errors into actionable fixes turning a pile of error reports into an ordered to do list.

Speaker 0

如果你需要一个全天候在线的AI助手,在你还没来得及阅读通知前就帮你追踪错误并提出修复方案,不妨试试Sentry SEER。

If you could use an always on call AI agent to help track down errors and propose fixes before you even have time to read the notification, check out Sentry SEER.

Speaker 0

只需访问talkpython.fm/seerseer。

Just visit talkpython.fm/seerseer.

Speaker 0

链接已附在播客节目的备注中,记得使用我们的专属代码TALKPYTHON(全大写无空格),感谢Sentry对《Talk Python to Me》节目的支持。

The link is in your podcast player show notes be sure to use our code talkpython one word all caps thank you to Sentry for supporting talk python to me.

Speaker 0

我在Reddit上看到——具体是在哪个版块来着——对了,在r/learnpython或者r/python上。

I saw on gosh where was it speaking of reddit I saw on slash r learn Python or slash r Python.

Speaker 0

我不确定具体是哪个带Python关键词的子版块。

I don't one of the slash r's with a Python substring.

Speaker 0

有人提问:'现在你会使用哪个Python包管理器?'

Someone asks, what what Python package manager would you use now?

展开剩余字幕(还有 480 条)
Speaker 0

然后就像是

And it was just like

Speaker 2

UV。

UV.

Speaker 2

UV。

UV.

Speaker 2

怎么

How

Speaker 0

你能说多少次UV?

many times can you say UV?

Speaker 0

是啊。

Yeah.

Speaker 0

那些反馈评论。

The feedback comments.

Speaker 0

我是说,那是个不确定的新人。

I mean, it was a new someone new who wasn't not sure.

Speaker 0

对吧?

Right?

Speaker 0

他们已经看过了所有不同的版本,确实如此。

They've they've seen all the different ones and yeah.

Speaker 2

我是说,我见过最酷的对比是在一条推特上,有人发帖说,假设你现在身处数据领域,十年前的工具是什么?

So I mean, the coolest comparison I've seen I think it was a tweet someone posted, but like, it it definitely like, suppose you're in the data field right now, like, what what are the tools ten years ago?

Speaker 2

现在的工具又是什么?

What are the tools now?

Speaker 2

确实感觉像是这样,好吧。

It definitely does feel like, okay.

Speaker 2

以前我们用PIP,现在用UV。

Before we had PIP, now we have UV.

Speaker 2

以前用PANDAS,现在用POLARS。

Before we had PANDAS, now we have POLARS.

Speaker 2

以前用MATLAB,现在用Alteran。

Before we had MATLAB, now we have Alteran.

Speaker 2

以前我们用Jupiter,现在有了Marimo。

Before we had Jupiter, now we've got Marimo.

Speaker 2

你可以看到一种代际更替,不仅体现在笔记本工具上,还包括包管理器和数据框库这些方面。

You you can kinda see a generational shift, not just on the notebook side of things, but, like, on the package manager, on the data frame library.

Speaker 2

我们都在从前人那里学习,这感觉就像是...

We're all learning from the previous generation, and it kinda feels like.

Speaker 0

是啊。

Yeah.

Speaker 0

完全同意。

Absolutely.

Speaker 0

这是个令人惊叹的时代。

It's, it's an amazing time.

Speaker 0

我在Python领域的每一天都比前一天更令人兴奋。

I every single day in Python is just more exciting than the day before.

Speaker 2

没错。

Yeah.

Speaker 2

不过,我也得提一下,特别是在波兰这件事上,Rust语言也占了不小的比重。

Although, I should also mention, like, especially with the Polish thing, there's a fair bit of rust too.

Speaker 2

这也带来了变化。

That also makes a difference.

Speaker 0

是啊。

Yeah.

Speaker 0

没错。

Yeah.

Speaker 0

当然。

Of course.

Speaker 0

所以在Flyby之前,我是说,你提到过你的YouTube频道。

So before Flyby, I mean, you talked a bit about your YouTube channel.

Speaker 0

你评测人体工学键盘。

You review the ergonomic keyboards.

Speaker 0

给那些现在才收听或观看的人介绍一下,你的背景布置非常棒。

You have for those people who are just listening now, watching, your background is super nice.

Speaker 0

你在这里的资历相当扎实。

Your bonafis are solid here.

Speaker 2

是的。

Yep.

Speaker 2

是的。

Yep.

Speaker 0

但你有很多不同的键盘。

But you got a bunch of different ones.

Speaker 0

我个人觉得,你甚至可能会把我踢出俱乐部,如果我...

And I personally also I don't you might even just kick me out of the club if I

Speaker 2

那应该是微软Sculpt键盘。

should do That's the Microsoft Sculpt.

Speaker 2

对吧?

Right?

Speaker 2

还有很多其他款式。

There's a lot one.

Speaker 0

Sculpt人体工学键盘

Sculpt Ergonomic.

Speaker 0

我特别喜欢它是因为可以取下这个小巧的现代部件,反向旋转后塞进背包随身携带,薄得跟剃刀似的。

And I like it so much because I can take this little modern thing off, and it's, like, razor thin if I could rotate in reverse and jam it in my backpack and take it with me.

Speaker 0

但我已经饱受重复性劳损问题困扰二十五年左右,情况曾非常严重。

But I've also had RSI issues for twenty five years or something, and it was really bad.

Speaker 0

以前我用笔记本键盘打字,后来换成了这种专用键盘。

And I switched I used to type them on like laptops and stuff, and I switched to just something like this.

Speaker 0

现在每天打十小时字都没问题。

And I could type ten hours a day, and it's no problem.

Speaker 0

而以前如果强迫自己在笔记本上高强度打字,可能不到一周就会严重到无法工作。

Whereas before, if I if I were to force to type full on on a laptop, I would probably be, like, unable to work in weeks, if not a week.

Speaker 0

非常糟糕。

So bad.

Speaker 0

我们有个

We had an

Speaker 2

两周前在旧金山有个场外活动。

off-site in San Francisco, so was there, like, two weeks ago.

Speaker 2

虽然很有趣,但机场安检看到这个可能会觉得是什么奇怪的外星设备。

A lot of fun, but, like, I'm not gonna bring like, airport security is gonna look at this and wonder what ex what like, what kind of weird alien device this is.

Speaker 2

对吧?

Right?

Speaker 2

所以我想,好吧。

So I figured, okay.

Speaker 2

我就把它们留在家里。

I'll leave those at home.

Speaker 2

只带我的普通笔记本电脑。

Just bring my normal laptop.

Speaker 2

一周后,我的手腕又开始不舒服了。

And after a week, I'm feeling it in my wrist again.

Speaker 2

就是那种

Like, it's

Speaker 0

不太好。

not good.

Speaker 2

是啊。

Yeah.

Speaker 2

这确实需要认真对待。

It's it's something to take serious.

Speaker 2

不过我也得说,因为孩子和妻子都生病了,我在家没能做太多运动。

Although, I will also say, like, because the kid was sick and the wife was sick, so I wasn't able to do a whole lot of exercise at home.

Speaker 2

也要做运动。

Also do exercise.

Speaker 2

所以那也确实很有帮助。

So that that also totally helps.

Speaker 2

如果我必须的话,当然。

If I had to, like, Sure.

Speaker 2

如果你喜欢,可以买个符合人体工学的键盘。

Buy an ergonomic keyboard if you like.

Speaker 2

可编程键盘确实很棒。

Programmatic keyboards, they're great.

Speaker 2

但如果你以此为借口不锻炼,那就大错特错了。

But if you're gonna do that as an excuse not to do exercise, you're doing it wrong.

Speaker 2

这是我想补充的一点。

That's the the one thing I do wanna add to that.

Speaker 0

有很多拉伸运动你可以做。

There's lots of stretches you can do.

Speaker 0

注意休息很重要。

Taking breaks matters.

Speaker 0

锻炼很重要。

Exercise matters.

Speaker 0

但我认为那些键盘确实是必备功能。

But I think those keyboards are an essential feature.

Speaker 2

它们确实很有帮助,而且有时候不完全是治疗手段,更多是预防措施。

They they they do they do totally help and also it's not sometimes it's not so much a healing measure, it's more of a preventative measure.

Speaker 0

是的。

Yes.

Speaker 0

百分之百赞同。

100%.

Speaker 0

我想对所有正在收听、年轻且自认为坚不可摧的朋友们传达这个信息。

And I would like to put this message out just to everyone listening who is young, absolutely indestructible.

Speaker 0

拜托了。

Please.

Speaker 0

我知道这些带有弧度设计的键盘用起来有点麻烦。

I know they're a bit of a pain in the butt with the warrior curviness.

Speaker 0

但绝对值得骄傲地说:我从未有过任何重复性劳损问题。

It is so worth it to just say, I've never had any RSI issues.

Speaker 0

虽然我用着这种奇怪的键盘被人取笑,但我根本不在乎。

I just use this weird keyboard and people make fun of me, but I don't care.

Speaker 0

对吧?

Right?

Speaker 0

你知道,这总比说'我正在努力'要好得多。

You know, that's that is a better thing than, like, I'm working on it.

Speaker 2

是啊。

Yeah.

Speaker 2

哦,就像疼得厉害,你懂吧?

Oh, like hurts up, you know?

Speaker 2

嗯,另外现在尤其是我们有了像Claude这样的工具。

Well, another thing is also especially now we've got stuff like Claude.

Speaker 2

对吧?

Right?

Speaker 2

我只想指出这方面的一个要点。

I just want if I can point out, like, one thing on that front.

Speaker 2

这些人体工学键盘通常可以按需编程。

So these ergonomic keyboards, you can often program them as you see fit.

Speaker 2

所以你可以设置比如按这个键就输入字母k。

So you can say, like, if I hit this key, it's k.

Speaker 2

但如果我长按它,它就会变成command键或任何你想要的指令。

But if I hold it down, it becomes command or whatever you like.

Speaker 2

这也意味着你可以自定义宏或快捷键映射。

But it also means that you can map macros or shortcuts.

Speaker 2

所以每当我按下这个按钮,一个叫MacWhisper的应用就会启动。

So whenever I hit this button, an app called MacWhisper boots up.

Speaker 2

它会开始录制我的声音。

That's gonna record my voice.

Speaker 0

我爱MacWhisper。

Love MacWhisper.

Speaker 2

超爱它。

Love it.

Speaker 2

而且它还有各种替代版本。

And then there's alternative variants for it.

Speaker 2

我相信Linux平台肯定也有类似工具。

I'm sure you've got stuff for Linux as well.

Speaker 2

但它主要的功能就是提供非常出色的语音转文字服务。

But the main thing it does is just really good speech to text.

Speaker 2

然后每当我讲完话,它会立即粘贴到我当前所在的任何地方。

And then whenever I'm done talking, it's just immediately gonna paste whatever I'm in.

Speaker 2

所以,哦,这实际上非常棒,因为现在的键盘快捷键只需要我按住大拇指,而不是要做出某种奇怪的、像爪子一样的手势去够键盘。

So oh, that's actually very nice because now the keyboard shortcut is just me holding my thumb down instead of some sort of weird, like, claw I gotta eject to my keyboard.

Speaker 2

突然间,这不一定只是为了方便。

And suddenly, doesn't necessarily become a convenience thing.

Speaker 2

它也变成了一种高级用户的功能。

It also becomes kind of a a power user thing.

Speaker 2

就像,如果你能把所有操作都按照你喜欢的方式映射到键盘上,你就能真正定制你的电脑使用体验。

Like, you can really customize your computer experience if you can really map everything to your keyboard just the way that you like.

Speaker 2

这就像是拥有VIM,但是适用于所有应用程序。

It's like having VIM, but for all the apps out there.

Speaker 0

好的。

Okay.

Speaker 0

这挺酷的。

That's pretty neat.

Speaker 0

是啊。

Yeah.

Speaker 0

我把大写锁定键重设为启动MacWhisper的快捷键。

I've remapped caps lock to my activate MacWhisper.

Speaker 0

如果我按住大写锁定键,就能进行语音输入。

If I hit caps lock and hold this down, then I can dictate.

Speaker 0

我知道电脑早就有听写功能了,但以前真的很糟糕。

And I know computers have had dictation for a long time, but it's been really bad.

Speaker 0

对吧?

Alright?

Speaker 0

Mac OS或Windows自带的听写功能并不好用,尤其是当你试图说缩写词时,比如PyPI。

The built in dictation to Mac OS or Windows isn't great, especially when you try to talk acronyms like, hey, do PyPI.

Speaker 0

然后它就...

And it's like

Speaker 2

是啊。

Yeah.

Speaker 2

MacWhisperer虽然还没做到尽善尽美,但不得不说它的质量确实有几次让我感到惊喜,真的。

Mac But MacWhisperer is it's it's not, like, all the way there, but I will say it's surprise it surprised me in quality a few times, definitely.

Speaker 0

对。

Yeah.

Speaker 0

没错。

Yeah.

Speaker 0

而且那个应用里你还能手动设置替换规则。

And that app, you can go in and actually set replacements.

Speaker 0

比如说,如果你觉得以后会输入这个,就让它自动替换成那个。

Like, if you write if you ever think you're gonna write this, write that instead.

Speaker 0

所以我给'TalkPython'设置了规则,因为它老是被识别成驼峰式连写。

So I've done that with, like, TalkPython because it always just turns it into CamelCase combined.

Speaker 0

我就想,这可不行。

I'm like, no.

Speaker 0

那些是两个分开的,你知道的,随便啦。

Those are two separate you know, whatever.

Speaker 0

你可以对它进行一定程度的自定义

You can sort of customize it a

Speaker 2

是啊。

Yeah.

Speaker 2

我觉得我最喜欢的一个例子,MacWhisper到现在还是会把scikit learn翻译错。

And I think my favorite one, I think MacWhisper actually gets this one wrong still.

Speaker 2

每当我写scikit learn这个非常流行的数据科学包时,它总是翻译成'心理学家学习'。

But whenever I write scikit learn, which is a very popular site like data science package, it always translates it to psychologists learn.

Speaker 2

这感觉就有点奇怪

Which, you know, feels kind of like weird in

Speaker 0

就像,我永远不希望你打出这一串词,因为如果真需要,我宁愿每次手动输入。

there, like, I never want you to ever write this this series of words because if you're if I have to, I'll just type it the one time.

Speaker 0

这不是我常用的

It's not my common

Speaker 2

嗯,其实我现在处于一个尴尬境地——我经常输入‘psychic learn’,多到它几乎要变成一个问题了。

It's well, so I'm not it's it's it's one of these moments where actually I type psychic learn often enough where it's like almost becoming the issue.

Speaker 2

所以我几乎要手动为所有我接触的这些奇怪的开源包添加规则了。

So I'm like at the verge of adding these rules manually for all these weird open source packages that I interact with.

Speaker 2

没错,认真对待人体工程学吧各位。

Yeah, it's Take ergonomics serious people.

Speaker 2

这是我想强调的一点。

That's the one thing I wanna say.

Speaker 2

你不必总是买超级昂贵的键盘。

You don't always have to buy a super expensive keyboard.

Speaker 2

如果你想探索可编程键盘,因为它们支持自定义功能,那是个绝佳的理由。

If you wanna explore programmatic keyboards because you can customize things, that's an excellent reason.

Speaker 2

但要记得休息、做做运动,保持健康。

But take a break and do exercises and just be healthy.

Speaker 2

这才是赢得马拉松的方式。

That's how you win a marathon.

Speaker 0

确实如此。

Yes, that's for sure.

Speaker 0

虽然这不是文森特的键盘评测马拉松,但让我们以一个问题收尾:如果让你从墙上挂着的键盘中选一把,你会用哪款?

Now this is not the Vincent's keyboard review marathon, but let's wrap it up with what if if you could take any keyboard hanging around on your wall there, which one would you use?

Speaker 2

嗯,这里有四对这样的键盘,所以可能是这一把。

Well, so there's four so I there's four pairs of these, so it's probably this one.

Speaker 2

我这儿还有几块其他也很棒的键盘。

So in my there's a couple of other boards that are great too.

Speaker 2

这块键盘不是我推荐给所有人的款式。

This board is not the board I would recommend to everyone.

Speaker 2

但如果你有严重的手部劳损问题,我认为Glove 80确实是最佳选择。

But if you have serious RSI issues, I do think the Glove 80 is your best bet.

Speaker 2

它的造型简约,可能是最适合大多数手型的工学设计。

It's it's simple in terms of the shape, it is probably the most ergonomic shape for most hand sizes.

Speaker 0

是啊。

Yeah.

Speaker 0

好的。

Okay.

Speaker 0

太棒了。

Awesome.

Speaker 0

好吧。

Alright.

Speaker 0

那么,我们切换到讨论编程话题吧

Well, let's switch over to talking about programming

Speaker 2

是的。

Yes.

Speaker 0

关于大语言模型(LLMs),不是编程LLMs。

LLMs with LLMs, not programming LLMs.

Speaker 0

我想正如你已经提到的,你写了这门名为《Python的LLM构建模块》的课程。

And I guess like you already called out, you wrote this course called LLM Building Blocks for Python.

Speaker 0

非常有趣的课程。

Super fun course.

Speaker 0

真的很棒。

Really neat.

Speaker 0

这门课程相当简短精炼,主要探讨如何可靠地将某种LLM集成到你的代码中。

It's pretty short and concise, and it really talks about how can you reliably add some kind of LLM into your code.

Speaker 0

我想你在课程中讨论的内容,无论是自托管模型还是OpenAI或Anthropic的模型,都同样适用。

I guess what you're what you're talking about in this course really applies regardless of whether it's a self hosted one or it's OpenAI or Anthropic.

Speaker 0

对吧?

Right?

Speaker 0

你可以根据需求选择使用哪种LLM。

You can have there's some some choices you can make on which LLM to use.

Speaker 0

对吧?

Right?

Speaker 2

所以,我设计这门课程的核心想法是:LLM某种程度上是个构建模块,但它与编程中常规的构建模块截然不同。

So so the, like, the main idea I have with the course was, like, an LLM is a building block at some point, but it's very unlike a normal building block when you're dealing with code.

Speaker 2

因为通常编程时,你向函数输入内容,就会得到一个明确的输出。

Because normally with code, you put something into a function and one thing comes out.

Speaker 2

但在这种特殊情况下,你向函数输入一个东西,却完全无法预知会得到什么输出。

But in this particular case, you put a thing into a function, you have no idea upfront what's going to come out.

Speaker 2

不仅如此,即使你两次输入相同的内容,也可能得到不同的输出结果。

And not only that, but you put the same thing in twice and something else might come out as well.

Speaker 2

这意味着你需要以更谨慎的态度来考虑这个工具的使用。

So that means that you're gonna wanna think about this tool a bit more defensively.

Speaker 2

这是个奇怪的构建模块。

It's a weird building block.

Speaker 2

就像你必须给它筑起护城河,否则这个构建模块很可能会做出你意想不到的事情。

It's like you have to put a moat around it because otherwise the building block's gonna do stuff you don't want it to do almost.

Speaker 2

其中有些涉及语法问题,有些关乎如何理解这些乐高积木般的组件,还有些则是关于如何通过统计测试来验证它是否大致符合预期的方法论。

And like some of that is syntax, some of that is how do you think about these LEGO bricks, and some of it is also just what is good methodology in general to like statistically test if the thing is doing roughly what you want it to do.

Speaker 2

不错。

Nice.

Speaker 2

这就是核心要点了。

That that's the that's the gist of it.

Speaker 2

不过确实。

But Yeah.

Speaker 2

不错。

Cool.

Speaker 0

是的。

Yeah.

Speaker 0

我从课程中提炼了你谈到的几个观点、概念和工具。

I pulled out a couple of ideas, concepts, and tools that you talked about throughout the course.

Speaker 0

即便没上过这门课,这些内容也会很有用。

And you don't have to have taken the course to have these things be useful.

Speaker 0

我只是觉得聊聊你提到的这些话题会很有趣。

I just thought it might be fun to riff on some of the things you touched on here.

Speaker 2

我觉得最有趣的是——这大概有半年了吧。

The main thing I think will be fun is it's been half a year, I think.

Speaker 2

看看其中有多少内容仍然站得住脚会很有意思。

It will be fun how much of it is still intact.

Speaker 2

我认为大部分内容肯定仍然适用,但看看能否找到任何可能过时的部分会很有趣,这样就能知道世界是否变化得很快。

I think most of it still definitely is, but it might be fun to sort of see if we can find anything that might be dated just to see if the world has moved on quickly.

Speaker 2

我想可能只有一点,但我们能...我只是有点好奇?

I can I think there's only one thing, but we can I'm just kinda curious?

Speaker 2

让我们...来看看吧。

Let's let's see.

Speaker 0

是啊。

Yeah.

Speaker 0

好的。

Alright.

Speaker 0

那我们就对此保持警惕吧。

Well, let's keep our our radar up for for that.

Speaker 0

这绝对是变化更快、更容易过时的内容,但我认为它整体上还是站得住脚的。

It's definitely something that's more changing quicker and and has a higher likelihood of being dated, but I think it holds up pretty well.

Speaker 2

没错。

Yeah.

Speaker 2

好的。

Like, okay.

Speaker 2

我记得我们强调过的一点是,你需要做些像缓存这样的处理。

So we like, one of the things I remember emphasizing is you wanna do some stuff like caching.

Speaker 2

比如说,如果你有一个函数,并且你用了LLM来处理它。

So, like, if you let's say you've got a function and you use an LLM for it.

Speaker 2

我们尽量简化这个问题。

And let's let's keep it simple.

Speaker 2

假设我们只是做摘要。

Let's say we're just making summaries.

Speaker 2

比如输入一段Python播客内容,输出一个单句摘要。

So talk Python episode paragraph goes in, single sentence is supposed to come out.

Speaker 2

类似这样的。

Something like that.

Speaker 2

嗯。

Mhmm.

Speaker 2

好的。

Okay.

Speaker 2

嗯,你可能会有个循环,比如先试一次,用一种设置跑一个LLM,再用不同设置试另一个LLM来生成所有数据。

Well, you might have a loop and you're gonna do like maybe one pass, try one LLM with one type of setting, try another LLM with different type of settings to generate all this data.

Speaker 2

如果使用LLM这种计算成本较高的工具时,出现这种情况就太遗憾了。

It would be a shame that you're gonna use an LLM, which is kind of an expensive compute thing.

Speaker 2

如果你不小心输入了相同内容,结果要支付双倍费用,那可就太糟心了。

If you put the same input in by accident, and then you incur the cost twice, like that would really stink.

Speaker 2

所以有件事你始终要考虑,就是缓存策略。

One of the So things you always wanna do is think a little bit about caching.

Speaker 2

有个叫Disk Cache的Python库我一直爱用,强烈推荐大家了解一下。

And there's a Python library called Disk Cache that I've always loved to use, and I highly recommend people have a look at it.

Speaker 2

Michael,我记得你之前的课程里也用过的。

I think Michael, you've also used it in one of your courses before.

Speaker 2

关键在于

The trick

Speaker 0

我们得好好聊聊这个。

is We have to talk about this.

Speaker 0

这太棒了。

It's so good.

Speaker 2

确实非常棒。

It is so good.

Speaker 2

它是SQLite,而且超级好用。

It is SQLite, and it's so good.

Speaker 0

它甚至比SQLite还要好。

It is even better than SQLite.

Speaker 0

简直好得难以置信。

It is unbelievably good.

Speaker 0

这还得感谢你。

And I have you to think.

Speaker 0

我虽然知道它,但,嗯,也就那样吧。

I I knew about it, but, like, yeah, whatever.

Speaker 0

然后我看到你用了它之后,我就觉得,太天才了。

And then after I saw you use it, I'm like, genius.

Speaker 2

这确实是天才之作。

It is it is genius.

Speaker 2

没错。

Yes.

Speaker 2

所以这就像是拥有了磁盘缓存,但它同时也存储在磁盘上。

So it's like having disk the cache, but it's also on disk.

Speaker 2

因此,即使你重启Python,基本上缓存中的所有内容都还在。

So if you were to restart Python, you still have everything in cache basically.

Speaker 2

而且它是一个类似SQL的数据库,所以你随时可以检查里面存储的所有内容。

And it's a SQL like database, so you can always inspect all the stuff that's in there.

Speaker 2

如果你愿意,还可以做些高级操作,比如为每个对象设置生存时间,这在Docker容器的Web应用中也能实现。

If you wanted to, you can also do fancy things like add a time to live to every single objects, and this is something you could do in a Docker container for a web app.

Speaker 2

但处理LLM时最棒的是,你总能事后比较不同LLM的表现,比如这个LLM和那个相比如何?

But the main thing that's always nice when you're dealing with LLMs, is you always want to be able to say in hindsight, like, okay, how did this LLM compare to that one?

Speaker 2

你需要比较输出结果。

You want to compare outputs.

Speaker 2

然后只需在函数上添加一点装饰器,就能将其存入SQLite,这样你就彻底解决了这个顾虑。

And then just writing a little bit of a decorator on top of a function is the way to put it in SQLite, and you're just done with that concern.

Speaker 2

这简直太棒了。

That is just amazing.

Speaker 2

而我们正在直接使用这个缓存。

And we're using this cache directly.

Speaker 2

如果你在命令行使用Simon Willison的LLM工具,那里也有一个机制可以让你按需将数据存入SQLite。

If you're using LLM by Simon Willison from the command line, there's also a mechanism there so that you can get it into SQLite if you wanted to.

Speaker 2

所以这也是个可以考虑的功能。

So that's also a feature you could consider.

Speaker 2

当然,

Of course,

Speaker 0

他肯定会往SQLite里塞点东西。

he's gonna put something in SQLite.

Speaker 0

就像,他不可能写出一个不往SQLite里塞东西的库,他的数据集项目就是这样的。

Like, he couldn't write a library that doesn't put something in SQLite, his dataset projects.

Speaker 2

那可是西蒙·威利森啊。

It's Simon Willison.

Speaker 2

就算是周日,他也会把SQLite塞进SQLite里。

He'll put SQLite in SQLite if it's a Sunday.

Speaker 2

没错。

Exactly.

Speaker 2

但Discache——如果你还没用过它的话——绝对是那种让你觉得‘因为兜里装着这个工具,就能解决更多问题’的库。

But Discache if you but if you haven't used Discache before, it definitely feels like one of these libraries that because I have it in my back pocket, it just feels like I can tackle more problems.

Speaker 2

简而言之就是这样。

That's the short story of it.

Speaker 2

再说一次,课程里只是很基础地使用了它,但要知道你在LLM里做的每件事其实都只需要执行一次。

And again, the course uses it in a very sort of basic fashion, but knowing that everything you do in an LLM can only only needs to happen once.

Speaker 2

如果你只想用一次,这能省下不少钱。

If you're interested in using it once, that just saves you so much money.

Speaker 0

是啊。

Yeah.

Speaker 0

而且它真的非常实用。

And it's it's so useful.

Speaker 0

你在课程中做的一件事是,你说过,好吧,我们要存储的值的键将由模型、模型设置和提示组成。

So one of the things you did in the course is you said, alright, the key for the value that we're gonna store is gonna be the model, the model settings, and the prompt Yes.

Speaker 0

作为一个元组。

As a tuple.

Speaker 0

对吧?

Right?

Speaker 0

大致是这么个意思。

Something along those lines.

Speaker 0

然后你就用这个作为键。

And then you use that as the key.

Speaker 0

所以如果其中任何一项有变化,模型会变吗?

So if any of those variations change, does the model change?

Speaker 0

设置改变了吗?

Do the settings change?

Speaker 0

或者说,任何变化都意味着那是一个完全不同的请求。

Or like, anything, it's that's a totally different request.

Speaker 0

然后你只需存储响应,就这么简单。

And then you just store the response, and then boom.

Speaker 0

如果你用相同的模型、相同的提示和相同的设置提出完全相同的问题,为什么还要花十秒钟等待、浪费金钱并造成环境负担,而实际上你可以在微秒内得到答案呢?

If you ask the exact same question of the same model with the same prompt with the same settings, why do you need to go and wait ten seconds and burn money and environmental badness when you could literally within a microsecond get the answer back?

Speaker 2

是的。

Yeah.

Speaker 2

而且在此基础上还有一个巧妙的技巧可以用。

And there's also a fancy and there's a trick you can do on top.

Speaker 2

有时候你会想说,这里还存在一个统计层面的问题。

So sometimes you wanna say, well, there's a statistical thing also happening.

Speaker 2

所以有时候我希望针对一个输入存储大约10个输出,这样我就可以查看所有这些输出,或许之后还能进行标注。

So sometimes I wanna have one input and actually store maybe 10 outputs so I can look at all these outputs, maybe annotate that later.

Speaker 2

解决这个问题的方法就是在元组里加个整数,这样你就能存储多个输出结果了,如果你真想这么做的话。

And the way you solve that is you just add an integer to the the tuple, basically, and then you're also able to store many outputs if you really like.

Speaker 2

对。

Right.

Speaker 2

天空才是极限。

Sky's the one.

Speaker 0

第八个。

The eighth one.

Speaker 0

随便吧。

Whatever.

Speaker 0

嗯哼。

Uh-huh.

Speaker 2

是的。

Yeah.

Speaker 2

不。

No.

Speaker 2

这很酷。

It's cool.

Speaker 2

而且很灵活。

And Flexible.

Speaker 0

是啊。

Yeah.

Speaker 0

它还能做一大堆非常非常神奇的事情。

And it does a whole bunch of neat things that are really, really wild.

Speaker 0

比如看起来就像,嘿,我把这个值放进去,它就存起来了。

Like so it looks like just, hey, I put this value into it, right, and it stores it.

Speaker 0

它非常强大,因为可以跨应用执行。

It's really powerful because across application executions.

Speaker 0

所以,比如你在笔记本里缓存那个响应,然后做些测试,如果之后回来重新启动笔记本或内核之类的,它不像LRU缓存那样。

So, like, maybe if you're caching that response in your notebook and what are you doing some testing, if you come back later, you've start the notebook back up or restart the kernel or whatever, like, it's not like a LRU cache.

Speaker 0

它能记住是因为数据存储在本地SQLite文件的临时存储里,这太棒了。

It remembers because it's stored somewhere in, like, temporary storage in a local SQLite file, which is amazing.

Speaker 0

它还有一些有趣的设计理念。

It also has interesting ideas.

Speaker 0

我不太确定具体在哪里,但它确实有不同类型的缓存机制。

I'm not sure really where they are, but, like it has different kinds of caches as well.

Speaker 0

所以你可能在里面存储了大量数据。

So maybe you're storing a ton of stuff in there.

Speaker 0

因此它基本上会实现内置的分片功能。

And so it'll do basically built in sharding.

Speaker 2

哦,是啊。

Oh, yeah.

Speaker 2

你可以看到

You can see the

Speaker 0

轻量级文件,而且效果非常非常好。

light files and it's really really good.

Speaker 0

这是个非常深奥的库。

It's it's this is a deep library.

Speaker 0

这不仅仅是,哦,是的。

This is not just, oh, yeah.

Speaker 0

就像是,哦,你在办公桌前吗?

It's like, oh, are you at the desk?

Speaker 2

所以这个库最酷的地方在于它确实功能深入,但如果你只想把它当字典用,也完全可以。

So so the fun the cool thing about that library is it really does go deep, but if you really just wanna use it as a dictionary, you can.

Speaker 2

这就是我真正喜欢它的地方。

Like, that's the thing that I really love about it.

Speaker 2

从各方面来说,你完全可以把它当作字典来用,完全没问题。

It for all intents and purposes, you just treat it as a dictionary and you're good.

Speaker 2

或者把它当作函数装饰器使用,同样简单好用。

Or use it as a decorator on a function, and again, you're good.

Speaker 2

所以,这又是一个小技巧——只要你了解这个库,就能在常规Python开发中事半功倍。

So, like, again, it's it's one of those little hacks where, oh, if you just know about the library, just become more productive at typical Python stuff.

Speaker 0

是啊。

Yeah.

Speaker 0

我来告诉你一个我正在实际使用它的场景。

I'll give you a place where I'm using it actually.

Speaker 0

我在一些LLM相关的项目中用到它,就像你提到的原因那样,当我针对语言模型编程时。

I I use it on some LLM stuff, like when I'm programming against an LM for exactly the reason you did.

Speaker 0

因为如果输入相同,就没必要重复提问。

Because if you have the same inputs, don't ask the question again.

Speaker 0

直接给你答案就行。

You just here's the answer.

Speaker 0

这真的非常快。

It's real real fast.

Speaker 0

但如果你转到,比如说,Talk Python这边来看看。

But if you go over to, like, talk Python let's see here.

Speaker 0

以嘉宾部分为例。

Go over the guests, for example.

Speaker 0

对吧?

Right?

Speaker 0

所以这里有一大堆嘉宾。

So there's a bunch of guests.

Speaker 0

这位是文森特。

And here we have Vincent.

Speaker 0

不是那个文森特。

Not that Vincent.

Speaker 0

也不是那个文森特。

Not that Vincent.

Speaker 0

这才是你。

There you are.

Speaker 0

那个文森特。

That Vincent.

Speaker 2

这些文森特都是谁啊?

Who these Vincents?

Speaker 0

他们到处都是。

They're all over the.

Speaker 0

是啊。

Yeah.

Speaker 0

我大概有560位客人左右。

I have like 560 guests or something.

Speaker 0

数量相当多。

There's a lot.

Speaker 0

但在这里你会注意到,如果你查看这个东西的源代码,到处都是,只要有图片,末尾就会带这个小缓存ID。

But in here, you'll notice that if you go into the view the source on this thing, like, all over the place, anytime there's a picture, it'll have this little cash busting ID on the end.

Speaker 0

嗯哼。

Mhmm.

Speaker 0

本地加载时没问题,因为你可以直接看文件,知道它只是个文件,所以启动时缓存是一样的。

And that's fine when it's served locally because you can just look at the file and go, it's just a file, so it was the same cache at startup.

Speaker 0

但如果它来自类似S3 blob存储,应用重启后,我怎么知道那是什么?

But if it comes from like a s three blob storage, you know, and the app restarts, how do I know what that is?

Speaker 0

就是说,它必须重新下载整个...

Like, it has to go it would have to redownload the entire

Speaker 2

过程

process of

Speaker 0

博客

the blog.

Speaker 0

快看这个

It's so check this out.

Speaker 2

Yeah.

Speaker 2

所以我刚添加了 对

So I just added Yeah.

Speaker 2

Yeah.

Speaker 2

Yeah.

Speaker 2

Yeah.

Speaker 2

这感觉像是在正规CDN和从S3获取之间还有某种中间状态。

So this feels like there there's something between the proper CDN and then getting it from s three.

Speaker 2

就是说,有时候你需要一个介于两者之间的解决方案,而这个缓存可能正好适用。

Like, there are these moments when you wanna have something that's kind of in between, and then this cache could actually be a good solution for it.

Speaker 0

没错。

Exactly.

Speaker 0

这个网站的工作原理是它有一个磁盘缓存。

So what the site does is it has a disk cache.

Speaker 0

每当它需要引用外部资源时,就会下载一次,计算哈希值,然后存入磁盘缓存——除非背后的资源有变动。

And anytime it has it says, hey, I wanna, like, refer to a resource that's external, it'll download it once, compute the hash, and then store it in the disk cache unless you change something behind it.

Speaker 0

这样就能自动利用这个机制,确保资源永不陈旧,即使是从类似S3这样的远程服务获取,也能瞬间加载。

And so it's, like, automatically using this, and it makes everything, like there's never stale resources, and it's instantly fast even if they're served out of, like, something remote, like s three equivalent.

Speaker 2

那你们...

And do you Yeah.

Speaker 2

你们还做直播吗?

Do you also do a So to live?

Speaker 2

存活时间也是,比如每天允许刷新一次之类的,我猜?

It is also time to live is also, like, every day is allowed to refresh once or something like that, I suppose?

Speaker 0

对,是的。

For yeah.

Speaker 0

对于S3的内容,我没有设置,因为我配置了所有管理功能,只要我通过管理界面更改了内容,它就会从缓存中删除。

For the s three stuff, I don't because I've set up all the admin functions that if I ever change one through the admin, it deletes it out of the cache.

Speaker 2

明白了。

Gotcha.

Speaker 2

明白了。

Gotcha.

Speaker 0

所以它是内部一致的。

So it's like, it's internally consistent.

Speaker 0

但对于其他内容,比如从字典中解析出的描述信息,它们会有一个大约一天的存活时间。

But for, like, other things, like, it re if it parses something out of the, say, the description which sits set in the dictionary, that stuff, it's just got a time to live of, like, a day or something.

Speaker 0

有很多这样的设置。

It's got, like, a there's a bunch of those.

Speaker 0

所以我正在使用所有这些不同的地方。

So the I'm using all these different places.

Speaker 0

哇哦。

And wow.

Speaker 0

这太棒了。

It's so good.

Speaker 0

我只是想道声谢谢,因为我知道我们今天会讨论这个,因为这实在太棒了。

I just wanted to say thank you because I knew we're gonna talk about it today because this is so good.

Speaker 2

是啊。

Yeah.

Speaker 2

我知道。

I know.

Speaker 2

这简直——如果它是标准库的一部分,我一点都不会感到惊讶。

It's it's it like, it's it's one of the if it was part of the standard library, I would honestly not be surprised.

Speaker 2

就像,这也是关于它的故事。

Like, that's also the the the story with that.

Speaker 2

不过,SQLite确实很棒。

But, yeah, SQLite is great.

Speaker 2

磁盘缓存也很出色。

Disc cache is great.

Speaker 2

它用起来像字典,但功能却强大得多。

It's it feels like a dictionary, but it gives you so much more.

Speaker 2

这太棒了。

It's great.

Speaker 2

这就是我能说的全部了。

That's the the only thing I could say about it.

Speaker 0

观众可能在想:等等,

So people are probably like, wait.

Speaker 0

我以为我们在讨论大语言模型?

I thought we were talking about LLMs.

Speaker 0

是啊。

Yeah.

Speaker 0

有趣之处在于,有这么多有意思的工具,甚至不需要用到智能代理AI,也不仅仅是那些专为LLM问题设计的酷炫库和工具,它们同样能应用于其他领域。

We interesting things is because there's all these interesting tools, and it's not even about using agentic AI, and it's not not like, there's really cool libraries and tools that you can just apply to this LLM problem, but also apply everywhere else.

Speaker 0

对吧?

Right?

Speaker 2

这是我在使用LLMs开发软件时发现的一个普遍现象。

It's one of those so it's one thing I have found with LLMs in general if you're building software with it.

Speaker 2

一方面,我认为如果你是个资深工程师,它会非常有用,因为你会知道类似‘我需要一个缓存’这样的概念。

On the one end, I think it can be very helpful if you're like a proper senior engineer kind of a person, because then you know about things like, oh, I want a cache.

Speaker 2

什么样的缓存最实用?

What's a pragmatic cache?

Speaker 2

顺便说一句,你也可以选择Redis。

And you can also pick Redis, by the way.

Speaker 2

如果你当时用了Redis,同样也能解决问题。

If you would have used Redis for this, that could have also worked.

Speaker 2

只是我觉得确实如此。

Just that I think Sure.

Speaker 0

本来也没问题。

It would been fine.

Speaker 2

是啊。

Yeah.

Speaker 2

本来也没问题的。

Would have been fine.

Speaker 0

我喜欢的是不需要服务器。

What I like is there's no servers.

Speaker 0

我不需要操心服务器。

I don't have to deal with the servers.

Speaker 0

我喜欢这样,它就是个文件。

I like, it's just it's a file.

Speaker 0

确实如此。

It's very true.

Speaker 0

这样更简单。

It just keeps it simpler.

Speaker 2

这完全正确。

It's totally true.

Speaker 2

但我想在这里强调的是,你之前作为专业工程师的经验仍然有助于编写优秀的LLM软件。

But I the the point I wanted to get it here, like, your previous experience as a proper engineer will still help you write good LLM software.

Speaker 2

不过,从类似的角度来看,我也认为我们确实有这一代的数据科学家,可能还有数据工程师、数据分析师这类人才。

However, from a similar perspective, I also think that we do have this generation of data scientists and maybe data engineer, data analyst kind of person.

Speaker 2

以分析的方式思考,对算法输出保持相当批判性的态度。

Thinking analytically, being quite critical of the output of an algorithm.

Speaker 2

我想说,在当今这个时代,具备这种素质也很重要。

That's also a good bone to have in this day and age, I would say.

Speaker 2

因为在我那个年代,我确实构建过几个推荐系统。

Because if I've built a couple of recommenders back in my day.

Speaker 2

到现在差不多有十年了。

Like, it's been a decade now.

Speaker 2

但当你构建推荐系统时,确实会学到一点:你会面临这样的问题——'嘿,我给用户推荐了这个,他们点击了'。

But like, one of the things you do learn when you're building a recommender is that you're stuck with this problem of, hey, I gave this user this recommendation and they clicked it.

Speaker 2

如果我向他们推荐了其他东西,他们会点击那个吗?

Would they have clicked this other thing if I would have recommended it to them?

Speaker 2

突然间你面对的是一个高度随机且难以预测的系统,你必须对测试和比较这些不同算法的方式保持严格态度,你会想再三考虑如何进行AB测试。实际上,就像磁盘缓存作为工具很有用一样,脑海中掌握一些统计学方法论也会对你有所帮助,因为比较LLMs很大程度上就是在进行评估工作。

And suddenly you're dealing with a system that's like really stochastic and hard to predict and you have to be kind of strict about the way you test and compare these different algorithms and you wanna think twice about the way you AB test these things and oh, actually, just like Disk Cache is useful as a tool, having a little bit of methodology statistically in your mind will also help you because comparing LLMs, a lot of it is doing evaluations.

Speaker 2

就是要在这方面保持严格。

Like being being kind of strict about that.

Speaker 2

这也是我在课程中努力展示的——如果你对评估工作非常严格,你就会发现对于某些问题,使用scikit learn仍然更合适,因为你通过评估会发现,在scikit learn那边的数值表现更好。

And that's also what I try to do in the course, I try to just show you that if you're really strict about the evaluations, then you can also learn that for some problems, you're still better off using scikit learn because you just evaluate it and then you learn that like, the number is better on the scikit learn side of things.

Speaker 0

是啊。

Yeah.

Speaker 0

这时候你就会觉得,'哦,也许我做错了',或者你花了一大笔钱运行昂贵又缓慢的LLM,结果发现还不如用一个简单的预测模型。

That's that's when you feel like, oh, maybe I did it wrong or you you paid a bunch of money to run expensive slow LLMs and you're like, I would just use a predicament.

Speaker 2

哇。

Wow.

Speaker 2

你这么说真有意思。

So it's funny you say that.

Speaker 2

其实我最近一直在和荷兰一些公司里从事大语言模型工作的人交流。

So I'm I'm I've actually been talking to a bunch of people that do LLMs at companies here in The Netherlands.

Speaker 2

你知道,去参加个PI数据会议,给他们灌点啤酒让他们酒后吐真言。

And you know, you you go to a PI Data, you go to a conference, and you give them just enough beer so they're honest.

Speaker 2

就是那种情况。

You know, that that kind of a situation.

Speaker 0

保密协议的门帘稍微掀开了一点,诸如此类。

The NDA curtain opens just a little or whatever.

Speaker 2

再说了,这个游戏的关键就在于模棱两可。

Plus, moldeniability is the name of the game in this one.

Speaker 2

没错。

Yes.

Speaker 2

但听到的故事还挺鼓舞人心的——他们都说现在有AI项目预算了,所以我们会尝试各种大语言模型,或者投资评估之类的工作。

But then the stories you hear, which I did find somewhat encouraging, is they do all kind of go, well, there's budget now to do AI stuff, which means that we we try out all the different LLMs or we'd be like invest in evals and that sort of a thing.

Speaker 2

有趣的是,我们还会放些基础模型进去作为必须超越的标准基准。

And funnily enough, we also put some base models in there, like as a standard benchmark that we should beat.

Speaker 2

我最近多次听到这样的故事:由于LLM和AI的热潮,在实施并完成所有基准测试后,人们发现AI反而让Scikit Learn在许多地方投入了实际应用。

And it kind of, I've heard a story a bunch of times now that because of the hype around LLMs and AI, after it was implemented, after they did all the benchmarks, it turns out that AI is the reason that Scikit Learn is now in production in a bunch of places.

Speaker 2

spaCy的情况也类似,因为很多人发现:当你提供足够训练数据后(这些数据无论如何你都需要用于评估),spaCy模型或轻量级模型的表现与LLM模型相差无几。

And it's also the same thing with spaCy because what a lot of people do learn is that, hey, if the spaCy model or the lightweight model, so to say, is somewhat equivalent to the LLM model after you give it enough training data, which you do want to have either anyway because you need that for evaluations.

Speaker 2

通常这些模型更加轻量化,而且总能保持输出的一致性。

Well, typically those models are more lightweight and they will always produce the same output.

Speaker 2

相同的输入永远会产生相同的预测结果。

Same thing goes in, same prediction will always come out.

Speaker 2

你可以轻松地将其隔离部署,放在普通虚拟机上运行也完全没问题。

And you can really fence it off, have it on like a normal VM, that's also totally fine.

Speaker 2

哦还有另一个优势,它的运行资源消耗极低。

Oh, and another benefit, it's super lightweight to run.

Speaker 2

你只需要一个Lambda函数就能搞定。

You just need a Lambda function and you're good.

Speaker 2

完全不需要GPU或者支付高昂的云服务账单之类。

As opposed to like a GPU or like a huge cloud bill or something like that.

Speaker 2

所以我听到的一些故事确实表明,这些语言模型也在帮助推动标准的数据科学工作。

So some of the stories that I'm hearing do suggest that, okay, these LMs are also helping out like standard data science work, if it were.

Speaker 2

仅仅因为管理层现在确实想认真对待这项投资,并真正希望进行实验。

If only because management now really does want to be serious about the investment and really wants to do the experiments.

Speaker 0

本段TalkPython内容由Nordstellar为您呈现。

This portion of TalkPython to me is brought to you by Nordstellar.

Speaker 0

Nordstellar是Nord Security家族推出的威胁暴露管理平台,该团队也是NordVPN的开发者,平台整合了暗网情报、会话劫持防护、品牌滥用检测及外部攻击服务管理功能。

Nordstellar is a threat exposure management platform from the Nord Security family, the folks behind NordVPN, that combines dark web intelligence, session hijacking prevention, brand abuse detection, and external attack service management.

Speaker 0

保障团队和公司安全是一项艰巨挑战。

Keeping your team and your company secure is a daunting challenge.

Speaker 0

这就是为什么你需要Nordstellar的支持。

That's why you need Nordstellar on your side.

Speaker 0

它提供全面的服务组合、监控和警报系统,以降低您遭遇数据泄露和攻击的风险,并在事件发生时立即采取行动。

It's a comprehensive set of services, monitoring, and alerts to limit your exposure to breaches and attacks, and act instantly if something does happen.

Speaker 0

其运作机制如下:Nordstellar能检测到员工和消费者凭证的泄露情况。

Here's how it works: Nordstellar detects compromised employee and consumer credentials.

Speaker 0

它能检测到信息窃取日志和暗网来源中被盗的认证cookie,标记受入侵设备,无需在应用中添加额外代码即可减少多因素认证绕过导致的账户接管攻击。

It detects stolen authentication cookies found in Infostealer logs and dark web sources, and flags compromised devices, reducing MFA bypass ATOs without extra code in your app.

Speaker 0

Nordstellar会扫描暗网上针对您公司的网络威胁。

Nordstellar scans the dark web for cyber threats targeting your company.

Speaker 0

它监控论坛、市场、勒索软件博客以及超过25,000个网络犯罪电报频道,提供可预警且可搜索的上下文信息,您可以将这些信息路由到Slack或事件响应工具中。

It monitors forums, markets, ransomware blogs, and over 25,000 cybercrime telegram channels with alerting and searchable context you can route to Slack or your IR tool.

Speaker 0

Nordstellar还提供品牌和域名保护功能。

Nordstellar adds brand and domain protection.

Speaker 0

它通过视觉相似性、内容相似性和搜索透明度日志检测域名抢注和仿冒网站,并在全网范围(包括社交媒体和应用商店)执行更广泛的品牌滥用下架,从而降低用户遭受钓鱼攻击的风险。

It detects cyber squats and look alikes via visual, content similarity and search transparency logs, plus broader brand abuse takedowns across the web, social and app stores to cut the phishing risk for your users.

Speaker 0

他们不仅会就冒充行为向您发出警报,还会处理并管理下架流程。

They don't just alert you about impersonation, they file and manage the removals.

Speaker 0

最后,Nordstellar对开发者非常友好。

Finally, Nordstellar is developer friendly.

Speaker 0

它提供平台和API两种使用方式。

It's available as a platform and an API.

Speaker 0

无需安装任何代理程序。

No agents to install.

Speaker 0

如果安全对您和您的组织至关重要,不妨了解一下Nord Stellar。

If security is important to you and your organization, check out Nord Stellar.

Speaker 0

请访问talkpython.fmnordstellar。

Visit talkpython.fmnordstellar.

Speaker 0

链接可在播客播放器的节目说明和剧集页面中找到。

The link is in your podcast player show notes and on the episode page.

Speaker 0

请使用我们的专属链接talkpython.fm/nordstellar,这样他们就知道您是通过我们了解到他们的服务。

Please use our link talkpython.fm/nordstellar so that they know that you heard about their service from us.

Speaker 0

您知道现在是一年中的什么时候吗?

And you know what time of year it is?

Speaker 0

现在是深秋时节。

It's late fall.

Speaker 0

这意味着黑色星期五也即将到来。

That means Black Friday is in play as well.

Speaker 0

Nordstellar团队给了我们一个优惠码:Black Friday twenty。

So the folks at Nordstellar gave us a coupon, Black Friday twenty.

Speaker 0

就是Black Friday(全大写连写)加上twenty two zero。

That's Black Friday, all one word, all caps, twenty two zero.

Speaker 0

使用该码可享受8折优惠。

That grants you 20% off.

Speaker 0

如果你近期准备注册他们的服务,不妨使用优惠码Black Friday twenty,省下20%的费用。

So if you're gonna sign up for them soon, go ahead and use Black Friday twenty as a code, and you might as well save 20%.

Speaker 0

优惠有效期至2025年12月10日。

It's good until 12/10/2025.

Speaker 0

感谢Nord安全团队对《TalkPython》节目的支持。

Thank you to the whole Nord security team for supporting TalkPython to me.

Speaker 0

可以说我们的计划是引入AI功能,用户会想先看看效果如何,所以我们进行了测试,然后

You could say we're gonna use your mandate is to add AI and then you go user like, well, we got to see how well it's working so we tested it and then

Speaker 2

我们需要将其与基准指标进行对比,而实际上这个基准...

We have to compare it to something of a benchmark, and then the benchmark actually

Speaker 0

这个基准测试又快又几乎免费,效果也差不多好。

The benchmark's fast and effectively free, and about as good.

Speaker 0

所以,我们没问题。

So, we're good.

Speaker 0

我们只是

We're just

Speaker 2

打算这么做,你懂吧?

gonna do that, you know?

Speaker 2

我觉得是的。

I think it's Yeah.

Speaker 2

不过没关系。

But it's fine.

Speaker 2

有些组织需要来自上层的强制指令才能推动事情。

Some organizations need, like, mandate from above in order to get something done.

Speaker 2

而这次LLM热潮,至少确实引发了自上而下的强制指令。

And this LLM craze, if nothing else, does seem to have caused the mandate from above.

Speaker 0

我确信如此。

I'm sure it has.

Speaker 2

所以这是件好事。

So that that's a that's a good thing.

Speaker 2

亲爱的听众,这也是你需要牢记在心的一点。

Something I would keep in the back of your mind as well, dear listener.

Speaker 2

有时候这种授权也能让你有权限去做其他事情。

Like, sometimes that mandate can also give you permission to do other things.

Speaker 0

是啊。

Yeah.

Speaker 0

我已经很久没在大型企业类公司工作了。

Not not working for a large enterprise type company for quite a while.

Speaker 0

我猜想自己对这些来自高层的指令如何转变相当迟钝。

I've I imagine I'm pretty blind to how that that is that is transforming, you know, directives from the top.

Speaker 0

但我敢肯定老板们都在说:'我在用ChatGPT,它比我们的软件好太多了'。

But I'm sure bosses are like, I'm using ChatGPT and it's so much better than our software.

Speaker 0

我们该怎么应对这个问题呢?

What are we gonna do about that?

Speaker 0

你知道吗?

You know?

Speaker 2

是啊。

Yeah.

Speaker 2

嗯,我在开发者工具领域工作,既会与大公司也会与小公司打交道。

It's well, I mean, I'm in the developer tooling space, I still talk to big companies and small companies as well.

Speaker 2

你会注意到大公司的运作方式确实与小公司不同。

And you do notice that big companies, they work differently than small companies.

Speaker 2

这无疑是事实,无论好坏。

That is certainly true, for better or worse.

Speaker 2

比如,大公司也有其合理之处——如果我是银行,遵守某些规则确实是必要的,也确实如此。

Like, there's also good there's also good reasons why bigger com like, if I'm a bank, like, I'm I'm pretty sure it's a good idea to also have some rules that I have to abide by, which Oh, it is.

Speaker 2

没错。

Yeah.

Speaker 0

我更多是在想,高层管理人员与产品之间有多脱节,以及他们多大程度上只是在发号施令。

I'm just thinking more of, like, how disconnected is the higher level management from the product and, like, how much do they just, like, dictate a thing.

Speaker 0

好的。

Okay.

Speaker 0

那我们来谈谈一些工具吧。

So let's talk about some of the tools.

Speaker 0

你主要关注的事情之一就是使用Simon Willison的LLM

One of the things you primarily focused on was using Simon Willison's LLM

Speaker 2

是的。

Yes.

Speaker 0

库。

Library.

Speaker 0

给我们讲讲这个东西。

Tell us about this thing.

Speaker 2

关于这个库的有趣之处在于,它实际上更像是作为一个命令行工具设计的。

So the funny thing about that library is that it's actually kind of more meant as a command line utility.

Speaker 2

我认为这基本上就是他设计的入口点。

I think that's kind of the the the entry point that he he made.

Speaker 2

但他也确保围绕它提供了一些Python API接口。

But then he also just made sure there was some sort of a Python API around it.

Speaker 2

在看过那个库并尝试了其他所有库之后,我很高兴这么说——这是句赞美——我发现Simon Willison的LLM库是目前为止最‘无聊’的一个。

And after looking at that library and also after playing around with all these other libraries, and I'm glad to say this, but this is a compliment, I just found the LLM library by Simon Willison by far to be the most boring.

Speaker 2

我这么说完全是褒义的。

And I mean that really in a good way.

Speaker 2

它毫不花哨,只专注于少数功能。

Just unsurprising, only does a few things.

Speaker 2

而这些少数功能的表现都非常稳定可靠。

The few things that it does is just in a very predictable way.

Speaker 2

特别是在快速原型开发时,我感觉很棒的是它确实提供了能让你快速搭建的积木块,但又不会让你陷入可能最终束缚你的抽象层中。

And especially if you're doing rapid prototyping, what I felt was just kinda nice is that it does feel like you have building blocks that allow you to build very quickly, but it doesn't necessarily feel like you're dealing with abstractions that can sort of wall you in at some point.

Speaker 2

所以对于入门级的'Hello World'来说,它就是用非常Pythonic的方式完成一些事情。

So for a hello world getting started, just do some things in a very Pythonic way.

Speaker 2

这个‘无聊’的库确实很管用。

This boring library really did the trick.

Speaker 2

而且我很高兴地告诉大家,它至今仍是我常用的库。

And I'm also happy to report it's still a library that I use.

Speaker 2

它绝对是我工具库中的常备选项。

Like, it's still definitely a library in my tool belt.

Speaker 2

每当我想快速实现某些功能时,这绝对是我的首选工具。

Whenever I wanna do something real quick, that is definitely a tool that I refer to.

Speaker 2

其中有一点

And one of the things

Speaker 0

那么它算是一种对不同LLM的抽象封装吗?

that So is it kind of a is it kind of an abstraction across the different LLMs and that kind of stuff?

Speaker 0

比如我想在Anthropic和OpenAI之间切换,这会有影响吗?

Like, I wanna talk to Anthropic versus OpenAI, does that matter?

Speaker 2

我认为这个库的构建方式也体现了良好的设计品味。

So the the way that the and the way that this is built is also, I think, with good taste.

Speaker 2

作为一个库,你不想做的是声称要支持世界上所有的库。

So what you don't want to do as a library is say like, I'm gonna basically support every library under the sun.

Speaker 2

因为作为一个单独的维护者,比如Simon Willison,你会被这些不同的供应商淹没。

Because as a single maintainer, in the case of Simon Willison, you're just gonna drown in like all these different providers.

Speaker 2

所以他选择的是建立一个插件生态系统。

So what he went for instead was a plug ecosystem.

Speaker 2

插件生态系统的缺点是,你将维护特定来源插件的责任转嫁给了其他维护者。

At a downside of a plug in ecosystem is that then you defer the responsibility of, like, maintaining a plug in for a specific source to another maintainer.

Speaker 2

但可能会有Mistral的员工来开发Mistral插件。

But you might get someone who works at Mistral to make the Mistral plug in.

Speaker 2

也可能会有OpenRouter的员工来开发OpenRouter插件,等等。

And you might get someone who works at OpenRouter to make the OpenRouter plug in, etcetera.

Speaker 2

这样你就能以一种不错的方式分散工作量。

So you do distribute the workload in kind of a nice way.

Speaker 2

而且所有主流模型都得到了支持。

And all the bigger models are definitely supported.

关于 Bayt 播客

Bayt 提供中文+原文双语音频和字幕,帮助你打破语言障碍,轻松听懂全球优质播客。

继续浏览更多播客