diff --git a/metagpt/actions/research.py b/metagpt/actions/research.py index 65962de31..2a99a8d99 100644 --- a/metagpt/actions/research.py +++ b/metagpt/actions/research.py @@ -134,7 +134,7 @@ class CollectLinks(Action): break model_name = config.llm.model - prompt = reduce_message_length(gen_msg(), model_name, system_text, 0) + prompt = reduce_message_length(gen_msg(), model_name, system_text, config.llm.max_token) logger.debug(prompt) queries = await self._aask(prompt, [system_text]) try: diff --git a/metagpt/config2.py b/metagpt/config2.py index 25569bd93..ed1d23fa5 100644 --- a/metagpt/config2.py +++ b/metagpt/config2.py @@ -134,3 +134,4 @@ def merge_dict(dicts: Iterable[Dict]) -> Dict: return result +config = Config.default() diff --git a/tests/mock/mock_llm.py b/tests/mock/mock_llm.py index 9c159b4ed..b2052e2b3 100644 --- a/tests/mock/mock_llm.py +++ b/tests/mock/mock_llm.py @@ -1,14 +1,13 @@ import json from typing import Optional, Union -from metagpt.config2 import Config +from metagpt.config2 import config from metagpt.configs.llm_config import LLMType from metagpt.logs import logger from metagpt.provider.azure_openai_api import AzureOpenAILLM from metagpt.provider.openai_api import OpenAILLM from metagpt.schema import Message -config = Config.default() OriginalLLM = OpenAILLM if config.llm.api_type == LLMType.OPENAI else AzureOpenAILLM