Skip to content

Python: Preserve image-only messages in Azure AI Search retrieval - #9075

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ktz03:fix/azure-search-image-only-messages
Oct 12, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ktz03:fix/azure-search-image-only-messages

Conversation

@ktz03

Copy link
Copy Markdown
Contributor

Motivation & Context

AzureAISearchContextProvider.before_run() filters every message by text content before choosing a retrieval mode. That drops image-only messages before the existing knowledge-base image converter can handle them. With a one-message history limit, a previous text message is sent instead of the latest image.

Description & Review Guide

  • What are the major changes? Retain supported image URI/data content for agentic low and medium reasoning before applying the history limit. Image eligibility matches the existing converter. Add regressions through before_run for retrieval requests, user/assistant roles, image forms, history selection, and unsupported content.
  • What is the impact of these changes? Image-only messages reach the existing messages-based retrieval path. Semantic search and agentic minimal mode remain text-based; system messages, non-image attachments, and empty inputs remain excluded. The 28 new cases reproduce 14 failures with 14 passing controls before the fix and all pass afterward. On Windows/Python 3.14.3, the package's non-integration suite passes 417 tests with stable SDK 12.0.0 and skips 12 for unavailable SDK capabilities; preview SDK 12.1.0b2 passes all 429 tests with 96% coverage. Both runs deselect one integration test and retain one existing experimental-filter warning. Ruff, source Pyright, all five test type checkers, applicable pre-commit hooks, and wheel/sdist builds pass. A separate 13-case check uses real preview SDK request serialization with discovery/transport substitutes; it does not exercise Azure service retrieval, image downloads, authentication deployment, or models.
  • What do you want reviewers to focus on? Matching the current image-conversion contract, applying the history limit after content eligibility, and preserving text-based retrieval and unsupported-content controls.

Related Issue

Fixes #9074

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and the title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:00
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Oct 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused fix matches the existing image-conversion contract and has targeted regression coverage with no unresolved findings.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes #9074 by preserving supported image-only messages for Azure AI Search agentic retrieval.

Changes:

  • Includes images in low and medium reasoning modes before applying history limits.
  • Adds 28 regression cases while preserving text-only modes and unsupported-content filtering.
File Description
python/​packages/​azure-ai-search/​tests/​test_aisearch_context_provider.py Tests image retrieval, history selection, and excluded inputs.
python/​packages/​azure-ai-search/​agent_framework_azure_ai_search/​_context_provider.py Retains eligible image messages for messages-based retrieval.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Merged via the queue into microsoft:main with commit 24b7550 Oct 12, 2026
52 of 53 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — c5c684dc Deployed Oct 9, 2026 by ktz03 via team_check #6417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Python: Azure AI Search drops image-only messages before agentic retrieval

3 participants