mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 08:34:32 -05:00
[PR #24921] fix: apply RAG_EMBEDDING_QUERY_PREFIX to memory search queries #131590
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/24921
Author: @TipKnuckle
Created: 5/19/2026
Status: 🔄 Open
Base:
dev← Head:fix/memory-query-embedding-prefix📝 Commits (1)
54dd0ecfix: apply RAG_EMBEDDING_QUERY_PREFIX to memory search queries📊 Changes
1 file changed (+2 additions, -1 deletions)
View changed files
📝
backend/open_webui/routers/memories.py(+2 -1)📄 Description
Before submitting, make sure you've checked the following:
RAG_EMBEDDING_QUERY_PREFIXenv var added for instruction-tuned embedding modelsdevDescription
query_memoryinrouters/memories.pyembeds the search query without applyingRAG_EMBEDDING_QUERY_PREFIX. Every RAG retrieval path inretrieval/utils.pycorrectly passes this prefix when calling the embedding function, but the memory search path was missed.Instruction-tuned embedding models (e.g. Qwen3-Embedding) require a task instruction prefix to produce meaningful query embeddings. Without it, memory search returns semantically unrelated results regardless of what the user searches for — the env var has no effect on memory queries.
Changelog Entry
Fixed
RAG_EMBEDDING_QUERY_PREFIX, fixing broken semantic search for instruction-tuned embedding models (e.g. Qwen3-Embedding)Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.