Repository navigation
Python: fix Ollama connector dropping plugin name from assistant tool calls - #14836
Santosh Todkar (todkarsant) wants to merge 2 commits into
Conversation
_format_assistant_message sent tool_call.function_name ("get_weather")
instead of tool_call.name ("Weather-get_weather"). The tool calls in
chat history then did not match any declared tool, breaking follow-up
requests after automatic function calls to plugin functions.
Fixes microsoft#14748
|
Eduard van Valkenburg (@eavanvalkenburg) Darren Cohen (@dargilco) Could you review this one-line fix? It restores the fully qualified tool name in the Ollama connector's assistant message formatting — context from #14748. |
There was a problem hiding this comment.
🟡 Changes recommended
A regression test is still needed to verify that replaying a qualified function call preserves its full name, since the existing test covers only the fallback path.
1 open issue
What changed in this PR
Fixes #14748 by preserving plugin-qualified tool names when the Ollama connector replays assistant calls, keeping chat history consistent with declared tools.
Changes:
- Prefer
tool_call.nameto retain the plugin prefix. - Fall back to
tool_call.function_namewhennameis unset.
| File | Description |
|---|---|
python/semantic_kernel/connectors/ai/ollama/services/utils.py |
Preserves qualified tool names during assistant-message serialization. |
Review effort: Balanced
| { | ||
| "function": { | ||
| "name": tool_call.function_name, | ||
| "name": tool_call.name or tool_call.function_name, |
There was a problem hiding this comment.
Already included — test_message_converters_assistant_with_qualified_tool_call_name (lines 169–187 in this diff) creates a FunctionCallContent(name="Weather-get_weather", ...) and asserts the serialized name remains "Weather-get_weather".
Covers the case where FunctionCallContent is created with a fully qualified name (e.g. "Weather-get_weather"). The existing test only exercises the fallback path via function_name.

Motivation and Context
_format_assistant_messagesendstool_call.function_name(get_weather) instead oftool_call.name(Weather-get_weather). The tool calls in chat history then do not match any declared tool, breaking follow-up requests after automatic function calls to plugin functions.Description
Use
tool_call.name(the fully qualified name) with a fallback totool_call.function_namewhennameis not set.Closes #14748