Skip to content

Python Bug: AzureAIAgent: Filename (title) from Azure AI Foundry url_citation is not mapped to AnnotationContent #12133

Closed
@MarekFabinski

Description

@MarekFabinski

I have an AI Agent configured in Azure AI Foundry, connected to a vector database via Azure AI Search as its knowledge base. Agent is instructed to provide citations.

When agent is invoked directly using AIProjectClient (azure-ai-projects SDK), the response's annotations include a url_citation dictionary containing both a url (document ID) and a title (the source filename).
However, when the same Azure AI Foundry agent is invoked via AzureAIAgent, this filename information (and few others) is lost in the resulting AnnotationContent.

Data Examples:

  1. Raw Annotation Data from Agent (via AIProjectClient):
    A single annotation object within the list of annotations from the direct agent call shows:
{
    "type": "url_citation",
    "text": "【3:2†source】",
    "start_index": 1492,
    "end_index": 1504,
    "url_citation": {
        "url": "doc_2",
        "title": "Moulding-System-ENGLISH.pdf" 
    }
}

(Note the title field containing the filename)

  1. Resulting AnnotationContent in Semantic Kernel (via AzureAIAgent):
    The corresponding AnnotationContent object within ChatMessageContent.items after AzureAIAgent processes the response:
AnnotationContent(
    inner_content=None, 
    ai_model_id=None, # ai_model_id should also be pulled from Azure
    metadata={},  # Metadata is empty
    content_type='annotation', 
    file_id=None, 
    quote='【3:2†source】',
    start_index=1317, # Example index
    end_index=1329,   # Example index
    url='doc_2',
    title=None,       # CRITICAL: title is None
    citation_type=None
)

(Note title=None and metadata={})

Expected Behavior:
The AnnotationContent object in Semantic Kernel should reflect the filename. For the example above, we would expect:

  • AnnotationContent.title to be "Moulding-System-ENGLISH.pdf".
  • OR, the url_citation dictionary {'url': 'doc_2', 'title': 'Moulding-System-ENGLISH.pdf'} to be accessible via AnnotationContent.metadata.

Actual Behavior:
The filename "Moulding-System-ENGLISH.pdf" is not accessible through the AnnotationContent object when using AzureAIAgent. Only the url (e.g., "doc_2") is preserved.

Request:
Could the AzureAIAgent be updated to ensure that the title (filename and other missing parameters) from Azure AI Foundry's url_citation annotations is correctly mapped and made accessible within Semantic Kernel's AnnotationContent object?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpythonPull requests for the Python Semantic Kernel

Type

Projects

Status

Bug

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions