microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.95k stars 3.27k forks source link

Bug: Ollama connector does not send the tools/agents/functions list #9682

Open raffaeler opened 2 days ago

raffaeler commented 2 days ago

Describe the bug I am using Semantic Kernel with Ollama and llama 3.2.

When I use the Ollama connector, the functions are not added to http request. The same code and prompt using Azure OpenAI works correctly.

To Reproduce OllamaFunctionCalling sample.

Expected behavior I expect the functions being called.

Platform

Details I tried the same prompt on GPT and then on Ollama hosted locally. When I use Ollama I specify the following settings:

KernelFunction[] functions = kernel.Plugins
                .SelectMany(p => p).ToArray();
FunctionChoiceBehavior functionOptions = FunctionChoiceBehavior.Required(functions, true); 

OllamaPromptExecutionSettings ollamaPromptExecutionSettings =
    new()
    {
        FunctionChoiceBehavior = functionOptions,
        ModelId = modelName,
        //...
    }

I also tried FunctionChoiceBehavior.Auto() wit no success.

I then passed my own HttpClient with a handler which logs all the http traffic. This is the result:

{"model":"llama3.2","messages":[{"role":"system","content":"","images":null,"tool_calls":null},{"role":"user","content":"What's the weather like in Genoa right now?","images":null,"tool_calls":null}],"options":{"temperature":0.85,"top_p":0.9},"stream":true,"tools":null,"CustomHeaders":{}}
raffaeler commented 2 days ago

BTW what are the capabilities of this connector? It looks like it does not support multimodality. In other words, a new prompt contains the image but the http message does not.

shethaadit commented 22 hours ago

Hi @markwallace-microsoft / @RogerBarreto, I will work on this and try to raise PR soon. :)