mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #22677] issue: Embedding API endpoints ignore model.params settings #74389
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 @R-omk on GitHub (Mar 14, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22677
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.8.10-slim
Ollama Version (if applicable)
0.17.8
Operating System
Ubuntu 24.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
When model parameters (e.g.,
num_ctxetc.) are configured in the model settings via the admin interface and saved to the database asmodel.params, these parameters should be automatically applied to all requests made to embedding endpoints, similar to how they work for chat completion endpoints.For example, if an Ollama embedding model
qwen3-embedding:4bhasparams.num_ctx: 32000configured in the model settings, requests to/api/embeddingsand/ollama/api/embedshould automatically use this context length without requiring explicitoptionsin each request.Actual Behavior
The model parameters stored in
model.paramsare completely ignored by embedding endpoints. When making requests to:/api/embeddings(OpenAI-compatible endpoint)/ollama/api/embed(Ollama proxy endpoint)Only the parameters explicitly provided in the request body are forwarded to Ollama. The configured model parameters from the database are never merged or applied.
This behavior is inconsistent with chat completion endpoints, where
apply_params_to_form_data()is called inprocess_chat_payload()to merge model parameters with request parameters.Steps to Reproduce
qwen3-embedding:4b)psendpointLogs & Screenshots
[not applicable]
Additional Information
Workaround: Parameters are only applied when explicitly specified in the request:
Root Cause Analysis
The issue stems from missing parameter merging logic in embedding endpoints:
Chat Completions (Works correctly):
backend/open_webui/utils/middleware.py:2011-2059apply_params_to_form_data()is called fromprocess_chat_payload()at line 2149model.paramswithform_data.paramsand转发 to Ollama asoptionsEmbeddings (Broken):
File:
backend/open_webui/routers/ollama.py:1068Endpoint:
/ollama/api/embedLine 1068:
data=form_data.model_dump_json(exclude_none=True).encode()Issue: Only sends request parameters, completely ignoring
model.paramsFile:
backend/open_webui/utils/embeddings.py:24-88Function:
generate_embeddings()Endpoint:
/api/embeddingsIssue: No call to
apply_params_to_form_data()or similar logicCode Locations
backend/open_webui/models/models.py-paramsfield in Model tablebackend/open_webui/utils/middleware.py:2011-apply_params_to_form_data()backend/open_webui/routers/ollama.py:1016-1089-/ollama/api/embedbackend/open_webui/main.py:1656-1680-/api/embeddingsbackend/open_webui/utils/middleware.py:2143-2267-process_chat_payload()Code Reference - Current Broken Implementation
Suggested Fix
Add parameter merging similar to chat completions:
Additional Findings
Third broken endpoint:
/ollama/api/embeddings(ollama.py:1099-1175) - line 1153 also ignores model.params when proxying to Ollama's/api/embeddings.Available utility functions:
backend/open_webui/utils/payload.pycontains:apply_model_params_to_body()(line 46)apply_model_params_to_body_openai()(line 90)apply_model_params_to_body_ollama()(line 124)@tjbck commented on GitHub (Mar 15, 2026):
Embedding models aren't supported.