mirror of
https://github.com/open-webui/open-webui
synced 2025-01-18 16:51:17 +00:00
logs: crash if rag_template would be wrong
This commit is contained in:
parent
209e246e6f
commit
adf26789b8
@ -192,6 +192,11 @@ 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]'"
|
||||
template = template.replace("[context]", context)
|
||||
template = template.replace("[query]", query)
|
||||
return template
|
||||
|
Loading…
Reference in New Issue
Block a user