> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# BedrockEmbeddings 集成

> 使用 LangChain Python 与 BedrockEmbeddings 嵌入模型集成。

> [Amazon Bedrock](https://aws.amazon.com/bedrock/) 是一项完全托管的服务，它通过单一 API 提供来自 `AI21 Labs`、`Anthropic`、`Cohere`、`Meta`、`Stability AI` 和 `Amazon` 等领先 AI 公司的高性能基础模型（FMs）选择，以及构建安全、隐私和负责任 AI 的生成式 AI 应用程序所需的广泛功能。使用 `Amazon Bedrock`，您可以轻松地为您的用例试验和评估顶级基础模型，使用微调和 `检索增强生成`（`RAG`）等技术使用您的数据对其进行私有定制，并构建使用您的企业系统和数据源执行任务的代理。由于 `Amazon Bedrock` 是无服务器的，您无需管理任何基础设施，并且可以使用您已经熟悉的 AWS 服务安全地将生成式 AI 功能集成和部署到您的应用程序中。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install -qU  boto3
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_aws import BedrockEmbeddings

embeddings = BedrockEmbeddings(
    credentials_profile_name="bedrock-admin", region_name="us-east-1"
)
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
embeddings.embed_query("This is a content of the document")
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
embeddings.embed_documents(
    ["This is a content of the document", "This is another document"]
)
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 异步嵌入查询
await embeddings.aembed_query("This is a content of the document")
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 异步嵌入文档
await embeddings.aembed_documents(
    ["This is a content of the document", "This is another document"]
)
```

***

<div className="source-links">
  <Callout icon="terminal-2">
    [连接这些文档](/use-these-docs) 到 Claude、VSCode 等，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/embeddings/bedrock.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
