Python: raw-data content mappings lose annotations and attachment metadata
维护者通常 1 天内回复
评估
调研方向
从 Content.from_dict 中的 raw-data 分支开始,将其委托给 Content.from_data 的过程进行比较,然后跟踪 Message 如何从 mappings 构建 contents。为直接解析和 Message 输入添加回归覆盖,验证 annotations、additional_properties 和 raw_representation 得以保留,同时二进制有效载荷仍能正确编码。
由索引模型根据 Issue 内容生成。
描述
Description
Passing a raw-data content mapping to Content.from_dict or Message silently drops annotations, additional_properties, and raw_representation. The equivalent Content.from_data call preserves all three.
This loses useful file metadata such as additional_properties["filename"], which file adapters and Content Understanding use to identify attachments.
Code Sample
from agent_framework import Content, Message
raw = object()
data = {
"type": "data",
"data": b"test data",
"media_type": "text/plain",
"annotations": [{"type": "citation", "title": "Source document", "file_id": "file-123"}],
"additional_properties": {"filename": "document.txt"},
"raw_representation": raw,
}
for content in (Content.from_dict(data), Message("user", [data]).contents[0]):
print(content.annotations, content.additional_properties, content.raw_representation is raw)
Expected: the supplied annotations, {"filename": "document.txt"}, and True.
Actual: None {} False for both parsing paths. The binary payload itself is correctly encoded.
Error Messages / Stack Traces
No exception is raised; the metadata is silently discarded.
Package Versions
agent-framework-core 1.19.0, reproduced from main at 98a982a.
Python Version
Python 3.12.13, macOS arm64.
Additional Context
The raw-data branch in Content.from_dict delegates to cls.from_data without forwarding the three metadata fields it has already extracted. I am preparing a small fix with regression coverage for both direct parsing and Message inputs. Passing a Content.from_data(...) instance directly is a workaround.
- 主要语言
- Python
- 星标
- 14.2k
- 派生
- 2.5k
- 平均合并
- 2 天 9 小时
- 30 天内合并 PR
- 392
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/agent-framework 的其他 Issue
-
Python: foundry-hosting drops request `metadata` from the stored response — `_create_response_event_stream` never passes `request` to `ResponseEventStream`可能已有人在做 @its-amann 于 2 天前认领。 未关闭python triage
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/agent-framework#9529 · 1 条评论 ·
维护者通常 1 天内回复
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeout可能已有人在做 @jpalvarezl 于 8 天前认领。 未关闭python
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/agent-framework#9313 · 已指派 1 人 ·
维护者通常 1 天内回复
-
.NET python triage
难度 1/5 1 小时以内 新手友好度 85/100
microsoft/agent-framework#9092 · 1 条评论 ·
维护者通常 1 天内回复
-
Python: Clarify when to use platform可能已有人在做 @eavanvalkenburg 于 21 天前认领。 未关闭python triage
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/agent-framework#8599 · 1 条评论 ·
维护者通常 1 天内回复
-
.NET compaction documentation
难度 1/5 1 小时以内 新手友好度 82/100
microsoft/agent-framework#4629 · 1 条评论 ·
维护者通常 1 天内回复
查看 microsoft/agent-framework 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
zach-blumenfeld/aip#13 ·
-
难度 2/5 1-3 小时 新手友好度 80/100
nathanmarlor/foxess_modbus#1287 ·
维护者通常 4 天内回复
-
bug good first issue help wanted
难度 2/5 1-3 小时 新手友好度 84/100
OpenLakeForge/openlakeforge#498 ·
维护者通常 1 天内回复
-
good first issue hacktoberfest help wanted python
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
pollen-robotics/reachy_mini#1493 ·
维护者通常 1 天内回复