I'm trying to build a semantic search engine using Amazon Kendra. I wrote the code on Sagemaker's Jupyter Notebook. I'm stuck at the following part:
我正在尝试使用Amazon Kendra构建一个语义搜索引擎。我在Sagemaker的Jupyter笔记本上写了代码。我被困在了以下部分:
Code:
代码:
response = kendra.query(
QueryText = "retrieve blue colored shoes from the inventory data",
IndexId = "xxxxxx"
)
Error:
错误:
EndpointConnectionError: Could not connect to the endpoint URL: "https://kendra.eu-north-1.amazonaws.com/"
My S3 buckets in which I've stored the datasets used in the code have the 'AWS Region' as 'Asia Pacific (Mumbai) ap-south-1'. My Amazon Kendra index too has the same region. Then why is my error talking about some other region: eu-north-1?
我在存储代码中使用的数据集的S3存储桶中将‘AWS Region’设置为‘Asia Pacific(Mumbai)AP-South-1’。我的Amazon Kendra指数也有相同的区域。那么,为什么我的错误是在谈论某个其他地区:EU-North-1?
更多回答
优秀答案推荐
Try to initialize session and pass the region, then from that session initialize the kendra client:
尝试初始化会话并传递区域,然后从该会话初始化Kendra客户端:
session = boto3.session.Session(region_name="")
kendra_client = session.client('kendra')
kendra_query = ""
kendra_kwargs = {
"IndexId": KENDRA_INDEX,
"QueryText": kendra_query,
"PageSize": 5,
}
# query_output = kendra_client.query(**kendra_kwargs)
retrieve_output = kendra_client.retrieve(**kendra_kwargs)
更多回答
我是一名优秀的程序员,十分优秀!