Implementing RAG with Amazon Bedrock and Amazon Titan - Part 1
ฝัง
- เผยแพร่เมื่อ 5 ก.ย. 2024
- In this tutorial, we will build a chatbot based on the Retrieval Augmented Context generation technique. Amazon OpenSearch Serverless is used as the vector database, Amazon Titan is used for generating text embeddings and as an LLM, and Amazon Bedrock API is used for invoking the Titan model.
In part 1, we provision a collection in Amazon OpenSearch Serverless to store the text embeddings that we create in the next step.
Source is available at github.com/jan...
While invoking bedrok, I am getting error AttributeError: 'Bedrock' object has no attribute 'invoke_model', how to solve this
When creating the index, why the dimention is set to 4096 where Titan embedding model has a dimension of 1536?
Good catch. I was using a different embeddings model for which I initialized it for 4096.
Super useful video. 😊
At Initialize and configure OpenSearch client, how do I get the value for host? What do you mean by "value from AWS Management Console"?
When you provision an instance of OpenSearch Serverless, you get an endpoint, which is the hostname of the OpenSearch server. This is needed to initialize the client in the Notebook.
while creating the opensearch serverless I am getting 403 forbidden error. Any clue/suggestions?
Check the IAM roles. It's a common problem with OpenSearch Serverless.
The source code and dataset are available at github.com/janakiramm/rag-bedrock-titan
is oscer-index file saved in s3?
No. It’s just an empty collection at this point. Watch part 1 on how to ingest the data from the CSV file into the collection.
@Janakirammsv yes found it after this comment 😊. What are the accesses/setups I need to ask my MLOps team to enable me start working on bedrock?
Please, help why I am getting "unable to locate credentials" from notebook. when i run this cell .
policy = """{
"Rules": [
{
"Resource": [
"collection/oscars-collection"
],
"ResourceType": "collection"
}
],
"AWSOwnedKey": true
}"""
try:
response = client.create_security_policy(
description="oscars collection encryption security policy",
name="oscars-encryption-policy",
policy=policy,
type="encryption",
)
print(json.dumps(response, indent=2))
except Exception as ex:
print(ex)
It's an IAM issue. Please refer to the AOSS docs to fix this.