Przeglądaj źródła

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 rok temu
rodzic
commit
c59c1b603d
No account linked to committer's email address

+ 63
- 1
conf/llm_factories.json Wyświetl plik

"model_type": "rerank" "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 Wyświetl plik

"LM-Studio": LmStudioCV, "LM-Studio": LmStudioCV,
"StepFun":StepFunCV, "StepFun":StepFunCV,
"OpenAI-API-Compatible": OpenAI_APICV, "OpenAI-API-Compatible": OpenAI_APICV,
"TogetherAI": TogetherAICV
"TogetherAI": TogetherAICV,
"01.AI": YiCV
} }




"PerfXCloud": PerfXCloudChat, "PerfXCloud": PerfXCloudChat,
"Upstage":UpstageChat, "Upstage":UpstageChat,
"novita.ai": NovitaAIChat, "novita.ai": NovitaAIChat,
"SILICONFLOW": SILICONFLOWChat
"SILICONFLOW": SILICONFLOWChat,
"01.AI": YiChat
} }





+ 7
- 0
rag/llm/chat_model.py Wyświetl plik

def __init__(self, key, model_name, base_url="https://api.siliconflow.cn/v1"): def __init__(self, key, model_name, base_url="https://api.siliconflow.cn/v1"):
if not base_url: if not base_url:
base_url = "https://api.siliconflow.cn/v1" 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) super().__init__(key, model_name, base_url)

+ 13
- 4
rag/llm/cv_model.py Wyświetl plik

} }
] ]



class StepFunCV(GptV4): class StepFunCV(GptV4):
def __init__(self, key, model_name="step-1v-8k", lang="Chinese", base_url="https://api.stepfun.com/v1"): 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" if not base_url: base_url="https://api.stepfun.com/v1"
self.model_name = model_name self.model_name = model_name
self.lang = lang self.lang = lang



class LmStudioCV(GptV4): 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: if not base_url:
raise ValueError("Local llm url cannot be None") raise ValueError("Local llm url cannot be None")
if base_url.split("/")[-1] != "v1": if base_url.split("/")[-1] != "v1":




class OpenAI_APICV(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: if not base_url:
raise ValueError("url cannot be None") raise ValueError("url cannot be None")
if base_url.split("/")[-1] != "v1": if base_url.split("/")[-1] != "v1":




class TogetherAICV(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: if not base_url:
base_url = "https://api.together.xyz/v1" 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 Wyświetl plik

<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 Wyświetl plik

Upstage: 'upstage', Upstage: 'upstage',
'novita.ai': 'novita-ai', 'novita.ai': 'novita-ai',
SILICONFLOW: 'siliconflow', SILICONFLOW: 'siliconflow',
"01.AI": 'yi'
}; };


export const BedrockRegionList = [ export const BedrockRegionList = [

Ładowanie…
Anuluj
Zapisz