Skip to content

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

Fix: api-key issue for xinference. (#6490)

Kevin Hu60c3a253ad1e
diff --git a/rag/llm/rerank_model.py b/rag/llm/rerank_model.py
index 0f2078035a..09631e9933 100644
--- a/rag/llm/rerank_model.py
+++ b/rag/llm/rerank_model.py
@@ -208,7 +208,7 @@ class YoudaoRerank(DefaultRerank):
class XInferenceRerank(Base):
- def __init__(self, key="xxxxxxx", model_name="", base_url=""):
+ def __init__(self, key="x", model_name="", base_url=""):
if base_url.find("/v1") == -1:
base_url = urljoin(base_url, "/v1/rerank")
if base_url.find("/rerank") == -1:
@@ -217,9 +217,10 @@ class XInferenceRerank(Base):
self.base_url = base_url
self.headers = {
"Content-Type": "application/json",
- "accept": "application/json",
- "Authorization": f"Bearer {key}"
+ "accept": "application/json"
}
+ if key and key != "x":
+ self.headers["Authorization"] = f"Bearer {key}"
def similarity(self, query: str, texts: list):
if len(texts) == 0: