Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Python: raw-data content mappings lose annotations and attachment metadata

未关闭 适合新手
#8,632 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@moonbox3 已经在做这个了。

开始于 2026年9月29日。

  • #8634 来自 @Yufei-Z —— 已关闭,未合并
  • #8668 来自 @Sehastrajit-S —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

从 Content.from_dict 中的 raw-data 分支开始,将其委托给 Content.from_data 的过程进行比较,然后跟踪 Message 如何从 mappings 构建 contents。为直接解析和 Message 输入添加回归覆盖,验证 annotations、additional_properties 和 raw_representation 得以保留,同时二进制有效载荷仍能正确编码。

由索引模型根据 Issue 内容生成。

描述

python triage
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

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/agent-framework 的其他 Issue

查看 microsoft/agent-framework 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。