Skip to content

Commit

Permalink
fix xinference add rerank model bug (infiniflow#2758)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Fix xinference add rerank model bug,
infiniflow#2294 (comment)

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
wangguo1230 authored Oct 9, 2024
1 parent 7d89f86 commit f49b511
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 f49b511

Please sign in to comment.