Added Rag Featured
This commit is contained in:
@@ -71,10 +71,16 @@ async def chat_completions(request: Request):
|
||||
temperature = body.get("temperature")
|
||||
max_tokens = body.get("max_tokens")
|
||||
top_p = body.get("top_p")
|
||||
top_k = body.get("top_k")
|
||||
frequency_penalty = body.get("frequency_penalty")
|
||||
presence_penalty = body.get("presence_penalty")
|
||||
repeat_penalty = body.get("repeat_penalty")
|
||||
stop = body.get("stop")
|
||||
|
||||
# Check if RAG should be used
|
||||
use_knowledge = body.get("use_knowledge", False)
|
||||
use_rag = use_knowledge # Map OpenWebUI's use_knowledge to our use_rag parameter
|
||||
|
||||
# Create a unique chat ID
|
||||
chat_id = str(uuid.uuid4())
|
||||
|
||||
@@ -99,11 +105,14 @@ async def chat_completions(request: Request):
|
||||
chat_id=chat_id,
|
||||
message=user_message,
|
||||
user_id=user_id,
|
||||
use_rag=use_rag,
|
||||
temperature=temperature,
|
||||
max_tokens=max_tokens,
|
||||
top_p=top_p,
|
||||
top_k=top_k,
|
||||
frequency_penalty=frequency_penalty,
|
||||
presence_penalty=presence_penalty,
|
||||
repeat_penalty=repeat_penalty,
|
||||
stop_sequences=stop if isinstance(stop, list) else [stop] if stop else None
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user