Bedrock
Amazon Bedrock 是一项全托管服务,通过单一 API 提供来自
AI21 Labs、Anthropic、Cohere、Meta、Stability AI和Amazon等领先人工智能公司的多种高性能基础模型 (FM),以及构建生成式 AI 应用所需的广泛能力,涵盖安全、隐私和负责任的 AI。通过使用Amazon Bedrock,您可以轻松地根据 您的用例尝试和评估顶尖 FM,并使用微调和检索增强生成(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 Reference: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"]
)
Related
- Embedding model conceptual guide
- Embedding model how-to guides