Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#8,632 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Inizia dal ramo raw-data in Content.from_dict e confronta la sua delega a Content.from_data, quindi traccia il modo in cui Message costruisce i contenuti dai mappings. Aggiungi una copertura di regressione per il parsing diretto e gli input di Message, verificando che annotations, additional_properties e raw_representation vengano preservati mentre il payload binario rimane correttamente codificato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
13.6k
Fork
2.3k
Merge medio
1g 15h
PR unite (30g)
442

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/agent-framework

Tutte le issue di microsoft/agent-framework

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.