Skip to content

Commit

Permalink
Minimax v2 (#49)
Browse files Browse the repository at this point in the history
* add minimaxv2
---------

Co-authored-by: wangyuxin <[email protected]>
  • Loading branch information
wangyuxinwhy and wangyuxin authored Mar 8, 2024
1 parent bad31e1 commit de517e9
Show file tree
Hide file tree
Showing 20 changed files with 350 additions and 178 deletions.
8 changes: 6 additions & 2 deletions generate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
HunyuanChatParameters,
MinimaxChat,
MinimaxChatParameters,
MinimaxLegacyChat,
MinimaxLegacyChatParameters,
MinimaxProChat,
MinimaxProChatParameters,
MoonshotChat,
Expand Down Expand Up @@ -93,10 +95,12 @@
'AzureChat',
'OpenAIChat',
'OpenAIChatParameters',
'MinimaxProChat',
'MinimaxProChatParameters',
'MinimaxChat',
'MinimaxChatParameters',
'MinimaxProChat',
'MinimaxProChatParameters',
'MinimaxLegacyChat',
'MinimaxLegacyChatParameters',
'ZhipuChat',
'ZhipuChatParameters',
'ZhipuCharacterChat',
Expand Down
11 changes: 8 additions & 3 deletions generate/chat_completion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
HunyuanChatParameters,
MinimaxChat,
MinimaxChatParameters,
MinimaxLegacyChat,
MinimaxLegacyChatParameters,
MinimaxProChat,
MinimaxProChatParameters,
MoonshotChat,
Expand All @@ -55,8 +57,9 @@
(AzureChat, OpenAIChatParameters),
(AnthropicChat, AnthropicChatParameters),
(OpenAIChat, OpenAIChatParameters),
(MinimaxChat, MinimaxChatParameters),
(MinimaxProChat, MinimaxProChatParameters),
(MinimaxChat, MinimaxProChatParameters),
(MinimaxLegacyChat, MinimaxProChatParameters),
(ZhipuChat, ZhipuChatParameters),
(ZhipuCharacterChat, ZhipuCharacterChatParameters),
(WenxinChat, WenxinChatParameters),
Expand All @@ -82,10 +85,12 @@
'ChatCompletionStreamOutput',
'ModelParameters',
'AzureChat',
'MinimaxProChat',
'MinimaxProChatParameters',
'MinimaxChat',
'MinimaxChatParameters',
'MinimaxProChat',
'MinimaxProChatParameters',
'MinimaxLegacyChat',
'MinimaxLegacyChatParameters',
'OpenAIChat',
'OpenAIChatParameters',
'ZhipuChat',
Expand Down
2 changes: 1 addition & 1 deletion generate/chat_completion/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def hook(self, **kwargs: Unpack['HookModelKwargs']) -> 'HookChatCompletionModel'
class RemoteChatCompletionModel(ChatCompletionModel, ABC):
settings: PlatformSettings
http_client: HttpClient
avaliable_models: ClassVar[List[str]] = []
available_models: ClassVar[List[str]] = []

def __init__(
self,
Expand Down
5 changes: 5 additions & 0 deletions generate/chat_completion/cost_caculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
'moonshot-v1-32k': (0.024, 0.024),
'moonshot-v1-128k': (0.06, 0.06),
},
'minimax': {
'abab5.5-chat': (0.015, 0.015),
'abab5.5s-chat': (0.005, 0.005),
'abab6-chat': (0.1, 0.1),
},
}


Expand Down
7 changes: 5 additions & 2 deletions generate/chat_completion/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from generate.chat_completion.models.deepseek import DeepSeekChat, DeepSeekChatParameters
from generate.chat_completion.models.hunyuan import HunyuanChat, HunyuanChatParameters
from generate.chat_completion.models.minimax import MinimaxChat, MinimaxChatParameters
from generate.chat_completion.models.minimax_legacy import MinimaxLegacyChat, MinimaxLegacyChatParameters
from generate.chat_completion.models.minimax_pro import MinimaxProChat, MinimaxProChatParameters
from generate.chat_completion.models.moonshot import MoonshotChat, MoonshotChatParameters
from generate.chat_completion.models.openai import OpenAIChat, OpenAIChatParameters
Expand All @@ -38,10 +39,12 @@
'BailianChatParameters',
'HunyuanChat',
'HunyuanChatParameters',
'MinimaxChat',
'MinimaxChatParameters',
'MinimaxLegacyChat',
'MinimaxLegacyChatParameters',
'MinimaxProChat',
'MinimaxProChatParameters',
'MinimaxChat',
'MinimaxChatParameters',
'OpenAIChat',
'OpenAIChatParameters',
'WenxinChat',
Expand Down
2 changes: 1 addition & 1 deletion generate/chat_completion/models/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AnthropicParametersDict(RemoteModelParametersDict, total=False):

class AnthropicChat(RemoteChatCompletionModel):
model_type: ClassVar[str] = 'anthropic'
avaliable_models: ClassVar[List[str]] = ['claude-2.1', 'claude-2.0', 'claude-instant-1.2']
available_models: ClassVar[List[str]] = ['claude-2.1', 'claude-2.0', 'claude-instant-1.2']

parameters: AnthropicChatParameters
settings: AnthropicSettings
Expand Down
2 changes: 1 addition & 1 deletion generate/chat_completion/models/baichuan.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BaichuanChatParametersDict(RemoteModelParametersDict, total=False):

class BaichuanChat(RemoteChatCompletionModel):
model_type: ClassVar[str] = 'baichuan'
avaliable_models: ClassVar[List[str]] = ['Baichuan2-Turbo', 'Baichuan2-53B', 'Baichuan2-Turbo-192k']
available_models: ClassVar[List[str]] = ['Baichuan2-Turbo', 'Baichuan2-53B', 'Baichuan2-Turbo-192k']

parameters: BaichuanChatParameters
settings: BaichuanSettings
Expand Down
2 changes: 1 addition & 1 deletion generate/chat_completion/models/dashscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DashScopeChatParametersDict(RemoteModelParametersDict, total=False):

class DashScopeChat(RemoteChatCompletionModel):
model_type: ClassVar[str] = 'dashscope'
avaliable_models: ClassVar[List[str]] = ['qwen-turbo', 'qwen-plus', 'qwen-max', 'qwen-max-1201', 'qwen-max-longcontext']
available_models: ClassVar[List[str]] = ['qwen-turbo', 'qwen-plus', 'qwen-max', 'qwen-max-1201', 'qwen-max-longcontext']

parameters: DashScopeChatParameters
settings: DashScopeSettings
Expand Down
2 changes: 1 addition & 1 deletion generate/chat_completion/models/dashscope_multimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DashScopeMultiModalMessage(TypedDict):

class DashScopeMultiModalChat(RemoteChatCompletionModel):
model_type: ClassVar[str] = 'dashscope_multimodal'
avaliable_models: ClassVar[List[str]] = ['qwen-vl-max', 'qwen-vl-plus']
available_models: ClassVar[List[str]] = ['qwen-vl-max', 'qwen-vl-plus']

parameters: DashScopeMultiModalChatParameters
settings: DashScopeSettings
Expand Down
6 changes: 3 additions & 3 deletions generate/chat_completion/models/deepseek.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DeepSeekParametersDict(RemoteModelParametersDict, total=False):

class DeepSeekChat(OpenAILikeChat):
model_type: ClassVar[str] = 'deepseek'
avaliable_models: ClassVar[List[str]] = ['deepseek-chat', 'deepseek-coder']
available_models: ClassVar[List[str]] = ['deepseek-chat', 'deepseek-coder']

parameters: DeepSeekChatParameters
settings: DeepSeekSettings
Expand Down Expand Up @@ -68,5 +68,5 @@ def stream_generate(self, prompt: Prompt, **kwargs: Unpack[DeepSeekParametersDic
async def async_stream_generate(
self, prompt: Prompt, **kwargs: Unpack[DeepSeekParametersDict]
) -> AsyncIterator[ChatCompletionStreamOutput]:
async for i in super().async_stream_generate(prompt, **kwargs):
yield i
async for stream_output in super().async_stream_generate(prompt, **kwargs):
yield stream_output
Loading

0 comments on commit de517e9

Please sign in to comment.