mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[GH-ISSUE #7597] Tool calling fails when using the ollama API from the open-webui endpoint #30339
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ma3oun on GitHub (Dec 4, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7597
Bug Report
Installation Method
Docker (for ollama and open-webui)
Environment
Open WebUI Version: 0.4.7
Ollama (if applicable): 0.4.7
Operating System: Ubuntu 24.04 LTS
Browser (if applicable): N/A
Confirmation:
Expected Behavior:
I am using the ollama python library to make API calls to an ollama server through the openwebui API endpoint:
http://myserver:8080/ollamaI expect llama3.2:3b to use tools given a certain prompt but that does not happen.
Actual Behavior:
No tools are called and llama3.2 returns a generic message. However, llama3.2 does use tools when I use the typical ollama endpoint:
http://myserver:11434/Description
Bug Summary:
Function calling fails when using the openwebui ollama endpoint but works when calling ollama directly.
Reproduction Details
Steps to Reproduce:
Running this code gives:
But when I change
BASE_URLtoBASE_URL='http://myserver:11434/'then I get this:Logs and Screenshots
N/A
Browser Console Logs:
N/A
Docker Container Logs:
Screenshots/Screen Recordings (if applicable):
N/A
Additional Information
N/A
@ishumilin commented on GitHub (Dec 9, 2024):
This sounds like a purely ollama issue. Try starting setting OLLAMA_KEEP_ALIVE=-1 to prevent it from unloading models from memory, i.e. start container with
docker run -d --gpus=all --restart always -v ollama:/root/.ollama -e OLLAMA_KEEP_ALIVE=-1 -p 11434:11434 --name ollama ollama/ollama@ma3oun commented on GitHub (Dec 10, 2024):
I am not sure you understand my issue. The Ollama server works fine. My issue concerns models that can handle tools, such as llama3.2. When I use the ollama api endpoint (e.g. http://myserver:11434/), everything works fine. But when I use the endpoint through open-webui (e.g. http://myserver:8080/ollama), the model does send a response but never calls tools. By tools, I mean a python function such as adding two numbers.
@ishumilin commented on GitHub (Dec 10, 2024):
I am just judging by your log files
ollama | ggml_cuda_host_malloc: failed to allocate 896.00 MiB of pinned memory: no CUDA-capable device is detectedand other rows mention that ollama container is experiencing issues so I assume the problem arises in the ollama container and not in webui itself
@ishumilin commented on GitHub (Dec 15, 2024):
Was digging into this problem a little longer, a temporary solution may be to edit /etc/docker/daemon.json and add "exec-opts": ["native.cgroupdriver=cgroupfs"], then restart docker together with all containers (or better the entire machine).
See this comment for details
@tjbck commented on GitHub (Dec 19, 2024):
I believe this issue has been addressed with https://github.com/open-webui/open-webui/pull/7920, testing wanted here!