feat: allow boto3 to use its native credential finding functionality (#1536)
This commit is contained in:
@@ -708,8 +708,6 @@ embedder:
|
|||||||
import os
|
import os
|
||||||
from embedchain import App
|
from embedchain import App
|
||||||
|
|
||||||
os.environ["AWS_ACCESS_KEY_ID"] = "xxx"
|
|
||||||
os.environ["AWS_SECRET_ACCESS_KEY"] = "xxx"
|
|
||||||
os.environ["AWS_REGION"] = "us-west-2"
|
os.environ["AWS_REGION"] = "us-west-2"
|
||||||
|
|
||||||
app = App.from_config(config_path="config.yaml")
|
app = App.from_config(config_path="config.yaml")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -11,18 +11,13 @@ from mem0.configs.llms.base import BaseLlmConfig
|
|||||||
from mem0.llms.base import LLMBase
|
from mem0.llms.base import LLMBase
|
||||||
|
|
||||||
|
|
||||||
class AWSBedrockLLM(LLMBase):
|
class AWSBedrockLLM(LLMBase):
|
||||||
def __init__(self, config: Optional[BaseLlmConfig] = None):
|
def __init__(self, config: Optional[BaseLlmConfig] = None):
|
||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
|
|
||||||
if not self.config.model:
|
if not self.config.model:
|
||||||
self.config.model = "anthropic.claude-3-5-sonnet-20240620-v1:0"
|
self.config.model="anthropic.claude-3-5-sonnet-20240620-v1:0"
|
||||||
self.client = boto3.client(
|
self.client = boto3.client("bedrock-runtime")
|
||||||
"bedrock-runtime",
|
|
||||||
region_name=os.environ.get("AWS_REGION"),
|
|
||||||
aws_access_key_id=os.environ.get("AWS_ACCESS_KEY"),
|
|
||||||
aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY"),
|
|
||||||
)
|
|
||||||
self.model_kwargs = {
|
self.model_kwargs = {
|
||||||
"temperature": self.config.temperature,
|
"temperature": self.config.temperature,
|
||||||
"max_tokens_to_sample": self.config.max_tokens,
|
"max_tokens_to_sample": self.config.max_tokens,
|
||||||
|
|||||||
Reference in New Issue
Block a user