mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
add support for PerfXCloud (#1883)
### What problem does this PR solve? #1853 add support for PerfXCloud ### Type of change - [x] New Feature (non-breaking change which adds functionality) Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
This commit is contained in:
@ -38,7 +38,8 @@ EmbeddingModel = {
|
||||
"NVIDIA": NvidiaEmbed,
|
||||
"LM-Studio": LmStudioEmbed,
|
||||
"OpenAI-API-Compatible": OpenAI_APIEmbed,
|
||||
"cohere": CoHereEmbed
|
||||
"cohere": CoHereEmbed,
|
||||
"PerfXCloud": PerfXCloudEmbed,
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +85,8 @@ ChatModel = {
|
||||
"LM-Studio": LmStudioChat,
|
||||
"OpenAI-API-Compatible": OpenAI_APIChat,
|
||||
"cohere": CoHereChat,
|
||||
"LeptonAI": LeptonAIChat
|
||||
"LeptonAI": LeptonAIChat,
|
||||
"PerfXCloud": PerfXCloudChat
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -987,4 +987,11 @@ class LeptonAIChat(Base):
|
||||
def __init__(self, key, model_name, base_url=None):
|
||||
if not base_url:
|
||||
base_url = os.path.join("https://"+model_name+".lepton.run","api","v1")
|
||||
super().__init__(key, model_name, base_url)
|
||||
super().__init__(key, model_name, base_url)
|
||||
|
||||
|
||||
class PerfXCloudChat(Base):
|
||||
def __init__(self, key, model_name, base_url="https://cloud.perfxlab.cn/v1"):
|
||||
if not base_url:
|
||||
base_url = "https://cloud.perfxlab.cn/v1"
|
||||
super().__init__(key, model_name, base_url)
|
||||
|
||||
@ -553,3 +553,10 @@ class CoHereEmbed(Base):
|
||||
return np.array([d for d in res.embeddings.float]), int(
|
||||
res.meta.billed_units.input_tokens
|
||||
)
|
||||
|
||||
|
||||
class PerfXCloudEmbed(OpenAIEmbed):
|
||||
def __init__(self, key, model_name, base_url="https://cloud.perfxlab.cn/v1"):
|
||||
if not base_url:
|
||||
base_url = "https://cloud.perfxlab.cn/v1"
|
||||
super().__init__(key, model_name, base_url)
|
||||
|
||||
Reference in New Issue
Block a user