---
type: study
created: 2026-08-11
updated: 2026-08-11
sensitivity: standard
status: evergreen
tags: [langchain, python, embeddings, hosted, enterprise, rag]
topic: LangChain Python 托管 Embedding 服务、企业平台与向量生产管理
sources:
  - https://docs.langchain.com/oss/python/integrations/embeddings/azure_openai
  - https://docs.langchain.com/oss/python/integrations/embeddings/baseten
  - https://docs.langchain.com/oss/python/integrations/embeddings/bedrock
  - https://docs.langchain.com/oss/python/integrations/embeddings/cohere
  - https://docs.langchain.com/oss/python/integrations/embeddings/databricks
  - https://docs.langchain.com/oss/python/integrations/embeddings/elasticsearch
  - https://docs.langchain.com/oss/python/integrations/embeddings/fireworks
  - https://docs.langchain.com/oss/python/integrations/embeddings/google_generative_ai
  - https://docs.langchain.com/oss/python/integrations/embeddings/google_vertex_ai
  - https://docs.langchain.com/oss/python/integrations/embeddings/ibm_watsonx
  - https://docs.langchain.com/oss/python/integrations/embeddings/mistralai
  - https://docs.langchain.com/oss/python/integrations/embeddings/nvidia_ai_endpoints
  - https://docs.langchain.com/oss/python/integrations/embeddings/oci_generative_ai
  - https://docs.langchain.com/oss/python/integrations/embeddings/openai
  - https://docs.langchain.com/oss/python/integrations/embeddings/oracleai
  - https://docs.langchain.com/oss/python/integrations/embeddings/perplexity
  - https://docs.langchain.com/oss/python/integrations/embeddings/pinecone
  - https://docs.langchain.com/oss/python/integrations/embeddings/sambanova
  - https://docs.langchain.com/oss/python/integrations/embeddings/together
  - https://docs.langchain.com/oss/python/integrations/embeddings/upstage
  - https://docs.langchain.com/oss/python/integrations/embeddings/voyageai
last_verified: 2026-08-11
---

# Embedding：托管服务与企业平台

## 不可变的索引契约

对向量索引来说，provider/model/revision、输出维度、query/document task type 或 prompt、归一化、截断策略与距离度量共同构成 schema。任一项改变都不能对旧索引原地混写，而应建新索引、回填、评测、alias 切换并保留回滚窗口。

## 集成与特性

| 类 / 包 | 关键参数/能力 | 生产风险 |
|---|---|---|
| `AzureOpenAIEmbeddings` / `langchain-openai` | Azure endpoint/deployment/API version，API key 或 Entra ID；`embed_query/documents` | deployment 与 dimension 锁定；不与 OpenAI 官方 endpoint 的 key/base URL 混用 |
| `BasetenEmbeddings` / `langchain-baseten` | Baseten key + model/deployment，可直接给 vector store | 输出维度与预处理由自定义部署决定；升级 deployment 等同 schema 变更 |
| `BedrockEmbeddings` / `langchain-aws` | AWS credential chain + region + Bedrock model | 文档页的安装只强调 `boto3`，示例类来自 `langchain_aws`；实际环境需显式验证包依赖和 model access |
| `CohereEmbeddings` / `langchain-cohere` | key/model，query/doc embedding | 核对 input type（query/document）与 multilingual model；不同 task 结果不混用 |
| `DatabricksEmbeddings` / `databricks-langchain` | serving endpoint，workspace 内外身份，async 支持 | 需 endpoint 事先存在；记录 endpoint config/version，并限制 batch 和超时 |
| `ElasticsearchEmbeddings` / `langchain-elasticsearch` | 可从 credentials 或现有 Elasticsearch client 初始化 | 连接身份和模型端点需分离；页面为简短示例，需自补版本/维度校验 |
| `FireworksEmbeddings` / `langchain-fireworks` | key/model，query/doc | pin model/endpoint，对 429 做有界批量重试 |
| `GoogleGenerativeAIEmbeddings` / `langchain-google-genai` | `model`、`output_dimensionality`，batch，`RETRIEVAL_QUERY`/`RETRIEVAL_DOCUMENT`，custom endpoint/timeout/headers | 维度可 768/1536/3072 等，一旦选定就是 schema；query/doc task type 必须分开，preview model 不默认上生产 |
| `VertexAIEmbeddings` / `langchain-google-vertexai` | GCP ADC/project/location + model | API/Vertex backend 不可随意切换；地域、配额和 model revision 写入索引元数据 |
| `WatsonxEmbeddings` / `langchain-ibm` | key/token + project，可配 truncate input tokens | 截断会改变语义；选择拒绝超长、预分块还是截断必须版本化 |
| `MistralAIEmbeddings` / `langchain-mistralai` | key/model，query/doc | 锁定模型和 batch，换 model 后全量重建 |
| `NVIDIAEmbeddings` / `langchain-nvidia-ai-endpoints` | API Catalog 或本地 NIM `base_url`；`truncate=NONE/START/END`，可和 reranker/RAG 组合 | 默认超长报错最安全；截头/尾必须显式且入 schema。NIM 镜像、GPU 与许可另行运维 |
| `OCIGenAIEmbeddings` / `langchain-oci` | model ID、service endpoint、compartment，支持 text 与特定模型的 image embedding，async | 文本与图像向量空间只在模型明确支持时可混合；地域/IAM/model access 必查 |
| `OpenAIEmbeddings` / `langchain-openai` | `text-embedding-3-*`，`dimensions`；支持 Azure OpenAI v1 base URL 和 Entra token provider | `dimensions` 一经选定不可漂移；同步/异步凭据对象区分，custom base URL 先验兼容 |
| `OracleEmbeddings` / `langchain-oracledb` | Oracle DB 内 ONNX/provider embedding，支持外部 credential/proxy | database provider 无需第三方凭据；外部 provider 则需数据库 credential，必须最小权限与轮换 |
| `PerplexityEmbeddings` / `langchain-perplexity` | key/model，query/doc，async | 异步与同步路径分别压测；参数/维度不从 ChatPerplexity 推断 |
| `PineconeEmbeddings` / `langchain-pinecone>=0.2.0` | Pinecone key + embedding model | 页面较精简；输出必须与 Pinecone index dimension/metric 预校验 |
| `SambaNovaEmbeddings` / `langchain-sambanova` | key/model，query/doc | 和 Chat 分离配额；固定维度和 batch |
| `TogetherEmbeddings` / `langchain-together` | key/model，query/doc | 多模型目录会变，不使用漂移别名；重建前跑域内评测 |
| `UpstageEmbeddings` / `langchain-upstage` | key/model，与 vector store 集成 | 页面示例较精简；明确 query/document 用法与向量归一化 |
| `VoyageAIEmbeddings` / `langchain-voyageai` | Voyage model，页面以最小 KNN retrieval 为例 | 文档未展开全部配置；需另查 model input type、dimension、context 和 rate limit，不与 reranker model 混淆 |

## 批量、超时与重试

- 索引批处理以输入 token/字节数为主要上限，不只看文档条数；使用有界 worker pool 和 provider 限流器。
- 对 429/5xx 只重试当前 batch，使用稳定 chunk/source ID 做 upsert 幂等；不在每次重试中创建新索引记录。
- 超长默认拒绝或重新分块，不静默截断。如必须截断，记录方向/原始长度并纳入质量评测。

## 数据保护

托管 embedding 也是向第三方发送原文。在调用前完成 tenant 授权、数据分类和必要脱敏，不在 trace 记录完整 chunk。数据库内生成、私网端点或本地 NIM 可缩小外发面，但仍需服务权限和日志脱敏。

## 验证

1. 对 `embed_query` 和 `embed_documents` 分别做维度、finite value、空文本、非 ASCII、超长和批量边界测试。
2. 使用固定 query-document 样本检查排序与阈值，不只验证 API 返回 200。
3. 对目标 vector store 校验 dimension/metric/normalization，并在切换前运行新旧索引 shadow retrieval 对比。
