mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-12 09:12:38 +02:00
Merge branch 'geekan:main' into main
This commit is contained in:
commit
4ca22639d4
3 changed files with 55 additions and 11 deletions
|
|
@ -12,7 +12,7 @@ from pydantic import field_validator
|
|||
|
||||
from metagpt.const import LLM_API_TIMEOUT
|
||||
from metagpt.utils.yaml_model import YamlModel
|
||||
|
||||
from metagpt.const import METAGPT_ROOT, CONFIG_ROOT
|
||||
|
||||
class LLMType(Enum):
|
||||
OPENAI = "openai"
|
||||
|
|
@ -94,7 +94,15 @@ class LLMConfig(YamlModel):
|
|||
@classmethod
|
||||
def check_llm_key(cls, v):
|
||||
if v in ["", None, "YOUR_API_KEY"]:
|
||||
raise ValueError("Please set your API key in config2.yaml")
|
||||
repo_config_path = METAGPT_ROOT / "config/config2.yaml"
|
||||
root_config_path = CONFIG_ROOT / "config2.yaml"
|
||||
if root_config_path.exists():
|
||||
raise ValueError(
|
||||
f"Please set your API key in {root_config_path}. If you also set your config in {repo_config_path}, \nthe former will overwrite the latter. This may cause unexpected result.\n")
|
||||
elif repo_config_path.exists():
|
||||
raise ValueError(f"Please set your API key in {repo_config_path}")
|
||||
else:
|
||||
raise ValueError(f"Please set your API key in config2.yaml")
|
||||
return v
|
||||
|
||||
@field_validator("timeout")
|
||||
|
|
|
|||
|
|
@ -137,14 +137,30 @@ DashScope Token price https://help.aliyun.com/zh/dashscope/developer-reference/t
|
|||
Different model has different detail page. Attention, some model are free for a limited time.
|
||||
"""
|
||||
DASHSCOPE_TOKEN_COSTS = {
|
||||
"qwen-turbo": {"prompt": 0.0011, "completion": 0.0011},
|
||||
"qwen-plus": {"prompt": 0.0028, "completion": 0.0028},
|
||||
"qwen-max": {"prompt": 0.0, "completion": 0.0},
|
||||
"qwen-max-1201": {"prompt": 0.0, "completion": 0.0},
|
||||
"qwen-max-longcontext": {"prompt": 0.0, "completion": 0.0},
|
||||
"qwen2-72b-instruct": {"prompt": 0.000714, "completion": 0.001428},
|
||||
"qwen2-57b-a14b-instruct": {"prompt": 0.0005, "completion": 0.001},
|
||||
"qwen2-7b-instruct": {"prompt": 0.000143, "completion": 0.000286},
|
||||
"qwen2-1.5b-instruct": {"prompt": 0, "completion": 0},
|
||||
"qwen2-0.5b-instruct": {"prompt": 0, "completion": 0},
|
||||
"qwen1.5-110b-chat": {"prompt": 0.001, "completion": 0.002},
|
||||
"qwen1.5-72b-chat": {"prompt": 0.000714, "completion": 0.001428},
|
||||
"qwen1.5-32b-chat": {"prompt": 0.0005, "completion": 0.001},
|
||||
"qwen1.5-14b-chat": {"prompt": 0.000286, "completion": 0.000571},
|
||||
"qwen1.5-7b-chat": {"prompt": 0.000143, "completion": 0.000286},
|
||||
"qwen1.5-1.8b-chat": {"prompt": 0, "completion": 0},
|
||||
"qwen1.5-0.5b-chat": {"prompt": 0, "completion": 0},
|
||||
"qwen-turbo": {"prompt": 0.00028, "completion": 0.00083},
|
||||
"qwen-long": {"prompt": 0.00007, "completion": 0.00028},
|
||||
"qwen-plus": {"prompt": 0.00055, "completion": 0.00166},
|
||||
"qwen-max": {"prompt": 0.0055, "completion": 0.0166},
|
||||
"qwen-max-0428": {"prompt": 0.0055, "completion": 0.0166},
|
||||
"qwen-max-0403": {"prompt": 0.0055, "completion": 0.0166},
|
||||
"qwen-max-0107": {"prompt": 0.0055, "completion": 0.0166},
|
||||
"qwen-max-1201": {"prompt": 0.0166, "completion": 0.0166},
|
||||
"qwen-max-longcontext": {"prompt": 0.0055, "completion": 0.0166},
|
||||
"llama2-7b-chat-v2": {"prompt": 0.0, "completion": 0.0},
|
||||
"llama2-13b-chat-v2": {"prompt": 0.0, "completion": 0.0},
|
||||
"qwen-72b-chat": {"prompt": 0.0, "completion": 0.0},
|
||||
"qwen-72b-chat": {"prompt": 0.0028, "completion": 0.0028},
|
||||
"qwen-14b-chat": {"prompt": 0.0011, "completion": 0.0011},
|
||||
"qwen-7b-chat": {"prompt": 0.00084, "completion": 0.00084},
|
||||
"qwen-1.8b-chat": {"prompt": 0.0, "completion": 0.0},
|
||||
|
|
@ -224,6 +240,26 @@ TOKEN_MAX = {
|
|||
"doubao-pro-4k-240515": 4000,
|
||||
"doubao-pro-32k-240515": 32000,
|
||||
"doubao-pro-128k-240515": 128000,
|
||||
# Qwen https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-qianwen-7b-14b-72b-api-detailes?spm=a2c4g.11186623.0.i20
|
||||
"qwen2-57b-a14b-instruct": 32768,
|
||||
"qwen2-72b-instruct": 131072,
|
||||
"qwen2-7b-instruct": 32768,
|
||||
"qwen2-1.5b-instruct": 32768,
|
||||
"qwen2-0.5b-instruct": 32768,
|
||||
"qwen1.5-110b-chat": 32000,
|
||||
"qwen1.5-72b-chat": 32000,
|
||||
"qwen1.5-32b-chat": 32000,
|
||||
"qwen1.5-14b-chat": 8000,
|
||||
"qwen1.5-7b-chat": 32000,
|
||||
"qwen1.5-1.8b-chat": 32000,
|
||||
"qwen1.5-0.5b-chat": 32000,
|
||||
"codeqwen1.5-7b-chat": 64000,
|
||||
"qwen-72b-chat": 32000,
|
||||
"qwen-14b-chat": 8000,
|
||||
"qwen-7b-chat": 32000,
|
||||
"qwen-1.8b-longcontext-chat": 32000,
|
||||
"qwen-1.8b-chat": 8000,
|
||||
|
||||
}
|
||||
|
||||
# For Amazon Bedrock US region
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ anytree
|
|||
ipywidgets==8.1.1
|
||||
Pillow
|
||||
imap_tools==1.5.0 # Used by metagpt/tools/libs/email_login.py
|
||||
qianfan==0.3.2
|
||||
dashscope==1.14.1
|
||||
qianfan~=0.3.16
|
||||
dashscope~=1.19.3
|
||||
rank-bm25==0.2.2 # for tool recommendation
|
||||
gymnasium==0.29.1
|
||||
boto3~=1.34.69
|
||||
spark_ai_python~=0.3.30
|
||||
spark_ai_python~=0.3.30
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue