Skip to content

Commit

Permalink
fix xinference add rerank model bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wangguo1230 committed Oct 9, 2024
1 parent 7f44cf5 commit ac67f83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rag/llm/rerank_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#
import re
import threading
from urllib.parse import urljoin

import requests
from huggingface_hub import snapshot_download
import os
Expand Down Expand Up @@ -154,8 +156,8 @@ def similarity(self, query: str, texts: list):

class XInferenceRerank(Base):
def __init__(self, key="xxxxxxx", model_name="", base_url=""):
if base_url.split("/")[-1] != "v1":
base_url = os.path.join(base_url, "v1")
if base_url.find("/v1") == -1:
base_url = urljoin(base_url, "/v1/rerank")
self.model_name = model_name
self.base_url = base_url
self.headers = {
Expand Down

0 comments on commit ac67f83

Please sign in to comment.