Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2880,11 +2880,15 @@ def _get_ann_value(key: str) -> Any:
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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3407,9 +3407,11 @@ def test_streaming_annotation_added_with_url_citation() -> None:
mock_event = MagicMock()
mock_event.type = "response.output_text.annotation.added"
mock_event.annotation_index = 0
get_url = "https://example.search.windows.net/indexes/docs/documents/doc-123?api-version=2024-07-01"
mock_event.annotation = {
"type": "url_citation",
"url": "https://example.sharepoint.com/sites/my-site/doc.pdf",
"get_url": get_url,
"title": "doc.pdf",
"start_index": 100,
"end_index": 112,
Comment thread
eavanvalkenburg marked this conversation as resolved.
Expand All @@ -3427,6 +3429,7 @@ def test_streaming_annotation_added_with_url_citation() -> None:
assert annotation["title"] == "doc.pdf"
assert annotation["url"] == "https://example.sharepoint.com/sites/my-site/doc.pdf"
assert annotation["additional_properties"]["annotation_index"] == 0
assert annotation["additional_properties"]["get_url"] == get_url
assert annotation["raw_representation"] == mock_event.annotation
assert annotation["annotated_regions"] is not None
assert len(annotation["annotated_regions"]) == 1
Expand Down
Loading