Bedrock
Amazon Bedrock is a fully managed service that offers a choice ofhigh-performing foundation models (FMs) from leading AI companies like
AI21 Labs
,Anthropic
,Cohere
,Meta
,Stability AI
, andAmazon
via a single API, along with a broad set of capabilities you need tobuild generative AI applications with security, privacy, and responsible AI. UsingAmazon Bedrock
,you can easily experiment with and evaluate top FMs for your use case, privately customize them withyour data using techniques such as fine-tuning andRetrieval Augmented Generation
(RAG
), and buildagents that execute tasks using your enterprise systems and data sources. SinceAmazon Bedrock
isserverless, you don't have to manage any infrastructure, and you can securely integrate and deploygenerative AI capabilities into your applications using the AWS services you are already familiar with.
%pip install--upgrade--quiet boto3
from langchain_awsimport BedrockEmbeddings
embeddings= BedrockEmbeddings(
credentials_profile_name="bedrock-admin", region_name="us-east-1"
)
embeddings.embed_query("This is a content of the document")
embeddings.embed_documents(
["This is a content of the document","This is another document"]
)
# async embed query
await embeddings.aembed_query("This is a content of the document")
# async embed documents
await embeddings.aembed_documents(
["This is a content of the document","This is another document"]
)
Related
- Embedding modelconceptual guide
- Embedding modelhow-to guides