Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#8,632 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@moonbox3 đang làm issue này rồi.

Từ ngày 29/9/2026.

  • #8634 của @Yufei-Z — đã đóng, không merge
  • #8668 của @Sehastrajit-S — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với nhánh raw-data trong Content.from_dict và so sánh việc ủy quyền của nó cho Content.from_data, sau đó theo dõi cách Message xây dựng contents từ mappings. Thêm kiểm thử hồi quy cho việc phân tích trực tiếp và các đầu vào của Message, xác minh rằng annotations, additional_properties và raw_representation được giữ nguyên trong khi payload nhị phân vẫn được mã hóa chính xác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
14.2k
Fork
2.5k
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
384

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/agent-framework

Tất cả issue của microsoft/agent-framework

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.