소스 검색

refac: allow multiple [context] in prompt

Timothy J. Baek 8 달 전
부모
커밋
8a4b3e6bc9
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 3
      backend/open_webui/apps/rag/utils.py

+ 1 - 3
backend/open_webui/apps/rag/utils.py

@@ -239,10 +239,8 @@ def query_collection_with_hybrid_search(
 
 def rag_template(template: str, context: str, query: str):
     count = template.count("[context]")
-    assert (
-        count == 1
-    ), f"RAG template contains an unexpected number of '[context]' : {count}"
     assert "[context]" in template, "RAG template does not contain '[context]'"
+
     if "<context>" in context and "</context>" in context:
         log.debug(
             "WARNING: Potential prompt injection attack: the RAG "