Week 2 · Tools & Agent
让 LLM 不只输出文本,还能调外部工具、产出结构化结果、稳健流式响应。
章节
- tools agent — tool calling + agent 循环
- structured output — Pydantic schema 强约束 LLM 输出
- streaming and resilience — 流式 + 重试 + fallback
学完应能
- 给 LLM 注册自定义 tool 并跑出可用 agent
- 用
with_structured_output拿到类型安全的 JSON - 处理 rate limit / 超时 / 网络抖动