Created
February 1, 2025 16:45
-
-
Save KyMidd/90808c54654440dad88e6fcc8ef72b84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to retrieve info from RAG with knowledge base | |
def ask_bedrock_llm_with_knowledge_base(flat_conversation, knowledge_base_id, bedrock_client) -> str: | |
# uses embedding model to retrieve vectors | |
response = bedrock_client.retrieve( | |
retrievalQuery={ | |
'text': flat_conversation | |
}, | |
knowledgeBaseId=knowledge_base_id, | |
retrievalConfiguration={ | |
'vectorSearchConfiguration': { | |
'numberOfResults': knowledgeBaseContextNumberOfResults, | |
#'overrideSearchType': "HYBRID", # optional, default is the KB chooses the search type | |
} | |
}, | |
) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment