Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: unexpected LLM parameters (#9661)

Yongteng Lei3947da10ae26
diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py
index 1f14cbf725..27c9a6c999 100644
--- a/rag/llm/chat_model.py
+++ b/rag/llm/chat_model.py
@@ -112,6 +112,32 @@ class Base(ABC):
def _clean_conf(self, gen_conf):
if "max_tokens" in gen_conf:
del gen_conf["max_tokens"]
+
+ allowed_conf = {
+ "temperature",
+ "max_completion_tokens",
+ "top_p",
+ "stream",
+ "stream_options",
+ "stop",
+ "n",
+ "presence_penalty",
+ "frequency_penalty",
+ "functions",
+ "function_call",
+ "logit_bias",
+ "user",
+ "response_format",
+ "seed",
+ "tools",
+ "tool_choice",
+ "logprobs",
+ "top_logprobs",
+ "extra_headers",
+ }
+
+ gen_conf = {k: v for k, v in gen_conf.items() if k in allowed_conf}
+
return gen_conf
def _chat(self, history, gen_conf, **kwargs):