瀏覽代碼

add support for 01.AI (#1951)

### What problem does this PR solve?

#1853  add support for 01.AI

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: Zhedong Cen <cenzhedong2@126.com>
tags/v0.10.0
黄腾 1 年之前
父節點
當前提交
c59c1b603d
沒有連結到貢獻者的電子郵件帳戶。

+ 63
- 1
conf/llm_factories.json 查看文件

@@ -3051,6 +3051,68 @@
"model_type": "rerank"
}
]
}
},
{
"name": "01.AI",
"logo": "",
"tags": "LLM,IMAGE2TEXT",
"status": "1",
"llm": [
{
"llm_name": "yi-large",
"tags": "LLM,CHAT,32k",
"max_tokens": 32768,
"model_type": "chat"
},
{
"llm_name": "yi-medium",
"tags": "LLM,CHAT,16k",
"max_tokens": 16384,
"model_type": "chat"
},
{
"llm_name": "yi-medium-200k",
"tags": "LLM,CHAT,200k",
"max_tokens": 204800,
"model_type": "chat"
},
{
"llm_name": "yi-spark",
"tags": "LLM,CHAT,16k",
"max_tokens": 16384,
"model_type": "chat"
},
{
"llm_name": "yi-large-rag",
"tags": "LLM,CHAT,16k",
"max_tokens": 16384,
"model_type": "chat"
},
{
"llm_name": "yi-large-fc",
"tags": "LLM,CHAT,32k",
"max_tokens": 32768,
"model_type": "chat"
},
{
"llm_name": "yi-large-turbo",
"tags": "LLM,CHAT,16k",
"max_tokens": 16384,
"model_type": "chat"
},
{
"llm_name": "yi-large-preview",
"tags": "LLM,CHAT,16k",
"max_tokens": 16384,
"model_type": "chat"
},
{
"llm_name": "yi-vision",
"tags": "LLM,CHAT,IMAGE2TEXT,16k",
"max_tokens": 16384,
"model_type": "image2text"
}
]
}
]
}

+ 4
- 2
rag/llm/__init__.py 查看文件

@@ -61,7 +61,8 @@ CvModel = {
"LM-Studio": LmStudioCV,
"StepFun":StepFunCV,
"OpenAI-API-Compatible": OpenAI_APICV,
"TogetherAI": TogetherAICV
"TogetherAI": TogetherAICV,
"01.AI": YiCV
}


@@ -94,7 +95,8 @@ ChatModel = {
"PerfXCloud": PerfXCloudChat,
"Upstage":UpstageChat,
"novita.ai": NovitaAIChat,
"SILICONFLOW": SILICONFLOWChat
"SILICONFLOW": SILICONFLOWChat,
"01.AI": YiChat
}



+ 7
- 0
rag/llm/chat_model.py 查看文件

@@ -1022,4 +1022,11 @@ class SILICONFLOWChat(Base):
def __init__(self, key, model_name, base_url="https://api.siliconflow.cn/v1"):
if not base_url:
base_url = "https://api.siliconflow.cn/v1"
super().__init__(key, model_name, base_url)


class YiChat(Base):
def __init__(self, key, model_name, base_url="https://api.lingyiwanwu.com/v1"):
if not base_url:
base_url = "https://api.lingyiwanwu.com/v1"
super().__init__(key, model_name, base_url)

+ 13
- 4
rag/llm/cv_model.py 查看文件

@@ -622,6 +622,7 @@ class NvidiaCV(Base):
}
]


class StepFunCV(GptV4):
def __init__(self, key, model_name="step-1v-8k", lang="Chinese", base_url="https://api.stepfun.com/v1"):
if not base_url: base_url="https://api.stepfun.com/v1"
@@ -629,8 +630,9 @@ class StepFunCV(GptV4):
self.model_name = model_name
self.lang = lang


class LmStudioCV(GptV4):
def __init__(self, key, model_name, base_url, lang="Chinese"):
def __init__(self, key, model_name, lang="Chinese", base_url=""):
if not base_url:
raise ValueError("Local llm url cannot be None")
if base_url.split("/")[-1] != "v1":
@@ -641,7 +643,7 @@ class LmStudioCV(GptV4):


class OpenAI_APICV(GptV4):
def __init__(self, key, model_name, base_url, lang="Chinese"):
def __init__(self, key, model_name, lang="Chinese", base_url=""):
if not base_url:
raise ValueError("url cannot be None")
if base_url.split("/")[-1] != "v1":
@@ -652,7 +654,14 @@ class OpenAI_APICV(GptV4):


class TogetherAICV(GptV4):
def __init__(self, key, model_name, base_url="https://api.together.xyz/v1"):
def __init__(self, key, model_name, lang="Chinese", base_url="https://api.together.xyz/v1"):
if not base_url:
base_url = "https://api.together.xyz/v1"
super().__init__(key, model_name, base_url)
super().__init__(key, model_name,lang,base_url)


class YiCV(GptV4):
def __init__(self, key, model_name, lang="Chinese",base_url="https://api.lingyiwanwu.com/v1",):
if not base_url:
base_url = "https://api.lingyiwanwu.com/v1"
super().__init__(key, model_name,lang,base_url)

+ 7
- 0
web/src/assets/svg/llm/yi.svg 查看文件

@@ -0,0 +1,7 @@
<svg width="600" height="600" viewBox="0 0 600 600" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="300" cy="300" r="300" fill="white"/>
<rect x="409.733" y="340.032" width="42.3862" height="151.648" rx="21.1931" fill="#003425"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M422.005 133.354C413.089 125.771 399.714 126.851 392.131 135.768L273.699 275.021C270.643 278.614 268.994 282.932 268.698 287.302C268.532 288.371 268.446 289.466 268.446 290.581V468.603C268.446 480.308 277.934 489.796 289.639 489.796C301.344 489.796 310.832 480.308 310.832 468.603V296.784L424.419 163.228C432.002 154.312 430.921 140.937 422.005 133.354Z" fill="#003425"/>
<rect x="113.972" y="134.25" width="42.3862" height="174.745" rx="21.1931" transform="rotate(-39.3441 113.972 134.25)" fill="#003425"/>
<circle cx="460.126" cy="279.278" r="25.9027" fill="#00DD20"/>
</svg>

+ 1
- 0
web/src/pages/user-setting/setting-model/constant.ts 查看文件

@@ -30,6 +30,7 @@ export const IconMap = {
Upstage: 'upstage',
'novita.ai': 'novita-ai',
SILICONFLOW: 'siliconflow',
"01.AI": 'yi'
};

export const BedrockRegionList = [

Loading…
取消
儲存