20260617:目前有914 页

This commit is contained in:
2026-06-17 15:02:40 +08:00
parent e96b955fda
commit 91fac5b6fc
423 changed files with 20687 additions and 34 deletions

37
concepts/pydantic.md Normal file
View File

@@ -0,0 +1,37 @@
---
title: "Pydantic"
created: 2026-06-10
updated: 2026-06-10
type: concept
tags: [pydantic, validation, python, llm-infrastructure]
sources: [raw/articles/pydantic-three-piece-suite-2026.md]
---
# Pydantic
> Python 数据校验库,已演化为由三层组成的 AI 基础设施生态Rust 验证引擎 + OTel 可观测平台 + 类型安全 Agent 框架。
## 生态三层
| 层 | 组件 | 角色 |
|---|------|------|
| 引擎层 | [[pydantic-core|pydantic-core]] | Rust 校验引擎,脱离 GIL多线程并发 |
| 可观测层 | [[logfire|Logfire]] | 基于 [[open-telemetry|OTel]] 的可观测平台 |
| Agent 层 | [[pydantic-ai|Pydantic AI]] | 类型安全的 Agent 框架 |
## 认知误区
大多数人包括用了两年的人只碰了三分之一——BaseModel 校验。实际上 pydantic 已经从一个校验库长成了 AI 基础设施。
## 关键演化
- Pydantic V1 → V2从纯 Python 到 Rust 引擎pydantic-core性能 5-17× 提升
- BaseModel → TypeAdapter从单一校验模式到灵活严格度控制
- 校验 → 可观测 → Agent 约束:类型系统从"报错器"进化为"编译器"
## 参考
- [[pydantic-core|pydantic-core]]
- [[logfire|Logfire]]
- [[pydantic-ai|Pydantic AI]]
- [[pydantic-three-piece-suite|Pydantic 三件套]]