mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 23:21:44 -05:00
[PR #22705] [CLOSED] fix: handle ollama embedding errors for bge-m3 and similar models #81697
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22705
Author: @mvanhorn
Created: 3/15/2026
Status: ❌ Closed
Base:
dev← Head:osc/22671-ollama-rag-embedding-v2📝 Commits (1)
b7adc6bfix: handle ollama embedding errors for bge-m3 and similar models📊 Changes
1 file changed (+30 additions, -4 deletions)
View changed files
📝
backend/open_webui/retrieval/utils.py(+30 -4)📄 Description
Summary
Fixes Error 500 when using ollama as the RAG embedding engine with bge-m3 and similar models that may exceed context length.
Changes
Explicit
truncate: trueadded to both sync and async ollama embed request payloads. This tells Ollama to truncate input exceeding the model's context length rather than returning a 500 error.Error response body parsing replaces
raise_for_status(). Now the actual error message from Ollama (e.g., "context length exceeded") is surfaced in the exception instead of an opaque HTTP error.Noneguards added ingenerate_embeddingsfor all three engine paths (ollama, openai, azure_openai). Previously, when an embedding function returnedNoneon failure,embeddings[0]would throw aTypeErrorthat masked the original error.Testing
truncateparameter is documented in the Ollama APIFixes #22671
This contribution was developed with AI assistance (Claude Code).
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.