From a9c497612ba7f396d5969c16b223b47e691accc7 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 13 Sep 2024 00:56:50 -0400 Subject: [PATCH] refac: rm assert --- backend/open_webui/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 49a559d58..15f41be69 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -589,10 +589,11 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware): if prompt is None: raise Exception("No user message found") if rag_app.state.config.RELEVANCE_THRESHOLD == 0: - assert context_string.strip(), ( - "With a 0 relevancy threshold for RAG, the context cannot " - "be empty" - ) + if context_string.strip() == "": + log.debug( + f"With a 0 relevancy threshold for RAG, the context cannot be empty" + ) + # Workaround for Ollama 2.0+ system prompt issue # TODO: replace with add_or_update_system_message if model["owned_by"] == "ollama":