跳到主要内容
Amazon Bedrock 是一项完全托管的服务,通过单个 API 提供 AI21 LabsAnthropicCohereMetaStability AIAmazon 等领先 AI 公司的精选高性能基础模型(FM),并提供构建具有安全性、隐私性和负责任 AI 的生成式 AI 应用程序所需的一整套功能。使用 Amazon Bedrock,您可以轻松地为您的用例试验和评估顶级 FM,使用微调和 检索增强生成 (RAG) 等技术使用您自己的数据对其进行私密定制,并构建代理以使用您的企业系统和数据源执行任务。由于 Amazon Bedrock 是无服务器的,您无需管理任何基础设施,并且可以使用您熟悉的 AWS 服务将生成式 AI 功能安全地集成到您的应用程序中并进行部署。
pip install -qU  boto3
from langchain_aws 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"]
)

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.