2023-10-01 05:27:21 +03:00
|
|
|
from __future__ import annotations
|
2023-09-18 00:23:54 +03:00
|
|
|
from dataclasses import dataclass
|
2023-10-01 05:27:21 +03:00
|
|
|
from .typing import Union
|
2023-10-06 13:24:41 +03:00
|
|
|
from .Provider import BaseProvider, RetryProvider
|
2023-10-01 05:27:21 +03:00
|
|
|
from .Provider import (
|
2023-11-16 18:56:23 +03:00
|
|
|
Chatgpt4Online,
|
2023-11-18 06:38:31 +03:00
|
|
|
ChatgptDemoAi,
|
2023-11-16 18:56:23 +03:00
|
|
|
ChatAnywhere,
|
2023-11-18 06:38:31 +03:00
|
|
|
ChatgptNext,
|
2023-12-06 11:35:36 +03:00
|
|
|
HuggingChat,
|
2023-12-25 03:38:42 +03:00
|
|
|
ChatgptDemo,
|
2023-10-14 01:31:48 +03:00
|
|
|
GptForLove,
|
2023-10-01 05:27:21 +03:00
|
|
|
ChatgptAi,
|
2023-10-26 22:32:49 +03:00
|
|
|
DeepInfra,
|
2023-11-18 06:38:31 +03:00
|
|
|
OnlineGpt,
|
2023-10-22 02:22:25 +03:00
|
|
|
ChatBase,
|
2023-11-18 06:38:31 +03:00
|
|
|
Liaobots,
|
2023-10-16 16:34:31 +03:00
|
|
|
GeekGpt,
|
2023-10-22 02:22:25 +03:00
|
|
|
FakeGpt,
|
2023-10-02 03:04:22 +03:00
|
|
|
FreeGpt,
|
2023-11-12 20:03:04 +03:00
|
|
|
Berlin,
|
2023-10-26 22:32:49 +03:00
|
|
|
Llama2,
|
2023-10-01 05:27:21 +03:00
|
|
|
Vercel,
|
2023-11-16 18:56:23 +03:00
|
|
|
Phind,
|
2023-11-12 20:03:04 +03:00
|
|
|
Koala,
|
2023-10-01 05:27:21 +03:00
|
|
|
GptGo,
|
2023-12-25 03:38:42 +03:00
|
|
|
Gpt6,
|
2023-10-01 05:27:21 +03:00
|
|
|
Bard,
|
|
|
|
Bing,
|
2023-10-05 06:13:37 +03:00
|
|
|
You,
|
2023-10-10 01:45:44 +03:00
|
|
|
H2o,
|
2023-12-02 01:56:12 +03:00
|
|
|
Pi,
|
2023-09-18 00:37:14 +03:00
|
|
|
)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
2023-09-20 07:12:34 +03:00
|
|
|
@dataclass(unsafe_hash=True)
|
2023-09-18 00:23:54 +03:00
|
|
|
class Model:
|
|
|
|
name: str
|
|
|
|
base_provider: str
|
2023-09-23 16:35:17 +03:00
|
|
|
best_provider: Union[type[BaseProvider], RetryProvider] = None
|
2023-10-19 17:14:48 +03:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def __all__() -> list[str]:
|
|
|
|
return _all_models
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
default = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = "",
|
|
|
|
base_provider = "",
|
|
|
|
best_provider = RetryProvider([
|
2023-11-16 18:56:23 +03:00
|
|
|
Bing,
|
2023-11-13 20:58:52 +03:00
|
|
|
ChatgptAi, GptGo, GeekGpt,
|
2023-11-16 18:56:23 +03:00
|
|
|
You,
|
|
|
|
Chatgpt4Online,
|
2023-12-14 20:50:35 +03:00
|
|
|
ChatAnywhere
|
2023-10-05 06:13:37 +03:00
|
|
|
])
|
|
|
|
)
|
|
|
|
|
2023-11-16 18:56:23 +03:00
|
|
|
# GPT-3.5 too, but all providers supports long requests and responses
|
2023-10-05 06:13:37 +03:00
|
|
|
gpt_35_long = Model(
|
|
|
|
name = 'gpt-3.5-turbo',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = RetryProvider([
|
2023-11-12 20:03:04 +03:00
|
|
|
FreeGpt, You,
|
|
|
|
GeekGpt, FakeGpt,
|
2023-11-16 18:56:23 +03:00
|
|
|
Berlin, Koala,
|
|
|
|
Chatgpt4Online,
|
|
|
|
ChatAnywhere,
|
2023-11-18 06:38:31 +03:00
|
|
|
ChatgptDemoAi,
|
|
|
|
OnlineGpt,
|
|
|
|
ChatgptNext,
|
2023-12-25 03:38:42 +03:00
|
|
|
ChatgptDemo,
|
|
|
|
Gpt6,
|
2023-09-21 21:10:59 +03:00
|
|
|
])
|
|
|
|
)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
# GPT-3.5 / GPT-4
|
|
|
|
gpt_35_turbo = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-3.5-turbo',
|
|
|
|
base_provider = 'openai',
|
2023-10-20 21:28:46 +03:00
|
|
|
best_provider=RetryProvider([
|
2023-11-24 17:20:22 +03:00
|
|
|
GptGo, You,
|
2023-11-16 18:56:23 +03:00
|
|
|
GptForLove, ChatBase,
|
|
|
|
Chatgpt4Online,
|
|
|
|
ChatAnywhere,
|
2023-09-21 21:10:59 +03:00
|
|
|
])
|
2023-09-18 00:23:54 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
gpt_4 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-4',
|
|
|
|
base_provider = 'openai',
|
2023-10-10 16:11:17 +03:00
|
|
|
best_provider = RetryProvider([
|
2023-11-18 06:38:31 +03:00
|
|
|
Bing, Phind, Liaobots
|
2023-10-10 16:11:17 +03:00
|
|
|
])
|
2023-09-23 02:44:09 +03:00
|
|
|
)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
2023-12-21 03:03:28 +03:00
|
|
|
gpt_4_turbo = Model(
|
|
|
|
name = 'gpt-4-turbo',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Bing
|
|
|
|
)
|
|
|
|
|
2023-10-26 22:32:49 +03:00
|
|
|
llama2_7b = Model(
|
|
|
|
name = "meta-llama/Llama-2-7b-chat-hf",
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = RetryProvider([Llama2, DeepInfra]))
|
|
|
|
|
|
|
|
llama2_13b = Model(
|
2023-11-12 12:12:05 +03:00
|
|
|
name = "meta-llama/Llama-2-13b-chat-hf",
|
2023-10-26 22:32:49 +03:00
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = RetryProvider([Llama2, DeepInfra]))
|
|
|
|
|
|
|
|
llama2_70b = Model(
|
|
|
|
name = "meta-llama/Llama-2-70b-chat-hf",
|
|
|
|
base_provider = "huggingface",
|
2023-12-06 11:35:36 +03:00
|
|
|
best_provider = RetryProvider([Llama2, DeepInfra, HuggingChat]))
|
2023-10-26 22:32:49 +03:00
|
|
|
|
2023-12-13 15:15:27 +03:00
|
|
|
# Mistal
|
|
|
|
mixtral_8x7b = Model(
|
|
|
|
name = "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
|
|
base_provider = "huggingface",
|
|
|
|
best_provider = HuggingChat)
|
|
|
|
|
|
|
|
mistral_7b = Model(
|
|
|
|
name = "mistralai/Mistral-7B-Instruct-v0.1",
|
|
|
|
base_provider = "huggingface",
|
|
|
|
best_provider = HuggingChat)
|
|
|
|
|
2023-09-18 00:23:54 +03:00
|
|
|
# Bard
|
|
|
|
palm = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'palm',
|
|
|
|
base_provider = 'google',
|
|
|
|
best_provider = Bard)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
# H2o
|
|
|
|
falcon_7b = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = H2o)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
falcon_40b = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-40b-v1',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = H2o)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
llama_13b = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'h2oai/h2ogpt-gm-oasst1-en-2048-open-llama-13b',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = H2o)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
# Vercel
|
|
|
|
claude_instant_v1 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'claude-instant-v1',
|
|
|
|
base_provider = 'anthropic',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
claude_v1 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'claude-v1',
|
|
|
|
base_provider = 'anthropic',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
claude_v2 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'claude-v2',
|
|
|
|
base_provider = 'anthropic',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
command_light_nightly = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'command-light-nightly',
|
|
|
|
base_provider = 'cohere',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
command_nightly = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'command-nightly',
|
|
|
|
base_provider = 'cohere',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
gpt_neox_20b = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'EleutherAI/gpt-neox-20b',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
oasst_sft_1_pythia_12b = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'OpenAssistant/oasst-sft-1-pythia-12b',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
oasst_sft_4_pythia_12b_epoch_35 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
santacoder = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'bigcode/santacoder',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
bloom = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'bigscience/bloom',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
flan_t5_xxl = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'google/flan-t5-xxl',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
code_davinci_002 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'code-davinci-002',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
gpt_35_turbo_16k = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-3.5-turbo-16k',
|
|
|
|
base_provider = 'openai',
|
2023-10-19 21:37:56 +03:00
|
|
|
best_provider = gpt_35_long.best_provider)
|
2023-09-20 06:00:19 +03:00
|
|
|
|
2023-09-18 00:23:54 +03:00
|
|
|
gpt_35_turbo_16k_0613 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-3.5-turbo-16k-0613',
|
2023-10-10 16:11:17 +03:00
|
|
|
base_provider = 'openai',
|
2023-10-19 21:37:56 +03:00
|
|
|
best_provider = gpt_35_long.best_provider
|
2023-10-10 16:11:17 +03:00
|
|
|
)
|
2023-09-22 22:36:44 +03:00
|
|
|
|
|
|
|
gpt_35_turbo_0613 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-3.5-turbo-0613',
|
2023-10-10 01:45:44 +03:00
|
|
|
base_provider = 'openai',
|
2023-10-11 20:56:53 +03:00
|
|
|
best_provider = gpt_35_turbo.best_provider
|
2023-09-25 16:52:19 +03:00
|
|
|
)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
gpt_4_0613 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-4-0613',
|
2023-10-10 16:11:17 +03:00
|
|
|
base_provider = 'openai',
|
2023-10-11 20:56:53 +03:00
|
|
|
best_provider = gpt_4.best_provider
|
2023-10-07 20:10:26 +03:00
|
|
|
)
|
2023-09-29 17:21:18 +03:00
|
|
|
|
|
|
|
gpt_4_32k = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-4-32k',
|
2023-10-10 16:11:17 +03:00
|
|
|
base_provider = 'openai',
|
2023-10-11 20:56:53 +03:00
|
|
|
best_provider = gpt_4.best_provider
|
2023-10-07 20:10:26 +03:00
|
|
|
)
|
2023-09-29 17:21:18 +03:00
|
|
|
|
|
|
|
gpt_4_32k_0613 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'gpt-4-32k-0613',
|
2023-10-10 16:11:17 +03:00
|
|
|
base_provider = 'openai',
|
2023-10-11 20:56:53 +03:00
|
|
|
best_provider = gpt_4.best_provider
|
2023-10-07 20:10:26 +03:00
|
|
|
)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
text_ada_001 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'text-ada-001',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
text_babbage_001 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'text-babbage-001',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
text_curie_001 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'text-curie-001',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
text_davinci_002 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'text-davinci-002',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
text_davinci_003 = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'text-davinci-003',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
llama13b_v2_chat = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'replicate:a16z-infra/llama13b-v2-chat',
|
|
|
|
base_provider = 'replicate',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
llama7b_v2_chat = Model(
|
2023-10-01 05:27:21 +03:00
|
|
|
name = 'replicate:a16z-infra/llama7b-v2-chat',
|
|
|
|
base_provider = 'replicate',
|
|
|
|
best_provider = Vercel)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
2023-10-19 17:14:48 +03:00
|
|
|
llama70b_v2_chat = Model(
|
|
|
|
name = 'replicate/llama70b-v2-chat',
|
|
|
|
base_provider = 'replicate',
|
|
|
|
best_provider = Vercel)
|
|
|
|
|
2023-12-02 01:11:52 +03:00
|
|
|
pi = Model(
|
|
|
|
name = 'pi',
|
|
|
|
base_provider = 'inflection',
|
2023-12-02 01:56:12 +03:00
|
|
|
best_provider=Pi
|
2023-12-02 01:11:52 +03:00
|
|
|
)
|
2023-09-18 00:23:54 +03:00
|
|
|
|
|
|
|
class ModelUtils:
|
|
|
|
convert: dict[str, Model] = {
|
2023-10-01 05:27:21 +03:00
|
|
|
# gpt-3.5
|
|
|
|
'gpt-3.5-turbo' : gpt_35_turbo,
|
2023-10-06 21:53:17 +03:00
|
|
|
'gpt-3.5-turbo-0613' : gpt_35_turbo_0613,
|
2023-10-01 05:27:21 +03:00
|
|
|
'gpt-3.5-turbo-16k' : gpt_35_turbo_16k,
|
|
|
|
'gpt-3.5-turbo-16k-0613' : gpt_35_turbo_16k_0613,
|
|
|
|
|
2023-12-06 13:54:50 +03:00
|
|
|
'gpt-3.5-long': gpt_35_long,
|
|
|
|
|
2023-10-01 05:27:21 +03:00
|
|
|
# gpt-4
|
|
|
|
'gpt-4' : gpt_4,
|
|
|
|
'gpt-4-0613' : gpt_4_0613,
|
|
|
|
'gpt-4-32k' : gpt_4_32k,
|
|
|
|
'gpt-4-32k-0613' : gpt_4_32k_0613,
|
2023-12-21 03:03:28 +03:00
|
|
|
'gpt-4-turbo' : gpt_4_turbo,
|
2023-10-26 22:42:30 +03:00
|
|
|
|
|
|
|
# Llama 2
|
|
|
|
'llama2-7b' : llama2_7b,
|
|
|
|
'llama2-13b': llama2_13b,
|
|
|
|
'llama2-70b': llama2_70b,
|
2023-10-01 05:27:21 +03:00
|
|
|
|
2023-12-13 15:15:27 +03:00
|
|
|
# Mistral
|
|
|
|
'mixtral-8x7b': mixtral_8x7b,
|
|
|
|
'mistral-7b': mistral_7b,
|
|
|
|
|
2023-09-18 00:23:54 +03:00
|
|
|
# Bard
|
2023-10-01 05:27:21 +03:00
|
|
|
'palm2' : palm,
|
|
|
|
'palm' : palm,
|
|
|
|
'google' : palm,
|
|
|
|
'google-bard' : palm,
|
|
|
|
'google-palm' : palm,
|
|
|
|
'bard' : palm,
|
|
|
|
|
2023-09-18 00:23:54 +03:00
|
|
|
# H2o
|
2023-10-01 05:27:21 +03:00
|
|
|
'falcon-40b' : falcon_40b,
|
|
|
|
'falcon-7b' : falcon_7b,
|
|
|
|
'llama-13b' : llama_13b,
|
|
|
|
|
2023-09-18 00:23:54 +03:00
|
|
|
# Vercel
|
2023-10-19 17:14:48 +03:00
|
|
|
#'claude-instant-v1' : claude_instant_v1,
|
|
|
|
#'claude-v1' : claude_v1,
|
|
|
|
#'claude-v2' : claude_v2,
|
2023-10-01 05:27:21 +03:00
|
|
|
'command-nightly' : command_nightly,
|
|
|
|
'gpt-neox-20b' : gpt_neox_20b,
|
|
|
|
'santacoder' : santacoder,
|
|
|
|
'bloom' : bloom,
|
|
|
|
'flan-t5-xxl' : flan_t5_xxl,
|
|
|
|
'code-davinci-002' : code_davinci_002,
|
|
|
|
'text-ada-001' : text_ada_001,
|
|
|
|
'text-babbage-001' : text_babbage_001,
|
|
|
|
'text-curie-001' : text_curie_001,
|
|
|
|
'text-davinci-002' : text_davinci_002,
|
|
|
|
'text-davinci-003' : text_davinci_003,
|
2023-10-19 17:14:48 +03:00
|
|
|
'llama70b-v2-chat' : llama70b_v2_chat,
|
2023-10-01 05:27:21 +03:00
|
|
|
'llama13b-v2-chat' : llama13b_v2_chat,
|
|
|
|
'llama7b-v2-chat' : llama7b_v2_chat,
|
|
|
|
|
|
|
|
'oasst-sft-1-pythia-12b' : oasst_sft_1_pythia_12b,
|
|
|
|
'oasst-sft-4-pythia-12b-epoch-3.5' : oasst_sft_4_pythia_12b_epoch_35,
|
|
|
|
'command-light-nightly' : command_light_nightly,
|
2023-12-02 01:11:52 +03:00
|
|
|
|
|
|
|
'pi': pi
|
2023-10-01 05:27:21 +03:00
|
|
|
}
|
2023-10-19 17:14:48 +03:00
|
|
|
|
2023-12-13 15:15:27 +03:00
|
|
|
_all_models = list(ModelUtils.convert.keys())
|