INNER CODE UNIT · Python
main
aws-samples/rag-using-langchain-amazon-bedrock-and-opensearch · ask-bedrock-with-rag.py:64
def main():
logger.info("Starting...")
args, _ = parse_args()
region = args.region
index_name = args.index
bedrock_model_id = args.bedrock_model_id
bedrock_embedding_model_id = args.bedrock_embedding_model_id
question = args.ask
tenant_id = args.tenant_id
logger.info(f"Question provided: {question}")
# Creating all clients for chain
bedrock_client = get_bedrock_client(region)
bedrock_llm = create_bedrock_llm(bedrock_client, bedrock_model_id)
bedrock_embeddings_client = create_langchain_vector_embedding_using_bedrock(bedrock_client, bedrock_embedding_model_id)
opensearch_endpoint = opensearch.get_opensearch_endpoint(index_name, region)
opensearch_password = secret.get_secret(index_name, region)
opensearch_vector_search_client = create_opensearch_vector_search_client(index_name, opensearch_password, bedrock_embeddings_client, opensearch_endpoint)