Python: fix: keep citation get_url metadata (#6037)

* fix: keep citation get_url metadata

* fix: satisfy citation metadata mypy check
This commit is contained in:
Yufeng He
2026-05-28 04:09:02 +08:00
committed by GitHub
Unverified
parent 1d301af7d2
commit 4c4e1d9b87
2 changed files with 8 additions and 1 deletions
@@ -2880,11 +2880,15 @@ class RawOpenAIChatClient( # type: ignore[misc]
if ann_url:
ann_start = _get_ann_value("start_index")
ann_end = _get_ann_value("end_index")
annotation_properties: dict[str, Any] = {"annotation_index": event.annotation_index}
ann_get_url = _get_ann_value("get_url")
if ann_get_url is not None:
annotation_properties["get_url"] = ann_get_url
annotation_obj = Annotation(
type="citation",
title=_get_ann_value("title") or "",
url=str(ann_url),
additional_properties={"annotation_index": event.annotation_index},
additional_properties=annotation_properties,
raw_representation=annotation,
)
if ann_start is not None and ann_end is not None: