Skip to content

Commit

Permalink
fix botocore (infiniflow#1414)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
guoyuhao2330 authored Jul 8, 2024
1 parent 30c942b commit 697e3ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rag/llm/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ class BedrockChat(Base):

def __init__(self, key, model_name, **kwargs):
import boto3
from botocore.exceptions import ClientError
self.bedrock_ak = eval(key).get('bedrock_ak', '')
self.bedrock_sk = eval(key).get('bedrock_sk', '')
self.bedrock_region = eval(key).get('bedrock_region', '')
Expand All @@ -548,6 +547,7 @@ def __init__(self, key, model_name, **kwargs):
aws_access_key_id=self.bedrock_ak, aws_secret_access_key=self.bedrock_sk)

def chat(self, system, history, gen_conf):
from botocore.exceptions import ClientError
if system:
history.insert(0, {"role": "system", "content": system})
for k in list(gen_conf.keys()):
Expand Down Expand Up @@ -576,6 +576,7 @@ def chat(self, system, history, gen_conf):
return f"ERROR: Can't invoke '{self.model_name}'. Reason: {e}", 0

def chat_streamly(self, system, history, gen_conf):
from botocore.exceptions import ClientError
if system:
history.insert(0, {"role": "system", "content": system})
for k in list(gen_conf.keys()):
Expand Down

0 comments on commit 697e3ef

Please sign in to comment.