You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: Bug: AnnotationContent and StreamingAnnotationContent to_element writes CitationType.X, so annotations in a rendered chat history fail to parse #14590
CitationType is a str, Enum. When the element is serialized, the attribute is written with the enum's str() form, CitationType.FILE_CITATION, not the value file_citation. from_element() then cannot read it back. Any chat message that has an annotation with a citation type breaks as soon as the history is rendered to a prompt string and parsed back (ChatHistory.from_rendered_prompt, which is what prompt templates use for {{$chat_history}} style messages).
The existing round trip tests pass because they never serialize the element to a string, so the enum object stays in memory.
The attribute should be written as the enum value (type="file_citation") so that from_element can parse it. The fix is to use self.citation_type.value in both to_element methods.
Activity
Python: Write the CitationType value in annotation content elements