20260617:目前有914 页
This commit is contained in:
37
concepts/pydantic.md
Normal file
37
concepts/pydantic.md
Normal 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 三件套]]
|
||||
Reference in New Issue
Block a user