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

# Localai 集成

> 使用 LangChain Python 集成 Localai。

> [本地AI](https://localai.io/)是免费的、开源的OpenAI替代品。
> `LocalAI`作为本地推理兼容OpenAI API规范的即插即用式REST API。它允许您使用消费级硬件在本地或本地部署运行LLM、生成图像、音频（以及更多），支持多种模型系列和架构。

> [!NOTE]
>
> `langchain-localai`是一个用于LocalAI的第三方集成包。它提供了一种简单的方法，在LangChain中使用LocalAI服务。
> 源代码可在[Github](https://github.com/mkhludnev/langchain-localai)上获取

## 安装和设置

```bash pip theme={null}
pip install langchain-localai
```

```bash uv theme={null}
uv add langchain-localai
```

## 嵌入模型

查看[使用示例](https://localai.io/features/embeddings/index.html)。

## 重新排序器

查看[使用示例](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/document_transformers/localai_rerank.md)。

***

> 官方原文：[src/oss/python/integrations/providers/localai.mdx](https://github.com/langchain-ai/docs/blob/main/src/oss/python/integrations/providers/localai.mdx) · 非官方翻译，译文由 AI 生成，以英文原文为准。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.