Files
myWiki/concepts/pydantic.md

1.3 KiB
Raw Blame History

title, created, updated, type, tags, sources
title created updated type tags sources
Pydantic 2026-06-10 2026-06-10 concept
pydantic
validation
python
llm-infrastructure
raw/articles/pydantic-three-piece-suite-2026.md

Pydantic

Python 数据校验库,已演化为由三层组成的 AI 基础设施生态Rust 验证引擎 + OTel 可观测平台 + 类型安全 Agent 框架。

生态三层

组件 角色
引擎层 [[pydantic-core pydantic-core]]
可观测层 [[logfire Logfire]]
Agent 层 [[pydantic-ai Pydantic AI]]

认知误区

大多数人包括用了两年的人只碰了三分之一——BaseModel 校验。实际上 pydantic 已经从一个校验库长成了 AI 基础设施。

关键演化

  • Pydantic V1 → V2从纯 Python 到 Rust 引擎pydantic-core性能 5-17× 提升
  • BaseModel → TypeAdapter从单一校验模式到灵活严格度控制
  • 校验 → 可观测 → Agent 约束:类型系统从"报错器"进化为"编译器"

参考