聊天模型
ChatHuggingFace
我们可以使用Hugging Face LLM 类,也可以直接使用 ChatHuggingFace 类。
查看使用示例。
LLMs
HuggingFaceEndpoint
我们可以使用HuggingFaceEndpoint 类,通过无服务器 Inference Providers 或专用 Inference Endpoints 来运行开源模型。
查看使用示例。
HuggingFacePipeline
我们可以使用HuggingFacePipeline 类在本地运行开源模型。
查看使用示例。
嵌入模型
HuggingFaceEmbeddings
我们可以使用HuggingFaceEmbeddings 类在本地运行开源嵌入模型。
查看使用示例。
HuggingFaceEndpointEmbeddings
我们可以使用HuggingFaceEndpointEmbeddings 类,通过专用 Inference Endpoint 运行开源嵌入模型。
查看使用示例。
Text Embeddings Inference (TEI)
对于 Sentence Transformers 模型的自托管生产环境服务,Hugging Face 发布了 Text Embeddings Inference,这是一个专用推理服务器,支持批处理和 GPU。可以通过HuggingFaceEndpointEmbeddings 将 LangChain 指向 TEI 部署,或查看专门的 TEI 集成指南。
BGE 嵌入模型
Hugging Face 上的 BGE 模型是来自北京智源人工智能研究院(BAAI)的强大开源嵌入模型系列。BGE 模型是 Sentence Transformers 模型,因此请将
HuggingFaceEmbeddings 与 encode_kwargs={"normalize_embeddings": True} 一起使用。查看使用示例。
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

