Hi All,
I am trying to replicate the generative AI chatbot found in the code in this repository: https://github.com/aws-samples/rag-using-langchain-amazon-bedrock-and-opensearch/tree/main
I have been able to complete all of the steps under "Prerequisites" on the "README" page. However, I am unable to complete step 2 (and therefore can't move onto step 3) on the "Steps for using this sample code" section.
When I run step 2 in the terminal "python3 load-data-to-opensearch.py --recreate 1 --early-stop 1", I receive the following error:
" 2024-07-16 13:34:17.631 | INFO | main:main:47 - Starting
2024-07-16 13:34:17.632 | INFO | main:main:57 - recreating opensearch index: True, using early stop: True to insert only 100 records
2024-07-16 13:34:17.632 | INFO | main:main:58 - Preparing OpenSearch Index
Traceback (most recent call last):
File "/Users/myname/Desktop/AWS_RAG/rag-using-langchain-amazon-bedrock-and-opensearch/load-data-to-opensearch.py", line 121, in <module>
main()
File "/Users/myname/Desktop/AWS_RAG/rag-using-langchain-amazon-bedrock-and-opensearch/load-data-to-opensearch.py", line 59, in main
opensearch_password = secret.get_secret(name, region)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/myname/Desktop/AWS_RAG/rag-using-langchain-amazon-bedrock-and-opensearch/utils/secret.py", line 6, in get_secret
secret_arn = locate_secret_arn(secret_prefix, client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/myname/Desktop/AWS_RAG/rag-using-langchain-amazon-bedrock-and-opensearch/utils/secret.py", line 24, in locate_secret_arn
return response['SecretList'][0]['ARN']
~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range"
I believe this error is due to there being no Secret stored in the AWS SecretsManager. For some reason, the code isn't generating a Secret password. I believe that the file "Secrets.tf" in the "Terraform" folder in the repository has the code to generate and store the OpenSearch password as a Secret in the AWS SecretsManager.
I am not sure how to get Secret.tf to generate and store my OpenSearch password in AWS SecretsManager. I believe once I am able to generate and access the password, that the code should then work.
Thank you for your help,
Em
Therefore, try specifying the region as an argument as shown below.
Thank you sooooo much Riku! This worked!!!!!! Wish me luck in trying to now use the code with my own dataset!