🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
remove openai global settings
shenchuchengb036b5d22ee1
diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.pyindex b2a0faca5..844cd4c1c 100644--- a/metagpt/provider/openai_api.py+++ b/metagpt/provider/openai_api.py@@ -77,21 +77,12 @@ class OpenAIGPTAPI(BaseGPTAPI, RateLimiter):"""def __init__(self):- self.__init_openai(CONFIG)self.llm = openaiself.model = CONFIG.openai_api_modelself.auto_max_tokens = False+ self.rpm = int(CONFIG.get("RPM", 10))RateLimiter.__init__(self, rpm=self.rpm)- def __init_openai(self, config):- openai.api_key = config.openai_api_key- if config.openai_api_base:- openai.api_base = config.openai_api_base- if config.openai_api_type:- openai.api_type = config.openai_api_type- openai.api_version = config.openai_api_version- self.rpm = int(config.get("RPM", 10))-async def _achat_completion_stream(self, messages: list[dict]) -> str:response = await self.async_retry_call(openai.ChatCompletion.acreate, **self._cons_kwargs(messages), stream=True@@ -133,6 +124,10 @@ class OpenAIGPTAPI(BaseGPTAPI, RateLimiter):"temperature": 0.3,}kwargs["timeout"] = 3+ kwargs["api_base"] = CONFIG.openai_api_base+ kwargs["api_key"] = CONFIG.openai_api_key+ kwargs["api_type"] = CONFIG.openai_api_type+ kwargs["api_version"] = CONFIG.openai_api_versionreturn kwargsasync def _achat_completion(self, messages: list[dict]) -> dict: