Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Don't store AzureAIInferenceChatCompletion response inner_content inside of item's text content #10747

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

moonbox3
Copy link
Contributor

@moonbox3 moonbox3 commented Mar 3, 2025

Motivation and Context

The AzureAIInferenceChatCompletion class, during _create_chat_message_content creation, is storing the response which is a non-hashable object. In other connectors, like the AzureChatCompletion we do not store the response in the CMC's TextContent item. The response is available as part of the main ChatMessageContent that is returned, so we don't need to store this twice, especially since as part of agent group chat, we need to be able to get the inner item's hash for message comparison.

Description

Remove the call to store the response as the item's inner_content here:

items.append(
    TextContent(
        text=choice.message.content,
        # inner_content=response, <--- removed
        metadata=metadata,
    )
)

Contribution Checklist

@moonbox3 moonbox3 requested a review from a team as a code owner March 3, 2025 02:22
@moonbox3 moonbox3 changed the title Python: Don't store AzureAIInferenceChatCompletion response inner_content inside of item Python: Don't store AzureAIInferenceChatCompletion response inner_content inside of item's text content Mar 3, 2025
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Mar 3, 2025
@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel/connectors/ai/azure_ai_inference/services
   azure_ai_inference_chat_completion.py110695%120–123, 132, 156, 182
TOTAL19018238087% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3199 5 💤 1 ❌ 0 🔥 1m 32s ⏱️

@moonbox3 moonbox3 added this pull request to the merge queue Mar 3, 2025
Merged via the queue into microsoft:main with commit c140db3 Mar 3, 2025
32 checks passed
@moonbox3 moonbox3 deleted the agent-group-chat-fix branch March 3, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai connector Anything related to AI connectors python Pull requests for the Python Semantic Kernel
Projects
Status: Sprint: Done
3 participants