[GH-ISSUE #9386] Model system prompts not being templated #15481

Closed
opened 2026-04-19 21:39:54 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @ProjectMoon on GitHub (Feb 5, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/9386

Bug Report

Installation Method

Docekr

Environment

  • Open WebUI Version: 0.5.8

  • Ollama (if applicable): 0.5.7

  • Operating System: Gentoo Liunx

  • Browser (if applicable): Firefox 135

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

Templating of variables in system prompts to work.

Actual Behavior:

Templating of variables does not seem to occur when using the regular (non-native) tool calling.

Description

Bug Summary:
If a model has a variable in its system prompt like {{USER_LOCATION}}, this should be replaced by the variable name. But it seems that in 0.5.8, the templating is not happening. I saw this by the OSM tool searching for stores near {{USER_LOCATION}} instead of an address or a GPS coordinate.

Docker Container Logs:

This is a tiny bit of the container log, which includes the output from the OSM tool:

apply_model_system_prompt_to_body: metadata {'task': 'function_calling'}
[OSM] Searching for [groceries] (shop=supermarket, etc) near place: {{USER_LOCATION}}
[OSM] Searching Nominatim for: {{USER_LOCATION}}

Additional Information

The model's system prompt is something like The user's location is: {{USER_LOCATION}}.

Native tool calling could not be tested. This was tested only with default function calling.

Originally created by @ProjectMoon on GitHub (Feb 5, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/9386 # Bug Report ## Installation Method Docekr ## Environment - **Open WebUI Version:** 0.5.8 - **Ollama (if applicable):** 0.5.7 - **Operating System:** Gentoo Liunx - **Browser (if applicable):** Firefox 135 **Confirmation:** - [X] I have read and followed all the instructions provided in the README.md. - [X] I am on the latest version of both Open WebUI and Ollama. - [X] I have included the browser console logs. - [X] I have included the Docker container logs. - [X] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: Templating of variables in system prompts to work. ## Actual Behavior: Templating of variables does not seem to occur when using the regular (non-native) tool calling. ## Description **Bug Summary:** If a model has a variable in its system prompt like `{{USER_LOCATION}}`, this should be replaced by the variable name. But it seems that in 0.5.8, the templating is not happening. I saw this by the OSM tool searching for stores near `{{USER_LOCATION}}` instead of an address or a GPS coordinate. **Docker Container Logs:** This is a tiny bit of the container log, which includes the output from the OSM tool: ``` apply_model_system_prompt_to_body: metadata {'task': 'function_calling'} [OSM] Searching for [groceries] (shop=supermarket, etc) near place: {{USER_LOCATION}} [OSM] Searching Nominatim for: {{USER_LOCATION}} ``` ## Additional Information The model's system prompt is something like `The user's location is: {{USER_LOCATION}}`. Native tool calling could not be tested. This was tested only with default function calling.
Author
Owner

@thiswillbeyourgithub commented on GitHub (Feb 5, 2025):

This might be due to an error I'm getting since updating from 0.5.7 to 0.5.9 : I get 'UserModel' object has no attribute 'get' and the latest error log I get until that is: apply_model_system_prompt_to_body: metadata id=XXX etc

This indicates to me that both errors are probably around those functions:
ab94468ffa/backend/open_webui/utils/payload.py (L10)

ab94468ffa/backend/open_webui/utils/task.py (L35)

Open-WebUI is unusable in this state so I'll try rolling back to 0.5.7

<!-- gh-comment-id:2636575991 --> @thiswillbeyourgithub commented on GitHub (Feb 5, 2025): This might be due to an error I'm getting since updating from 0.5.7 to 0.5.9 : I get `'UserModel' object has no attribute 'get'` and the latest error log I get until that is: `apply_model_system_prompt_to_body: metadata id=XXX etc` This indicates to me that both errors are probably around those functions: https://github.com/open-webui/open-webui/blob/ab94468ffa765c9ed169cff3a7caa18e85f434db/backend/open_webui/utils/payload.py#L10 https://github.com/open-webui/open-webui/blob/ab94468ffa765c9ed169cff3a7caa18e85f434db/backend/open_webui/utils/task.py#L35 Open-WebUI is unusable in this state so I'll try rolling back to 0.5.7
Author
Owner

@spammenotinoz commented on GitHub (Feb 5, 2025):

Ahh BUG #9402 may be related. Models with system prompts are no longer usable via API.

{
"detail": "'NoneType' object has no attribute 'items'"
}

<!-- gh-comment-id:2636785726 --> @spammenotinoz commented on GitHub (Feb 5, 2025): Ahh BUG #9402 may be related. Models with system prompts are no longer usable via API. { "detail": "'NoneType' object has no attribute 'items'" }
Author
Owner

@oatmealm commented on GitHub (Feb 5, 2025):

Can confirm. It works when I remove the models system prompt. Hope this is a regression and not by design. One of the coolest features of OWUI.

<!-- gh-comment-id:2637228173 --> @oatmealm commented on GitHub (Feb 5, 2025): Can confirm. It works when I remove the models system prompt. Hope this is a regression and not by design. One of the coolest features of OWUI.
Author
Owner

@IgorFZ commented on GitHub (Feb 5, 2025):

When attempting to use a custom model, such as Google's Gemini 1.5 Flash Latest, to perform a RAG (Retrieval Augmented Generation) with a custom prompt, the following error occurred:

'usermodel' object has no attribute 'get'

This error did not occur after removing the prompt from the model.

<!-- gh-comment-id:2637792143 --> @IgorFZ commented on GitHub (Feb 5, 2025): When attempting to use a custom model, such as Google's Gemini 1.5 Flash Latest, to perform a RAG (Retrieval Augmented Generation) with a custom prompt, the following error occurred: ```python 'usermodel' object has no attribute 'get' ``` This error did not occur after removing the prompt from the model.
Author
Owner

@oatmealm commented on GitHub (Feb 5, 2025):

No running into issue with the embedding function. Downgrading since it's a mess at this stage.

<!-- gh-comment-id:2637988881 --> @oatmealm commented on GitHub (Feb 5, 2025): No running into issue with the embedding function. Downgrading since it's a mess at this stage.
Author
Owner

@tjbck commented on GitHub (Feb 5, 2025):

Addressed with ff84c120f5 and 7ba717d171, 0.5.10 will be released shortly

<!-- gh-comment-id:2638045132 --> @tjbck commented on GitHub (Feb 5, 2025): Addressed with ff84c120f5260e7b40cc31b9f60a2afe8ba9e3c8 and 7ba717d171522db6c654c9525078c461a5c50ae7, 0.5.10 will be released shortly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#15481