mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
Fixed validation error when credentials_profile_name, or region_name is not passed (#7629)
## Summary This PR corrects the checks for credentials_profile_name, and region_name attributes. This was causing validation exceptions when either of these values were missing during creation of the retriever class. Fixes #7571 #### Requested reviewers: @baskaryan
This commit is contained in:
parent
0e1d7a27c6
commit
f11d845dee
@ -213,14 +213,14 @@ class AmazonKendraRetriever(BaseRetriever):
|
||||
try:
|
||||
import boto3
|
||||
|
||||
if values["credentials_profile_name"] is not None:
|
||||
if values.get("credentials_profile_name"):
|
||||
session = boto3.Session(profile_name=values["credentials_profile_name"])
|
||||
else:
|
||||
# use default credentials
|
||||
session = boto3.Session()
|
||||
|
||||
client_params = {}
|
||||
if values["region_name"] is not None:
|
||||
if values.get("region_name"):
|
||||
client_params["region_name"] = values["region_name"]
|
||||
|
||||
values["client"] = session.client("kendra", **client_params)
|
||||
|
Loading…
Reference in New Issue
Block a user