Files
langchain/docs/extras/integrations/text_embedding/bedrock.ipynb
T
Leonid Ganeline fdba711d28 docs integrations/embeddings consistency (#10302)
Updated `integrations/embeddings`: fixed titles; added links,
descriptions
Updated `integrations/providers`.
2023-09-07 19:53:33 -07:00

2.4 KiB

Bedrock

Amazon Bedrock is a fully managed service that makes FMs from leading AI startups and Amazon available via an API, so you can choose from a wide range of FMs to find the model that is best suited for your use case.

In [ ]:
%pip install boto3
In [5]:
from langchain.embeddings import BedrockEmbeddings

embeddings = BedrockEmbeddings(
    credentials_profile_name="bedrock-admin", region_name="us-east-1"
)
In [ ]:
embeddings.embed_query("This is a content of the document")
In [ ]:
embeddings.embed_documents(["This is a content of the document", "This is another document"])
In [ ]:
# async embed query
await embeddings.aembed_query("This is a content of the document")
In [ ]:
# async embed documents
await embeddings.aembed_documents(["This is a content of the document", "This is another document"])