Uh oh!
There was an error while loading. Please reload this page.
Python: Fix Azure AI Search citation URLs - #6453
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses missing per-document Azure AI Search REST URLs (additional_properties.get_url) on doc_N citation annotations in Foundry streaming responses by enriching citations during final stream aggregation using get_urls data emitted by Azure AI Search output events. It also adjusts Foundry Prompt Agent request preparation to rely on agent_reference (server-resolved model) for first-turn non-preview calls, and adds regression coverage (unit + optional local integration).
Changes:
- Enrich streamed
doc_Ncitation annotations post-stream by correlating them withazure_ai_search_call_outputget_urls. - Suppress “unparsed event” logging / visible content emission for Azure AI Search output events.
- Strip client-side
modelfor first-turn non-preview Prompt Agent calls and add regression tests (plus a local integration check).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| python/packages/openai/tests/openai/test_openai_chat_client.py | Adds unit regression tests for post-stream enrichment and for propagation into mapped AgentResponse. |
| python/packages/openai/agent_framework_openai/_chat_client.py | Adds Azure AI Search output parsing + citation enrichment during streamed response finalization; suppresses logging/visibility for these events. |
| python/packages/foundry/tests/foundry/test_foundry_agent.py | Updates Prompt Agent option-stripping assertions and adds an optional live integration test for Azure AI Search streaming citations. |
| python/packages/foundry/agent_framework_foundry/_agent.py | Strips model for first-turn non-preview Prompt Agent calls so the service resolves model from the agent definition. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7884e33 to
d813b8eCompareCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Motivation and Context
Fixes#5995.
Fixes#6330.
Azure AI Search citations in Foundry streaming responses can omit
additional_properties.get_urlbecause the per-document URLs arrive in laterazure_ai_search_call_outputstream events instead of on the citation annotation itself.Foundry IQ / MCP search-index citations can also expose only
mcp://searchindex/<document-id>citation URLs even when the MCP retrieval output includes document metadata such as title and source.Description
doc_NURL citation annotations with Azure AI Searchget_urls[]fromazure_ai_search_call_outputevents during final stream aggregation.get_urlalready present on annotations and avoids changing in-progress streaming chunks before the final response.mcp://searchindex/<document-id>citation annotations with MCP retrieval metadata (mcp_document_id,document_title, andsource) when matching document JSON is present in MCP output.ChatResponseand mapped finalAgentResponseenrichment, MCP search-index metadata, plus a local-only Foundry/Azure AI Search integration check that creates and cleans up a temporary Prompt Agent.Contribution Checklist