2023-09-22 19:36:44 +00:00
|
|
|
from __future__ import annotations
|
2023-09-17 21:23:54 +00:00
|
|
|
from dataclasses import dataclass
|
2023-09-22 19:36:44 +00:00
|
|
|
from .typing import Union
|
2023-09-21 18:10:59 +00:00
|
|
|
from .Provider import BaseProvider, RetryProvider
|
2023-09-22 19:36:44 +00:00
|
|
|
from .Provider import (
|
2023-09-17 21:37:14 +00:00
|
|
|
ChatgptLogin,
|
2023-09-22 19:36:44 +00:00
|
|
|
ChatgptAi,
|
|
|
|
ChatBase,
|
|
|
|
Vercel,
|
|
|
|
DeepAi,
|
|
|
|
Aivvm,
|
|
|
|
Bard,
|
2023-09-21 18:10:59 +00:00
|
|
|
H2o,
|
|
|
|
GptGo,
|
|
|
|
Bing,
|
|
|
|
PerplexityAi,
|
|
|
|
Wewordle,
|
|
|
|
Yqcloud,
|
|
|
|
AItianhu,
|
2023-09-25 23:02:02 +00:00
|
|
|
AItianhuSpace,
|
2023-09-21 18:10:59 +00:00
|
|
|
Aichat,
|
2023-09-25 13:52:19 +00:00
|
|
|
Myshell,
|
2023-09-26 08:03:37 +00:00
|
|
|
Aibn,
|
|
|
|
ChatgptDuo,
|
2023-09-17 21:37:14 +00:00
|
|
|
)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
2023-09-20 04:12:34 +00:00
|
|
|
@dataclass(unsafe_hash=True)
|
2023-09-17 21:23:54 +00:00
|
|
|
class Model:
|
|
|
|
name: str
|
|
|
|
base_provider: str
|
2023-09-23 13:35:17 +00:00
|
|
|
best_provider: Union[type[BaseProvider], RetryProvider] = None
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
# Config for HuggingChat, OpenAssistant
|
|
|
|
# Works for Liaobots, H2o, OpenaiChat, Yqcloud, You
|
|
|
|
default = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = "",
|
2023-09-21 18:10:59 +00:00
|
|
|
base_provider = "",
|
|
|
|
best_provider = RetryProvider([
|
|
|
|
Bing, # Not fully GPT 3 or 4
|
|
|
|
PerplexityAi, # Adds references to sources
|
|
|
|
Wewordle, # Responds with markdown
|
|
|
|
Yqcloud, # Answers short questions in chinese
|
|
|
|
ChatBase, # Don't want to answer creatively
|
2023-09-26 08:03:37 +00:00
|
|
|
ChatgptDuo, # Include search results
|
|
|
|
DeepAi, ChatgptLogin, ChatgptAi, Aivvm, GptGo, AItianhu, AItianhuSpace, Aichat, Myshell, Aibn,
|
2023-09-21 18:10:59 +00:00
|
|
|
])
|
|
|
|
)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
# GPT-3.5 / GPT-4
|
|
|
|
gpt_35_turbo = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'gpt-3.5-turbo',
|
|
|
|
base_provider = 'openai',
|
2023-09-21 18:10:59 +00:00
|
|
|
best_provider = RetryProvider([
|
2023-09-26 08:03:37 +00:00
|
|
|
DeepAi, ChatgptLogin, ChatgptAi, Aivvm, GptGo, AItianhu, Aichat, AItianhuSpace, Myshell, Aibn,
|
2023-09-21 18:10:59 +00:00
|
|
|
])
|
2023-09-17 21:23:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
gpt_4 = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'gpt-4',
|
2023-09-22 23:44:09 +00:00
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = RetryProvider([
|
2023-09-29 14:21:18 +00:00
|
|
|
Myshell, AItianhuSpace, Aivvm
|
2023-09-22 23:44:09 +00:00
|
|
|
])
|
|
|
|
)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
# Bard
|
|
|
|
palm = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'palm',
|
|
|
|
base_provider = 'google',
|
|
|
|
best_provider = Bard)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
# H2o
|
|
|
|
falcon_7b = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-7b-v3',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = H2o)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
falcon_40b = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'h2oai/h2ogpt-gm-oasst1-en-2048-falcon-40b-v1',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = H2o)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
llama_13b = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'h2oai/h2ogpt-gm-oasst1-en-2048-open-llama-13b',
|
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = H2o)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
# Vercel
|
|
|
|
claude_instant_v1 = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'claude-instant-v1',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'anthropic',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
claude_v1 = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'claude-v1',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'anthropic',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
claude_v2 = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'claude-v2',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'anthropic',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
command_light_nightly = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'command-light-nightly',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'cohere',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
command_nightly = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'command-nightly',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'cohere',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
gpt_neox_20b = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'EleutherAI/gpt-neox-20b',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
oasst_sft_1_pythia_12b = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'OpenAssistant/oasst-sft-1-pythia-12b',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
oasst_sft_4_pythia_12b_epoch_35 = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
santacoder = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'bigcode/santacoder',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
bloom = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'bigscience/bloom',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
flan_t5_xxl = Model(
|
2023-09-23 00:31:16 +00:00
|
|
|
name = 'google/flan-t5-xxl',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'huggingface',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
code_davinci_002 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'code-davinci-002',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
gpt_35_turbo_16k = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'gpt-3.5-turbo-16k',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
2023-09-29 14:21:18 +00:00
|
|
|
best_provider = Aivvm)
|
2023-09-20 03:00:19 +00:00
|
|
|
|
2023-09-17 21:23:54 +00:00
|
|
|
gpt_35_turbo_16k_0613 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'gpt-3.5-turbo-16k-0613',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai')
|
|
|
|
|
|
|
|
gpt_35_turbo_0613 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'gpt-3.5-turbo-0613',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
2023-09-25 13:52:19 +00:00
|
|
|
best_provider = RetryProvider([
|
|
|
|
Aivvm, ChatgptLogin
|
|
|
|
])
|
|
|
|
)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
gpt_4_0613 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'gpt-4-0613',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
2023-09-29 14:21:18 +00:00
|
|
|
best_provider = Aivvm)
|
|
|
|
|
|
|
|
gpt_4_32k = Model(
|
|
|
|
name = 'gpt-4-32k',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Aivvm)
|
|
|
|
|
|
|
|
gpt_4_32k_0613 = Model(
|
|
|
|
name = 'gpt-4-32k-0613',
|
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Aivvm)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
text_ada_001 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'text-ada-001',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
text_babbage_001 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'text-babbage-001',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
text_curie_001 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'text-curie-001',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
text_davinci_002 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'text-davinci-002',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
text_davinci_003 = Model(
|
2023-09-22 23:44:09 +00:00
|
|
|
name = 'text-davinci-003',
|
2023-09-22 19:36:44 +00:00
|
|
|
base_provider = 'openai',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
llama13b_v2_chat = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'replicate:a16z-infra/llama13b-v2-chat',
|
|
|
|
base_provider = 'replicate',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
llama7b_v2_chat = Model(
|
2023-09-22 19:36:44 +00:00
|
|
|
name = 'replicate:a16z-infra/llama7b-v2-chat',
|
|
|
|
base_provider = 'replicate',
|
|
|
|
best_provider = Vercel)
|
2023-09-17 21:23:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ModelUtils:
|
|
|
|
convert: dict[str, Model] = {
|
2023-09-23 00:31:16 +00:00
|
|
|
# gpt-3.5 / gpt-4
|
|
|
|
'gpt-3.5-turbo' : gpt_35_turbo,
|
|
|
|
'gpt-3.5-turbo-16k' : gpt_35_turbo_16k,
|
|
|
|
'gpt-4' : gpt_4,
|
|
|
|
'gpt-4-0613' : gpt_4_0613,
|
|
|
|
'gpt-3.5-turbo-16k-0613' : gpt_35_turbo_16k_0613,
|
2023-09-22 19:36:44 +00:00
|
|
|
|
2023-09-17 21:23:54 +00:00
|
|
|
# Bard
|
2023-09-22 19:36:44 +00:00
|
|
|
'palm2' : palm,
|
|
|
|
'palm' : palm,
|
|
|
|
'google' : palm,
|
|
|
|
'google-bard' : palm,
|
|
|
|
'google-palm' : palm,
|
|
|
|
'bard' : palm,
|
|
|
|
|
2023-09-17 21:23:54 +00:00
|
|
|
# H2o
|
2023-09-22 19:36:44 +00:00
|
|
|
'falcon-40b' : falcon_40b,
|
|
|
|
'falcon-7b' : falcon_7b,
|
|
|
|
'llama-13b' : llama_13b,
|
|
|
|
|
2023-09-17 21:23:54 +00:00
|
|
|
# Vercel
|
2023-09-22 19:36:44 +00:00
|
|
|
'claude-instant-v1' : claude_instant_v1,
|
|
|
|
'claude-v1' : claude_v1,
|
|
|
|
'claude-v2' : claude_v2,
|
|
|
|
'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,
|
|
|
|
'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,
|
|
|
|
}
|