Python: fix TypeError in the mixed_chat_images sample (credential not passed to the kernel helper) - #14349
Conversation
…ion in mixed_chat_images The helper in this sample takes (service_id, credential), like the four other mixed_chat samples, but the call site only passes service_id, so the sample dies with TypeError before it reaches the group chat.
There was a problem hiding this comment.
Pull request overview
Fixes a runtime TypeError in the Python mixed_chat_images sample by passing the required credential argument into the local _create_kernel_with_chat_completion(...) helper when constructing the ChatCompletionAgent, allowing the sample to run far enough to demonstrate its intended image/group-chat behavior.
Changes:
- Pass
credential=credentialto_create_kernel_with_chat_completion(...)inmixed_chat_images.pywhen creatingsummary_agent.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): 59faa6498ae1
Model: claude-opus-4.8
Overview
This PR adds the already-in-scope credential argument to the single
_create_kernel_with_chat_completion(...) call site in the
mixed_chat_images.py sample, fixing a reproducible TypeError that crashed the
sample before it produced any output. The helper signature requires the argument
(no default), credential is unconditionally bound at the top of main() and
already reused for the assistant client, and the edit is byte-identical to the
sibling mixed_chat_files.py:73 form. The change introduces no new auth,
lifecycle, or compatibility surface and carries no residual risk warranting a
finding.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Motivation and Context
python/samples/concepts/agents/mixed_chat/mixed_chat_images.pycannot run. Its localhelper is
but the one call site passes only
service_id:so the sample raises
right after the assistant is created — i.e. after the Azure client and the assistant
definition have already been provisioned, and before any of the image content the sample
is meant to demonstrate is produced.
credentialis already in scope:main()buildscredential = AzureCliCredential()onits first line and passes it to
AzureAssistantAgent.create_client(credential=credential)a few lines above. Only the kernel helper call was missed.
The four sibling samples in the same directory all pass it:
mixed_chat_agents_plugins.py:90_create_kernel_with_chat_completion("artdirector", credential)mixed_chat_files.py:73_create_kernel_with_chat_completion(service_id=service_id, credential=credential)mixed_chat_images.py:60_create_kernel_with_chat_completion(service_id=service_id)TypeErrormixed_chat_reset.py:46_create_kernel_with_chat_completion("chat", credential)mixed_chat_streaming.py:50_create_kernel_with_chat_completion("artdirector", credential)Description
One line: pass
credentialat the call site, making it byte-identical to themixed_chat_files.py:73form.Verified by replaying every
_create_kernel_with_chat_completioncall site insamples/concepts/agents/mixed_chat/against a stub built from that file's owndefwith
inspect.Signature.bind— before the change one of five call sites fails, after itall five bind:
The sample still needs live Azure OpenAI resources to run end to end, so it was not
executed against a real deployment; the failure being fixed is a pure call-signature
mismatch that is reproducible without one.
Contribution Checklist
🤖 Generated with Claude Code