Skip to content

Python: Bug: Ollama connector drops the plugin name from assistant tool calls in chat history #14748

Description

@Shizoqua

Describe the bug
OllamaChatCompletion advertises tools to Ollama by their fully qualified name, for example Weather-get_weather. When it formats the chat history for the next request, _format_assistant_message in semantic_kernel/connectors/ai/ollama/services/utils.py sends each assistant tool call back with only function_name (get_weather). The tool calls in the history then do not match any tool in the request. This happens on every follow-up request after an automatic function call to a plugin function.

Other connectors, such as Bedrock and Google, send the fully qualified name.

To Reproduce
No Ollama server is needed:

from semantic_kernel.connectors.ai.ollama import OllamaChatCompletion
from semantic_kernel.contents import ChatHistory, ChatMessageContent, FunctionCallContent, FunctionResultContent
from semantic_kernel.contents.utils.author_role import AuthorRole

service = OllamaChatCompletion(ai_model_id="llama3.2", host="http://localhost:11434")
history = ChatHistory()
history.add_user_message("What is the weather in Paris?")
call = FunctionCallContent(id="call_1", name="Weather-get_weather", arguments={"city": "Paris"})
history.add_message(ChatMessageContent(role=AuthorRole.ASSISTANT, items=[call]))
history.add_message(
    ChatMessageContent(
        role=AuthorRole.TOOL,
        items=[FunctionResultContent.from_function_call_content_and_result(call, "Sunny, 21C")],
    )
)

messages = service._prepare_chat_history_for_request(history)
print(messages[1]["tool_calls"][0]["function"]["name"])

Expected behavior
Prints Weather-get_weather, the same name the tool was declared with.

Actual behavior
Prints get_weather.

Platform

  • Language: Python
  • Source: semantic-kernel 1.47.0, upstream main at df1cb33
  • AI model: any Ollama model with tool calling
  • IDE: n/a
  • OS: Linux, Python 3.14.10

Additional context
The fix is a one-line change to use tool_call.name, falling back to tool_call.function_name when no name is set. I would like to take this one and will open a PR.

Activity

  1. added
    python
    on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythontriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions