From 73d0d29e81d2bcde9a6e1f9f511be7877a619a01 Mon Sep 17 00:00:00 2001 From: Azure Wang Date: Tue, 12 Mar 2024 16:49:04 +0800 Subject: [PATCH] - change reserved parameter back to `config.llm.max_token` --- metagpt/actions/research.py | 2 +- metagpt/config2.py | 1 + tests/mock/mock_llm.py | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) 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