🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
reasoning_max_token set to 4000(suggested)
better629119385c5ceaf
diff --git a/metagpt/configs/llm_config.py b/metagpt/configs/llm_config.pyindex e30bc30e9..2c6fd4b72 100644--- a/metagpt/configs/llm_config.py+++ b/metagpt/configs/llm_config.py@@ -103,7 +103,7 @@ class LLMConfig(YamlModel):# reasoning / thinking switchreasoning: bool = False- reasoning_max_token: int = 1024 # reasoning budget tokens to generate, usually smaller than max_token+ reasoning_max_token: int = 4000 # reasoning budget tokens to generate, usually smaller than max_token@field_validator("api_key")@classmethoddiff --git a/metagpt/provider/anthropic_api.py b/metagpt/provider/anthropic_api.pyindex 7dfd37a9f..7fae4939a 100644--- a/metagpt/provider/anthropic_api.py+++ b/metagpt/provider/anthropic_api.py@@ -42,7 +42,7 @@ class AnthropicLLM(BaseLLM):super()._update_costs(usage, model)def get_choice_text(self, resp: Message) -> str:- if len(resp.content) > 0:+ if len(resp.content) > 1:self.reasoning_content = resp.content[0].thinkingtext = resp.content[1].textelse:diff --git a/metagpt/provider/bedrock/base_provider.py b/metagpt/provider/bedrock/base_provider.pyindex 96710513a..7eb5dfb61 100644--- a/metagpt/provider/bedrock/base_provider.py+++ b/metagpt/provider/bedrock/base_provider.py@@ -7,7 +7,7 @@ class BaseBedrockProvider(ABC):# to handle different generation kwargsmax_tokens_field_name = "max_tokens"- def __init__(self, reasoning: bool = False, reasoning_max_token: int = 1024):+ def __init__(self, reasoning: bool = False, reasoning_max_token: int = 4000):self.reasoning = reasoningself.reasoning_max_token = reasoning_max_tokendiff --git a/metagpt/provider/bedrock/bedrock_provider.py b/metagpt/provider/bedrock/bedrock_provider.pyindex c326f8e5e..10627f40b 100644--- a/metagpt/provider/bedrock/bedrock_provider.py+++ b/metagpt/provider/bedrock/bedrock_provider.py@@ -191,7 +191,7 @@ PROVIDERS = {}-def get_provider(model_id: str, reasoning: bool = False, reasoning_max_token: int = 1024):+def get_provider(model_id: str, reasoning: bool = False, reasoning_max_token: int = 4000):arr = model_id.split(".")if len(arr) == 2:provider, model_name = arr # meta、mistral……diff --git a/metagpt/utils/token_counter.py b/metagpt/utils/token_counter.pyindex efe592af2..306e77c41 100644--- a/metagpt/utils/token_counter.py+++ b/metagpt/utils/token_counter.py@@ -90,6 +90,7 @@ TOKEN_COSTS = {"anthropic/claude-3.7-sonnet": {"prompt": 0.003, "completion": 0.015},"anthropic/claude-3.7-sonnet:beta": {"prompt": 0.003, "completion": 0.015},"anthropic/claude-3.7-sonnet:thinking": {"prompt": 0.003, "completion": 0.015},+ "anthropic.claude-3-7-sonnet-20250219-v1:0": {"prompt": 0.003, "completion": 0.015},"us.anthropic.claude-3-7-sonnet-20250219-v1:0": {"prompt": 0.003, "completion": 0.015},"google/gemini-pro-1.5": {"prompt": 0.0025, "completion": 0.0075}, # for openrouter, end"deepseek-chat": {"prompt": 0.00027, "completion": 0.0011},