update provider package

This commit is contained in:
usamimeri_renko 2024-04-25 21:47:57 +08:00
parent aded1dc2ed
commit 6452adf82a
3 changed files with 6 additions and 5 deletions

View file

@ -100,6 +100,4 @@ class LLMConfig(YamlModel):
@classmethod
def check_timeout(cls, v):
return v or LLM_API_TIMEOUT
def get(self, key: str, default = None):
return getattr(self, key, default)

View file

@ -17,6 +17,7 @@ from metagpt.provider.spark_api import SparkLLM
from metagpt.provider.qianfan_api import QianFanLLM
from metagpt.provider.dashscope_api import DashScopeLLM
from metagpt.provider.anthropic_api import AnthropicLLM
from metagpt.provider.bedrock.amazon_bedrock_api import AmazonBedrockLLM
__all__ = [
"GeminiLLM",
@ -30,4 +31,5 @@ __all__ = [
"QianFanLLM",
"DashScopeLLM",
"AnthropicLLM",
"AmazonBedrockLLM"
]

View file

@ -39,7 +39,7 @@ class AmazonBedrockLLM(BaseLLM):
def _generate_kwargs(self) -> dict:
# for now only use temperature due to the difference of request body
return {
"temperature": self.config.get("temperature", 0.1),
"temperature": self.config.temperature
}
def completion(self, messages: list[dict]) -> str:
@ -74,11 +74,12 @@ class AmazonBedrockLLM(BaseLLM):
return full_text
async def acompletion(self, messages: list[dict]):
# Amazon bedrock doesn't support async now
return self._achat_completion(messages)
async def _achat_completion(self, messages: list[dict], timeout=USE_CONFIG_TIMEOUT):
# TODO:make it async
return self.completion(messages)
async def _achat_completion_stream(self, messages: list[dict], timeout=USE_CONFIG_TIMEOUT):
return self._chat_completion_stream(messages)