Skip to content

ollama fails when tools use optional args #264

@OomPiet

Description

@OomPiet

When trying to use Ollama with model llama3.1 I get a error as follows

controller sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler
controller     /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.20.3/pkg/internal/controller/controller.go:341
controller sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem
controller     /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.20.3/pkg/internal/controller/controller.go:288
controller sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2
controller     /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.20.3/pkg/internal/controller/controller.go:249
app   File "/app/python/.venv/lib/python3.12/site-packages/autogen_agentchat/agents/_assistant_agent.py", line 904, in _call_llm
app     async for chunk in model_client.create_stream(
app 
app   File "/app/python/.venv/lib/python3.12/site-packages/autogen_ext/models/ollama/_ollama_client.py", line 707, in create_stream
app     create_params = self._process_create_args(
app                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
app 
app   File "/app/python/.venv/lib/python3.12/site-packages/autogen_ext/models/ollama/_ollama_client.py", line 578, in _process_create_args
app     converted_tools = convert_tools(tools)
app                       ^^^^^^^^^^^^^^^^^^^^
app 
app   File "/app/python/.venv/lib/python3.12/site-packages/autogen_ext/models/ollama/_ollama_client.py", line 319, in convert_tools
app     type=prop_schema["type"],
app          ~~~~~~~~~~~^^^^^^^^
app 
app KeyError: 'type'
app 
app 
app 2025-04-22 08:49:35.891 | INFO     | autogenstudio.web.routes.ws:run_websocket:127 - WebSocket disconnected for run 13

This seems to be related to: https://github.com/microsoft/autogen/pull/6343/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions