Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI and model change #2672

Merged
merged 15 commits into from
Nov 12, 2023
5 changes: 3 additions & 2 deletions fastchat/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
SERVER_ERROR_MSG = (
"**NETWORK ERROR DUE TO HIGH TRAFFIC. PLEASE REGENERATE OR REFRESH THIS PAGE.**"
)
MODERATION_MSG = "YOUR INPUT VIOLATES OUR CONTENT MODERATION GUIDELINES. PLEASE FIX YOUR INPUT AND TRY AGAIN."
MODERATION_MSG = "$MODERATION$ YOUR INPUT VIOLATES OUR CONTENT MODERATION GUIDELINES."
CONVERSATION_LIMIT_MSG = "YOU HAVE REACHED THE CONVERSATION LENGTH LIMIT. PLEASE CLEAR HISTORY AND START A NEW CONVERSATION."
INACTIVE_MSG = "THIS SESSION HAS BEEN INACTIVE FOR TOO LONG. PLEASE REFRESH THIS PAGE."
SLOW_MODEL_MSG = "⚠️ Both models will show the responses all at once. Please stay patient as it may take over 30 seconds."
# Maximum input length
INPUT_CHAR_LEN_LIMIT = int(os.getenv("FASTCHAT_INPUT_CHAR_LEN_LIMIT", 3072))
INPUT_CHAR_LEN_LIMIT = int(os.getenv("FASTCHAT_INPUT_CHAR_LEN_LIMIT", 12000))
# Maximum conversation turns
CONVERSATION_TURN_LIMIT = 50
# Session expiration time
Expand Down
82 changes: 49 additions & 33 deletions fastchat/model/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,26 @@ def get_model_info(name: str) -> ModelInfo:
)


register_model_info(
["gpt-4"], "ChatGPT-4", "https://openai.com/research/gpt-4", "ChatGPT-4 by OpenAI"
)
register_model_info(
["gpt-3.5-turbo"],
"ChatGPT-3.5",
"GPT-3.5",
"https://openai.com/blog/chatgpt",
"ChatGPT-3.5 by OpenAI",
"GPT-3.5 by OpenAI",
)
register_model_info(
["gpt-3.5-turbo-1106"],
"GPT-3.5-Turbo-1106",
"https://platform.openai.com/docs/models/gpt-3-5",
"GPT-3.5-Turbo-1106 by OpenAI",
)
register_model_info(
["gpt-4"], "GPT-4", "https://openai.com/research/gpt-4", "ChatGPT-4 by OpenAI"
)
register_model_info(
["gpt-4-turbo"],
"GPT-4-Turbo",
"https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo",
"GPT-4-Turbo by OpenAI",
)
register_model_info(
["claude-2"],
Expand All @@ -61,18 +73,6 @@ def get_model_info(name: str) -> ModelInfo:
"https://cloud.google.com/vertex-ai/docs/release-notes#May_10_2023",
"PaLM 2 for Chat (chat-bison@001) by Google",
)
register_model_info(
["llama-2-70b-chat", "llama-2-34b-chat", "llama-2-13b-chat", "llama-2-7b-chat"],
"Llama 2",
"https://ai.meta.com/llama/",
"open foundation and fine-tuned chat models by Meta",
)
register_model_info(
["codellama-34b-instruct", "codellama-13b-instruct", "codellama-7b-instruct"],
"Code Llama",
"https://ai.meta.com/blog/code-llama-large-language-model-coding/",
"open foundation models for code by Meta",
)
register_model_info(
[
"vicuna-33b",
Expand All @@ -86,6 +86,36 @@ def get_model_info(name: str) -> ModelInfo:
"https://lmsys.org/blog/2023-03-30-vicuna/",
"a chat assistant fine-tuned on user-shared conversations by LMSYS",
)
register_model_info(
["llama-2-70b-chat", "llama-2-34b-chat", "llama-2-13b-chat", "llama-2-7b-chat"],
"Llama 2",
"https://ai.meta.com/llama/",
"open foundation and fine-tuned chat models by Meta",
)
register_model_info(
["mistral-7b-instruct"],
"Mistral",
"https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1",
"a large language model by Mistral AI team",
)
register_model_info(
["zephyr-7b-beta", "zephyr-7b-alpha"],
"Zephyr",
"https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha",
"a chatbot fine-tuned from Mistral by Hugging Face",
)
register_model_info(
["qwen-14b-chat"],
"Qwen",
"https://huggingface.co/Qwen/Qwen-14B-Chat",
"a large language model by Alibaba Cloud",
)
register_model_info(
["codellama-34b-instruct", "codellama-13b-instruct", "codellama-7b-instruct"],
"Code Llama",
"https://ai.meta.com/blog/code-llama-large-language-model-coding/",
"open foundation models for code by Meta",
)
register_model_info(
["wizardlm-70b", "wizardlm-30b", "wizardlm-13b"],
"WizardLM",
Expand Down Expand Up @@ -153,7 +183,7 @@ def get_model_info(name: str) -> ModelInfo:
"an Open Assistant for everyone by LAION",
)
register_model_info(
["openchat_3.5"],
["openchat-3.5"],
"OpenChat 3.5",
"https://github.com/imoneoi/openchat",
"OpenChat 3.5 is a versatile, open-source language model fine-tuned using C-RLFT",
Expand Down Expand Up @@ -313,25 +343,11 @@ def get_model_info(name: str) -> ModelInfo:
"Vigogne-Chat is a French large language model (LLM) optimized for instruction-following and multi-turn dialogues, developed by Bofeng Huang",
)
register_model_info(
["mistral-7b-instruct"],
"Mistral",
"https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1",
"a large language model by Mistral AI team",
)
register_model_info(
["deluxe-chat-v1"],
["deluxe-chat-v1", "deluxe-chat-v1.1"],
"DeluxeChat",
"",
"Deluxe Chat",
)

register_model_info(
["zephyr-7b-alpha"],
"Zephyr",
"https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha",
"a chatbot fine-tuned from Mistral by Hugging Face",
)

register_model_info(
[
"Xwin-LM-7B-V0.1",
Expand Down
2 changes: 2 additions & 0 deletions fastchat/serve/api_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def openai_api_stream_iter(

openai.api_base = api_base or "https://api.openai.com/v1"
openai.api_key = api_key or os.environ["OPENAI_API_KEY"]
if model_name == "gpt-4-turbo":
model_name = "gpt-4-1106-preview"

# Make requests
gen_params = {
Expand Down
Loading