Skip to content

Python: Add include_reference_source_data to agentic search requests#5100

Open
mvanhorn wants to merge 1 commit intomicrosoft:mainfrom
mvanhorn:fix/source-data-none-5095
Open

Python: Add include_reference_source_data to agentic search requests#5100
mvanhorn wants to merge 1 commit intomicrosoft:mainfrom
mvanhorn:fix/source-data-none-5095

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Apr 5, 2026

Summary

_agentic_search() in AzureAISearchContextProvider constructs KnowledgeBaseRetrievalRequest without passing knowledge_source_params, so include_reference_source_data is never set. This causes ref.source_data to always be None on returned references, even when the knowledge source has source_data_fields configured.

Changes

  • Pass knowledge_source_params=[KnowledgeSourceParams(..., include_reference_source_data=True)] to both KnowledgeBaseRetrievalRequest constructions in _agentic_search() (the minimal reasoning path at line 828 and the non-minimal path at line 836)
  • Add KnowledgeSourceParams to both TYPE_CHECKING and runtime import blocks
  • Add two unit tests verifying the parameter is passed for both reasoning effort paths

Testing

  • Existing 119 tests pass
  • New tests verify knowledge_source_params is present with correct knowledge_source_name and include_reference_source_data=True for both the minimal and non-minimal reasoning paths

Fixes #5095

This contribution was developed with AI assistance (Claude Code).

Pass knowledge_source_params with include_reference_source_data=True to
both KnowledgeBaseRetrievalRequest constructions in _agentic_search().
Without this parameter, ref.source_data is always None even when the
knowledge source has source_data_fields configured.

Fixes microsoft#5095
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: AzureAISearchContextProvider agentic mode: source_data is always None on references — missing include_reference_source_data parameter

2 participants