Bedrock
Amazon Bedrock 是一项完全托管的服务,提供 来自领先 AI 公司的高性能基础模型 (FM),例如
AI21 Labs,Anthropic,Cohere,Meta,Stability AI和Amazon通过单个 API,以及您需要的一系列广泛功能 构建具有安全性、隐私性和负责任的 AI 的生成式 AI 应用程序。用Amazon Bedrock, 您可以轻松地针对您的用例试验和评估顶级 FM,并使用 您的数据使用微调和Retrieval Augmented Generation(RAG) 并构建 使用您的企业系统和数据源执行任务的代理。因为Amazon Bedrock是 无服务器,您不必管理任何基础设施,并且可以安全地集成和部署 使用您已经熟悉的 AWS 服务将生成式 AI 功能集成到您的应用程序中。
%pip install --upgrade --quiet boto3
from langchain_aws import BedrockEmbeddings
embeddings = BedrockEmbeddings(
credentials_profile_name="bedrock-admin", region_name="us-east-1"
)
API 参考:BedrockEmbeddings
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"]
)