diff --git a/config.py b/config.py index 9ae1f12..5c44b53 100644 --- a/config.py +++ b/config.py @@ -92,10 +92,12 @@ AVAIL_LLM_MODELS = ["gpt-4-1106-preview", "gpt-4-turbo-preview", "gpt-4-vision-p "gpt-4", "gpt-4-32k", "azure-gpt-4", "glm-4", "glm-3-turbo", "gemini-pro", "chatglm3", "claude-2"] # P.S. 其他可用的模型还包括 [ -# "moss", "qwen-turbo", "qwen-plus", "qwen-max" -# "zhipuai", "qianfan", "deepseekcoder", "llama2", "qwen-local", "gpt-3.5-turbo-0613", -# "gpt-3.5-turbo-16k-0613", "gpt-3.5-random", "api2d-gpt-3.5-turbo", 'api2d-gpt-3.5-turbo-16k', -# "spark", "sparkv2", "sparkv3", "chatglm_onnx", "claude-1-100k", "claude-2", "internlm", "jittorllms_pangualpha", "jittorllms_llama" +# "moonshot-v1-128k", "moonshot-v1-32k", "moonshot-v1-8k", +# "qwen-turbo", "qwen-plus", "qwen-max", +# "zhipuai", "qianfan", "deepseekcoder", "llama2", "qwen-local", "gpt-3.5-turbo-0613", "moss", +# "gpt-3.5-turbo-16k-0613", "gpt-3.5-random", "api2d-gpt-3.5-turbo", 'api2d-gpt-3.5-turbo-16k', +# "spark", "sparkv2", "sparkv3", "sparkv3.5", +# "chatglm_onnx", "claude-1-100k", "claude-2", "internlm", "jittorllms_pangualpha", "jittorllms_llama" # ] diff --git a/crazy_functions/crazy_utils.py b/crazy_functions/crazy_utils.py index 9c8aecc..980ec35 100644 --- a/crazy_functions/crazy_utils.py +++ b/crazy_functions/crazy_utils.py @@ -135,13 +135,25 @@ def request_gpt_model_in_new_thread_with_ui_alive( yield from update_ui(chatbot=chatbot, history=[]) # 如果最后成功了,则删除报错信息 return final_result -def can_multi_process(llm): - if llm.startswith('gpt-'): return True - if llm.startswith('api2d-'): return True - if llm.startswith('azure-'): return True - if llm.startswith('spark'): return True - if llm.startswith('zhipuai') or llm.startswith('glm-'): return True - return False +def can_multi_process(llm) -> bool: + from request_llms.bridge_all import model_info + + def default_condition(llm) -> bool: + # legacy condition + if llm.startswith('gpt-'): return True + if llm.startswith('api2d-'): return True + if llm.startswith('azure-'): return True + if llm.startswith('spark'): return True + if llm.startswith('zhipuai') or llm.startswith('glm-'): return True + return False + + if llm in model_info: + if 'can_multi_thread' in model_info[llm]: + return model_info[llm]['can_multi_thread'] + else: + return default_condition(llm) + else: + return default_condition(llm) def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency( inputs_array, inputs_show_user_array, llm_kwargs, diff --git a/request_llms/bridge_all.py b/request_llms/bridge_all.py index 6d00fba..d7f2ad9 100644 --- a/request_llms/bridge_all.py +++ b/request_llms/bridge_all.py @@ -94,7 +94,7 @@ model_info = { "fn_with_ui": chatgpt_ui, "fn_without_ui": chatgpt_noui, "endpoint": openai_endpoint, - "max_token": 4096, + "max_token": 16385, "tokenizer": tokenizer_gpt35, "token_cnt": get_token_num_gpt35, }, @@ -126,7 +126,16 @@ model_info = { "token_cnt": get_token_num_gpt35, }, - "gpt-3.5-turbo-1106": {#16k + "gpt-3.5-turbo-1106": { #16k + "fn_with_ui": chatgpt_ui, + "fn_without_ui": chatgpt_noui, + "endpoint": openai_endpoint, + "max_token": 16385, + "tokenizer": tokenizer_gpt35, + "token_cnt": get_token_num_gpt35, + }, + + "gpt-3.5-turbo-0125": { #16k "fn_with_ui": chatgpt_ui, "fn_without_ui": chatgpt_noui, "endpoint": openai_endpoint, @@ -516,6 +525,7 @@ if "qwen-local" in AVAIL_LLM_MODELS: "qwen-local": { "fn_with_ui": qwen_local_ui, "fn_without_ui": qwen_local_noui, + "can_multi_thread": False, "endpoint": None, "max_token": 4096, "tokenizer": tokenizer_gpt35, @@ -532,6 +542,7 @@ if "qwen-turbo" in AVAIL_LLM_MODELS or "qwen-plus" in AVAIL_LLM_MODELS or "qwen- "qwen-turbo": { "fn_with_ui": qwen_ui, "fn_without_ui": qwen_noui, + "can_multi_thread": True, "endpoint": None, "max_token": 6144, "tokenizer": tokenizer_gpt35, @@ -540,6 +551,7 @@ if "qwen-turbo" in AVAIL_LLM_MODELS or "qwen-plus" in AVAIL_LLM_MODELS or "qwen- "qwen-plus": { "fn_with_ui": qwen_ui, "fn_without_ui": qwen_noui, + "can_multi_thread": True, "endpoint": None, "max_token": 30720, "tokenizer": tokenizer_gpt35, @@ -548,6 +560,7 @@ if "qwen-turbo" in AVAIL_LLM_MODELS or "qwen-plus" in AVAIL_LLM_MODELS or "qwen- "qwen-max": { "fn_with_ui": qwen_ui, "fn_without_ui": qwen_noui, + "can_multi_thread": True, "endpoint": None, "max_token": 28672, "tokenizer": tokenizer_gpt35, @@ -564,6 +577,7 @@ if "spark" in AVAIL_LLM_MODELS: # 讯飞星火认知大模型 "spark": { "fn_with_ui": spark_ui, "fn_without_ui": spark_noui, + "can_multi_thread": True, "endpoint": None, "max_token": 4096, "tokenizer": tokenizer_gpt35, @@ -580,6 +594,7 @@ if "sparkv2" in AVAIL_LLM_MODELS: # 讯飞星火认知大模型 "sparkv2": { "fn_with_ui": spark_ui, "fn_without_ui": spark_noui, + "can_multi_thread": True, "endpoint": None, "max_token": 4096, "tokenizer": tokenizer_gpt35, @@ -596,6 +611,7 @@ if "sparkv3" in AVAIL_LLM_MODELS or "sparkv3.5" in AVAIL_LLM_MODELS: # 讯飞 "sparkv3": { "fn_with_ui": spark_ui, "fn_without_ui": spark_noui, + "can_multi_thread": True, "endpoint": None, "max_token": 4096, "tokenizer": tokenizer_gpt35, @@ -604,6 +620,7 @@ if "sparkv3" in AVAIL_LLM_MODELS or "sparkv3.5" in AVAIL_LLM_MODELS: # 讯飞 "sparkv3.5": { "fn_with_ui": spark_ui, "fn_without_ui": spark_noui, + "can_multi_thread": True, "endpoint": None, "max_token": 4096, "tokenizer": tokenizer_gpt35,