Pydantic AI integration does not record reasoning tokens
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从 pydantic_ai/spans/utils.py 中的 _set_usage_data 入手,追踪它如何从 RequestUsage 读取 token 使用量。检查现有的 OpenAI 集成和相关测试,了解 reasoning-token 属性的约定。完成标准是:Pydantic AI spans 从 details["reasoning_tokens"] 记录 reasoning tokens,并且有测试验证该属性。
由索引模型根据 Issue 内容生成。
描述
Version
2.71.0 (master @ 6a4eb20), pydantic-ai 2.x
Steps to Reproduce
Run a Pydantic AI agent on a reasoning model (e.g. gpt-oss-20b), so the response usage has reasoning tokens. Pydantic AI stores them in RequestUsage.details["reasoning_tokens"].
Expected Result
The chat span has gen_ai.usage.output_tokens.reasoning, like the OpenAI integration.
Actual Result
No reasoning attribute. _set_usage_data (pydantic_ai/spans/utils.py#L49-L87) reads input, cache, output and total tokens but not details. On live calls the provider reported 9, 14 and 16 reasoning tokens and the spans had none.
I have a small fix with a test and can open a PR if that works for you.
- 主要语言
- Python
- 星标
- 2.2k
- 派生
- 680
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 264
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-python 的其他 Issue
-
Bug Python
难度 2/5 1-3 小时 新手友好度 76/100
getsentry/sentry-python#7870 · 2 条评论 ·
维护者通常 1 天内回复
-
Include `send_default_pii` migration in migration docs可能已有人在做 @ericapisani 于 1 天前认领。 未关闭Docs Python
难度 1/5 1 小时以内 新手友好度 85/100
getsentry/sentry-python#7568 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Python
难度 2/5 1-3 小时 新手友好度 68/100
getsentry/sentry-python#6992 · 1 条评论 ·
维护者通常 1 天内回复
-
Improvement Python
难度 2/5 1-3 小时 新手友好度 65/100
getsentry/sentry-python#6970 · 1 条评论 ·
维护者通常 1 天内回复
-
match_regex_list raises IndexError when a pattern list contains an empty string可能已有人在做 @wahajahmed010 于 103 天前认领。 未关闭Bug Python
难度 2/5 1-3 小时 新手友好度 74/100
getsentry/sentry-python#6504 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/sentry-python 的全部 Issue
相似的 Issue
-
changelog investigate
难度 2/5 1-3 小时 新手友好度 62/100
ramnes/notion-sdk-py#409 ·
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
lindicaphxag-tech/kaggle#28 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
BSData/horus-heresy-3rd-edition#3211 ·
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
Unreachable-proxy mount test depends on fixed port 9999可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug tests
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复