黄腾 aopstudio commited on
Commit
4b495f5
·
1 Parent(s): 629a826

add support for 01.AI (#1951)

Browse files

### 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 <[email protected]>

conf/llm_factories.json CHANGED
@@ -3051,6 +3051,68 @@
3051
  "model_type": "rerank"
3052
  }
3053
  ]
3054
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3055
  ]
3056
  }
 
3051
  "model_type": "rerank"
3052
  }
3053
  ]
3054
+ },
3055
+ {
3056
+ "name": "01.AI",
3057
+ "logo": "",
3058
+ "tags": "LLM,IMAGE2TEXT",
3059
+ "status": "1",
3060
+ "llm": [
3061
+ {
3062
+ "llm_name": "yi-large",
3063
+ "tags": "LLM,CHAT,32k",
3064
+ "max_tokens": 32768,
3065
+ "model_type": "chat"
3066
+ },
3067
+ {
3068
+ "llm_name": "yi-medium",
3069
+ "tags": "LLM,CHAT,16k",
3070
+ "max_tokens": 16384,
3071
+ "model_type": "chat"
3072
+ },
3073
+ {
3074
+ "llm_name": "yi-medium-200k",
3075
+ "tags": "LLM,CHAT,200k",
3076
+ "max_tokens": 204800,
3077
+ "model_type": "chat"
3078
+ },
3079
+ {
3080
+ "llm_name": "yi-spark",
3081
+ "tags": "LLM,CHAT,16k",
3082
+ "max_tokens": 16384,
3083
+ "model_type": "chat"
3084
+ },
3085
+ {
3086
+ "llm_name": "yi-large-rag",
3087
+ "tags": "LLM,CHAT,16k",
3088
+ "max_tokens": 16384,
3089
+ "model_type": "chat"
3090
+ },
3091
+ {
3092
+ "llm_name": "yi-large-fc",
3093
+ "tags": "LLM,CHAT,32k",
3094
+ "max_tokens": 32768,
3095
+ "model_type": "chat"
3096
+ },
3097
+ {
3098
+ "llm_name": "yi-large-turbo",
3099
+ "tags": "LLM,CHAT,16k",
3100
+ "max_tokens": 16384,
3101
+ "model_type": "chat"
3102
+ },
3103
+ {
3104
+ "llm_name": "yi-large-preview",
3105
+ "tags": "LLM,CHAT,16k",
3106
+ "max_tokens": 16384,
3107
+ "model_type": "chat"
3108
+ },
3109
+ {
3110
+ "llm_name": "yi-vision",
3111
+ "tags": "LLM,CHAT,IMAGE2TEXT,16k",
3112
+ "max_tokens": 16384,
3113
+ "model_type": "image2text"
3114
+ }
3115
+ ]
3116
+ }
3117
  ]
3118
  }
rag/llm/__init__.py CHANGED
@@ -61,7 +61,8 @@ CvModel = {
61
  "LM-Studio": LmStudioCV,
62
  "StepFun":StepFunCV,
63
  "OpenAI-API-Compatible": OpenAI_APICV,
64
- "TogetherAI": TogetherAICV
 
65
  }
66
 
67
 
@@ -94,7 +95,8 @@ ChatModel = {
94
  "PerfXCloud": PerfXCloudChat,
95
  "Upstage":UpstageChat,
96
  "novita.ai": NovitaAIChat,
97
- "SILICONFLOW": SILICONFLOWChat
 
98
  }
99
 
100
 
 
61
  "LM-Studio": LmStudioCV,
62
  "StepFun":StepFunCV,
63
  "OpenAI-API-Compatible": OpenAI_APICV,
64
+ "TogetherAI": TogetherAICV,
65
+ "01.AI": YiCV
66
  }
67
 
68
 
 
95
  "PerfXCloud": PerfXCloudChat,
96
  "Upstage":UpstageChat,
97
  "novita.ai": NovitaAIChat,
98
+ "SILICONFLOW": SILICONFLOWChat,
99
+ "01.AI": YiChat
100
  }
101
 
102
 
rag/llm/chat_model.py CHANGED
@@ -1022,4 +1022,11 @@ class SILICONFLOWChat(Base):
1022
  def __init__(self, key, model_name, base_url="https://api.siliconflow.cn/v1"):
1023
  if not base_url:
1024
  base_url = "https://api.siliconflow.cn/v1"
 
 
 
 
 
 
 
1025
  super().__init__(key, model_name, base_url)
 
1022
  def __init__(self, key, model_name, base_url="https://api.siliconflow.cn/v1"):
1023
  if not base_url:
1024
  base_url = "https://api.siliconflow.cn/v1"
1025
+ super().__init__(key, model_name, base_url)
1026
+
1027
+
1028
+ class YiChat(Base):
1029
+ def __init__(self, key, model_name, base_url="https://api.lingyiwanwu.com/v1"):
1030
+ if not base_url:
1031
+ base_url = "https://api.lingyiwanwu.com/v1"
1032
  super().__init__(key, model_name, base_url)
rag/llm/cv_model.py CHANGED
@@ -622,6 +622,7 @@ class NvidiaCV(Base):
622
  }
623
  ]
624
 
 
625
  class StepFunCV(GptV4):
626
  def __init__(self, key, model_name="step-1v-8k", lang="Chinese", base_url="https://api.stepfun.com/v1"):
627
  if not base_url: base_url="https://api.stepfun.com/v1"
@@ -629,8 +630,9 @@ class StepFunCV(GptV4):
629
  self.model_name = model_name
630
  self.lang = lang
631
 
 
632
  class LmStudioCV(GptV4):
633
- def __init__(self, key, model_name, base_url, lang="Chinese"):
634
  if not base_url:
635
  raise ValueError("Local llm url cannot be None")
636
  if base_url.split("/")[-1] != "v1":
@@ -641,7 +643,7 @@ class LmStudioCV(GptV4):
641
 
642
 
643
  class OpenAI_APICV(GptV4):
644
- def __init__(self, key, model_name, base_url, lang="Chinese"):
645
  if not base_url:
646
  raise ValueError("url cannot be None")
647
  if base_url.split("/")[-1] != "v1":
@@ -652,7 +654,14 @@ class OpenAI_APICV(GptV4):
652
 
653
 
654
  class TogetherAICV(GptV4):
655
- def __init__(self, key, model_name, base_url="https://api.together.xyz/v1"):
656
  if not base_url:
657
  base_url = "https://api.together.xyz/v1"
658
- super().__init__(key, model_name, base_url)
 
 
 
 
 
 
 
 
622
  }
623
  ]
624
 
625
+
626
  class StepFunCV(GptV4):
627
  def __init__(self, key, model_name="step-1v-8k", lang="Chinese", base_url="https://api.stepfun.com/v1"):
628
  if not base_url: base_url="https://api.stepfun.com/v1"
 
630
  self.model_name = model_name
631
  self.lang = lang
632
 
633
+
634
  class LmStudioCV(GptV4):
635
+ def __init__(self, key, model_name, lang="Chinese", base_url=""):
636
  if not base_url:
637
  raise ValueError("Local llm url cannot be None")
638
  if base_url.split("/")[-1] != "v1":
 
643
 
644
 
645
  class OpenAI_APICV(GptV4):
646
+ def __init__(self, key, model_name, lang="Chinese", base_url=""):
647
  if not base_url:
648
  raise ValueError("url cannot be None")
649
  if base_url.split("/")[-1] != "v1":
 
654
 
655
 
656
  class TogetherAICV(GptV4):
657
+ def __init__(self, key, model_name, lang="Chinese", base_url="https://api.together.xyz/v1"):
658
  if not base_url:
659
  base_url = "https://api.together.xyz/v1"
660
+ super().__init__(key, model_name,lang,base_url)
661
+
662
+
663
+ class YiCV(GptV4):
664
+ def __init__(self, key, model_name, lang="Chinese",base_url="https://api.lingyiwanwu.com/v1",):
665
+ if not base_url:
666
+ base_url = "https://api.lingyiwanwu.com/v1"
667
+ super().__init__(key, model_name,lang,base_url)
web/src/assets/svg/llm/yi.svg ADDED
web/src/pages/user-setting/setting-model/constant.ts CHANGED
@@ -30,6 +30,7 @@ export const IconMap = {
30
  Upstage: 'upstage',
31
  'novita.ai': 'novita-ai',
32
  SILICONFLOW: 'siliconflow',
 
33
  };
34
 
35
  export const BedrockRegionList = [
 
30
  Upstage: 'upstage',
31
  'novita.ai': 'novita-ai',
32
  SILICONFLOW: 'siliconflow',
33
+ "01.AI": 'yi'
34
  };
35
 
36
  export const BedrockRegionList = [