mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-10 16:22:37 +02:00
fix feature
This commit is contained in:
parent
a0be280879
commit
864a66c702
3 changed files with 8 additions and 8 deletions
|
|
@ -21,7 +21,7 @@ RPM: 10
|
|||
#OPENAI_API_BASE: "YOUR_AZURE_ENDPOINT"
|
||||
#OPENAI_API_KEY: "YOUR_AZURE_API_KEY"
|
||||
#OPENAI_API_VERSION: "YOUR_AZURE_API_VERSION"
|
||||
#OPENAI_API_ENGINE: "YOUR_OPENAI_API_ENGINE"
|
||||
#DEPLOYMENT_NAME: "YOUR_DEPLOYMENT_NAME"
|
||||
#DEPLOYMENT_ID: "YOUR_DEPLOYMENT_ID"
|
||||
|
||||
#### for Search
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ class Config(metaclass=Singleton):
|
|||
openai.api_base = self.openai_api_base
|
||||
self.openai_api_type = self._get("OPENAI_API_TYPE")
|
||||
self.openai_api_version = self._get("OPENAI_API_VERSION")
|
||||
self.openai_api_engine = self._get('OPENAI_API_ENGINE')
|
||||
self.openai_api_rpm = self._get("RPM", 3)
|
||||
self.openai_api_model = self._get("OPENAI_API_MODEL", "gpt-4")
|
||||
self.max_tokens_rsp = self._get("MAX_TOKENS", 2048)
|
||||
self.deployment_name = self._get('DEPLOYMENT_NAME')
|
||||
self.deployment_id = self._get("DEPLOYMENT_ID")
|
||||
|
||||
self.claude_api_key = self._get("Anthropic_API_KEY")
|
||||
|
|
|
|||
|
|
@ -182,18 +182,18 @@ class OpenAIGPTAPI(BaseGPTAPI, RateLimiter):
|
|||
"n": 1,
|
||||
"stop": None,
|
||||
"temperature": 0.3,
|
||||
"timeout": 3
|
||||
}
|
||||
if CONFIG.openai_api_type == "azure":
|
||||
if CONFIG.openai_api_engine and CONFIG.deployment_id:
|
||||
raise ValueError("You can only use one of the `deployment_id` or `engine` model")
|
||||
elif not CONFIG.openai_api_engine and not CONFIG.deployment_id:
|
||||
raise ValueError("You must specify `OPENAI_API_ENGINE` or `DEPLOYMENT_ID` parameter")
|
||||
kwargs_mode = {"engine": CONFIG.openai_api_engine} if CONFIG.openai_api_engine \
|
||||
if CONFIG.deployment_name and CONFIG.deployment_id:
|
||||
raise ValueError("You can only use one of the `deployment_id` or `deployment_name` model")
|
||||
elif not CONFIG.deployment_name and not CONFIG.deployment_id:
|
||||
raise ValueError("You must specify `DEPLOYMENT_NAME` or `DEPLOYMENT_ID` parameter")
|
||||
kwargs_mode = {"engine": CONFIG.deployment_name} if CONFIG.deployment_name \
|
||||
else {"deployment_id": CONFIG.deployment_id}
|
||||
else:
|
||||
kwargs_mode = {"model": self.model}
|
||||
kwargs.update(kwargs_mode)
|
||||
kwargs["timeout"] = 3
|
||||
return kwargs
|
||||
|
||||
async def _achat_completion(self, messages: list[dict]) -> dict:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue