Skip to main content

Bedrock

Amazon Bedrock 是一项完全托管的服务,提供来自 AI21 LabsAnthropicCohereMetaStability AIAmazon 等领先 AI 公司的一系列高性能基础模型 (FMs),通过单一 API 访问,并提供构建具备安全性、隐私性和负责任 AI 的生成 AI 应用所需的广泛能力。使用 Amazon Bedrock,您可以轻松实验和评估适合您用例的顶级 FMs,使用微调和 Retrieval Augmented Generation (RAG) 等技术私下定制它们,并构建能够使用您的企业系统和数据源执行任务的代理。由于 Amazon Bedrock 是无服务器的,您无需管理任何基础设施,您可以安全地将生成 AI 能力集成并部署到您已经熟悉的 AWS 服务中的应用程序中。

%pip install --upgrade --quiet  boto3
from langchain_community.embeddings import 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"]
)

相关


此页面是否有帮助?


您还可以留下详细的反馈 在 GitHub 上