refac: rm assert

This commit is contained in:
Timothy J. Baek 2024-09-13 00:56:50 -04:00
parent 7df997c992
commit a9c497612b

View File

@ -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":