docs: make Chinese README the default
Auto Bump and Release / auto-bump-and-release (push) Has been cancelled
style-check / pre-commit (push) Has been cancelled
unit-test / unit testing with python (push) Has been cancelled
unit-test / unit testing with python 3.10 (push) Has been cancelled
unit-test / unit testing with python 3.11 (push) Has been cancelled
Auto Bump and Release / auto-bump-and-release (push) Has been cancelled
style-check / pre-commit (push) Has been cancelled
unit-test / unit testing with python (push) Has been cancelled
unit-test / unit testing with python 3.10 (push) Has been cancelled
unit-test / unit testing with python 3.11 (push) Has been cancelled
This commit is contained in:
@@ -1,23 +1,28 @@
|
||||
<!-- WEHUB_ZH_README -->
|
||||
> [!NOTE]
|
||||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||||
> [English](./README.en.md) · [原始项目](https://github.com/Cinnamon/kotaemon) · [上游 README](https://github.com/Cinnamon/kotaemon/blob/HEAD/README.md)
|
||||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||||
|
||||
<div align="center">
|
||||
|
||||
# kotaemon
|
||||
|
||||
An open-source clean & customizable RAG UI for chatting with your documents. Built with both end users and
|
||||
developers in mind.
|
||||
一款开源、简洁且可自定义的 RAG UI,用于与文档对话。同时面向终端用户和开发者打造。
|
||||
|
||||

|
||||
|
||||
<a href="https://trendshift.io/repositories/11607" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11607" alt="Cinnamon%2Fkotaemon | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
|
||||
[Live Demo #1](https://huggingface.co/spaces/cin-model/kotaemon) |
|
||||
[Live Demo #2](https://huggingface.co/spaces/cin-model/kotaemon-demo) |
|
||||
[Online Install](https://cinnamon.github.io/kotaemon/online_install/) |
|
||||
[Colab Notebook (Local RAG)](https://colab.research.google.com/drive/1eTfieec_UOowNizTJA1NjawBJH9y_1nn)
|
||||
[在线演示 #1](https://huggingface.co/spaces/cin-model/kotaemon) |
|
||||
[在线演示 #2](https://huggingface.co/spaces/cin-model/kotaemon-demo) |
|
||||
[在线安装](https://cinnamon.github.io/kotaemon/online_install/) |
|
||||
[Colab 笔记本(本地 RAG)](https://colab.research.google.com/drive/1eTfieec_UOowNizTJA1NjawBJH9y_1nn)
|
||||
|
||||
[User Guide](https://cinnamon.github.io/kotaemon/) |
|
||||
[Developer Guide](https://cinnamon.github.io/kotaemon/development/) |
|
||||
[Feedback](https://github.com/Cinnamon/kotaemon/issues) |
|
||||
[Contact](mailto:kotaemon.support@cinnamon.is)
|
||||
[用户指南](https://cinnamon.github.io/kotaemon/) |
|
||||
[开发者指南](https://cinnamon.github.io/kotaemon/development/) |
|
||||
[反馈](https://github.com/Cinnamon/kotaemon/issues) |
|
||||
[联系](mailto:kotaemon.support@cinnamon.is)
|
||||
|
||||
[](https://www.python.org/downloads/release/python-31013/)
|
||||
[](https://github.com/psf/black)
|
||||
@@ -31,10 +36,9 @@ developers in mind.
|
||||
|
||||
<!-- start-intro -->
|
||||
|
||||
## Introduction
|
||||
## 简介
|
||||
|
||||
This project serves as a functional RAG UI for both end users who want to do QA on their
|
||||
documents and developers who want to build their own RAG pipeline.
|
||||
本项目为希望对文档进行问答(QA)的终端用户,以及希望构建自有 RAG 流水线的开发者,提供一款实用的 RAG UI。
|
||||
<br>
|
||||
|
||||
```yml
|
||||
@@ -52,53 +56,53 @@ documents and developers who want to build their own RAG pipeline.
|
||||
+----------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
### For end users
|
||||
### 面向终端用户
|
||||
|
||||
- **Clean & Minimalistic UI**: A user-friendly interface for RAG-based QA.
|
||||
- **Support for Various LLMs**: Compatible with LLM API providers (OpenAI, AzureOpenAI, Cohere, etc.) and local LLMs (via `ollama` and `llama-cpp-python`).
|
||||
- **Easy Installation**: Simple scripts to get you started quickly.
|
||||
- **简洁极简 UI**:面向基于 RAG 的问答,提供友好的用户界面。
|
||||
- **支持多种 LLM**:兼容 LLM API 提供商(OpenAI、AzureOpenAI、Cohere 等)以及本地 LLM(通过 `ollama` 和 `llama-cpp-python`)。
|
||||
- **安装简便**:提供简单脚本,助你快速上手。
|
||||
|
||||
### For developers
|
||||
### 面向开发者
|
||||
|
||||
- **Framework for RAG Pipelines**: Tools to build your own RAG-based document QA pipeline.
|
||||
- **Customizable UI**: See your RAG pipeline in action with the provided UI, built with <a href='https://github.com/gradio-app/gradio'>Gradio <img src='https://img.shields.io/github/stars/gradio-app/gradio'></a>.
|
||||
- **Gradio Theme**: If you use Gradio for development, check out our theme here: [kotaemon-gradio-theme](https://github.com/lone17/kotaemon-gradio-theme).
|
||||
- **RAG 流水线框架**:提供工具,助你构建基于 RAG 的文档问答流水线。
|
||||
- **可自定义 UI**:通过内置 UI 直观查看 RAG 流水线运行效果,基于 <a href='https://github.com/gradio-app/gradio'>Gradio <img src='https://img.shields.io/github/stars/gradio-app/gradio'></a> 构建。
|
||||
- **Gradio 主题**:若你使用 Gradio 进行开发,可在此查看我们的主题:[kotaemon-gradio-theme](https://github.com/lone17/kotaemon-gradio-theme).
|
||||
|
||||
## Key Features
|
||||
## 核心特性
|
||||
|
||||
- **Host your own document QA (RAG) web-UI**: Support multi-user login, organize your files in private/public collections, collaborate and share your favorite chat with others.
|
||||
- **自托管文档问答(RAG)Web UI**:支持多用户登录,在私有/公开集合中整理文件,协作并与他人分享你喜爱的对话。
|
||||
|
||||
- **Organize your LLM & Embedding models**: Support both local LLMs & popular API providers (OpenAI, Azure, Ollama, Groq).
|
||||
- **管理 LLM 与 Embedding 模型**:支持本地 LLM 及主流 API 提供商(OpenAI、Azure、Ollama、Groq)。
|
||||
|
||||
- **Hybrid RAG pipeline**: Sane default RAG pipeline with hybrid (full-text & vector) retriever and re-ranking to ensure best retrieval quality.
|
||||
- **混合 RAG 流水线**:提供合理的默认 RAG 流水线,采用混合(全文与向量)检索器并重排序,以确保最佳检索质量。
|
||||
|
||||
- **Multi-modal QA support**: Perform Question Answering on multiple documents with figures and tables support. Support multi-modal document parsing (selectable options on UI).
|
||||
- **多模态问答支持**:对包含图表、表格的多份文档进行问答。支持多模态文档解析(可在 UI 中选择选项)。
|
||||
|
||||
- **Advanced citations with document preview**: By default the system will provide detailed citations to ensure the correctness of LLM answers. View your citations (incl. relevant score) directly in the _in-browser PDF viewer_ with highlights. Warning when retrieval pipeline return low relevant articles.
|
||||
- **高级引用与文档预览**:默认提供详细引用,以确保 LLM 回答的准确性。可在_浏览器内 PDF 查看器_中直接查看引用(含相关度分数)及高亮。当检索流水线返回相关性较低的文章时会发出警告。
|
||||
|
||||
- **Support complex reasoning methods**: Use question decomposition to answer your complex/multi-hop question. Support agent-based reasoning with `ReAct`, `ReWOO` and other agents.
|
||||
- **支持复杂推理方法**:通过问题分解回答复杂/多跳问题。支持基于智能体的推理,可使用 `ReAct`、`ReWOO` 及其他智能体。
|
||||
|
||||
- **Configurable settings UI**: You can adjust most important aspects of retrieval & generation process on the UI (incl. prompts).
|
||||
- **可配置设置 UI**:可在 UI 上调整检索与生成过程中的大多数重要环节(含提示词 prompts)。
|
||||
|
||||
- **Extensible**: Being built on Gradio, you are free to customize or add any UI elements as you like. Also, we aim to support multiple strategies for document indexing & retrieval. `GraphRAG` indexing pipeline is provided as an example.
|
||||
- **可扩展**:基于 Gradio 构建,你可自由自定义或添加任意 UI 元素。此外,我们致力于支持多种文档索引与检索策略。`GraphRAG` 索引流水线作为示例提供。
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
## 安装
|
||||
|
||||
> If you are not a developer and just want to use the app, please check out our easy-to-follow [User Guide](https://cinnamon.github.io/kotaemon/). Download the `.zip` file from the [latest release](https://github.com/Cinnamon/kotaemon/releases/latest) to get all the newest features and bug fixes.
|
||||
> 若你不是开发者,仅想使用本应用,请参阅我们易于上手的[用户指南](https://cinnamon.github.io/kotaemon/). 从[最新发布版](https://github.com/Cinnamon/kotaemon/releases/latest) 下载 `.zip` 文件,以获取所有最新功能与错误修复。
|
||||
|
||||
### System requirements
|
||||
### 系统要求
|
||||
|
||||
1. [Python](https://www.python.org/downloads/) >= 3.10
|
||||
2. [Docker](https://www.docker.com/): optional, if you [install with Docker](#with-docker-recommended)
|
||||
3. [Unstructured](https://docs.unstructured.io/open-source/installation/full-installation#full-installation) if you want to process files other than `.pdf`, `.html`, `.mhtml`, and `.xlsx` documents. Installation steps differ depending on your operating system. Please visit the link and follow the specific instructions provided there.
|
||||
2. [Docker](https://www.docker.com/): 可选,若你[使用 Docker 安装](#with-docker-recommended)
|
||||
3. [Unstructured](https://docs.unstructured.io/open-source/installation/full-installation#full-installation) 若你希望处理除 `.pdf`、`.html`、`.mhtml` 和 `.xlsx` 以外的文档,则需安装。安装步骤因操作系统而异。请访问该链接并按其中说明操作。
|
||||
|
||||
### With Docker (recommended)
|
||||
### 使用 Docker(推荐)
|
||||
|
||||
1. We support both `lite` & `full` version of Docker images. With `full` version, the extra packages of `unstructured` will be installed, which can support additional file types (`.doc`, `.docx`, ...) but the cost is larger docker image size. For most users, the `lite` image should work well in most cases.
|
||||
1. 我们同时支持 `lite` 与 `full` 两种 Docker 镜像版本。使用 `full` 版本时,将安装 `unstructured` 的额外软件包,可支持更多文件类型(`.doc`、`.docx` 等),但镜像体积更大。对大多数用户而言,`lite` 镜像在多数情况下即可满足需求。
|
||||
|
||||
- To use the `full` version.
|
||||
- 使用 `full` 版本。
|
||||
|
||||
```shell
|
||||
docker run \
|
||||
@@ -109,21 +113,21 @@ documents and developers who want to build their own RAG pipeline.
|
||||
ghcr.io/cinnamon/kotaemon:main-full
|
||||
```
|
||||
|
||||
- To use the `full` version with bundled **Ollama** for _local / private RAG_.
|
||||
- 使用内置 **Ollama** 的 `full` 版本,用于_本地/私有 RAG_。
|
||||
|
||||
```shell
|
||||
# change image name to
|
||||
docker run <...> ghcr.io/cinnamon/kotaemon:main-ollama
|
||||
```
|
||||
|
||||
- To use the `lite` version.
|
||||
- 使用 `lite` 版本。
|
||||
|
||||
```shell
|
||||
# change image name to
|
||||
docker run <...> ghcr.io/cinnamon/kotaemon:main-lite
|
||||
```
|
||||
|
||||
2. We currently support and test two platforms: `linux/amd64` and `linux/arm64` (for newer Mac). You can specify the platform by passing `--platform` in the `docker run` command. For example:
|
||||
2. 我们目前支持并测试两个平台:`linux/amd64` 与 `linux/arm64`(适用于较新的 Mac)。可在 `docker run` 命令中通过传入 `--platform` 指定平台。例如:
|
||||
|
||||
```shell
|
||||
# To run docker with platform linux/arm64
|
||||
@@ -136,29 +140,29 @@ documents and developers who want to build their own RAG pipeline.
|
||||
ghcr.io/cinnamon/kotaemon:main-lite
|
||||
```
|
||||
|
||||
3. Once everything is set up correctly, you can go to `http://localhost:7860/` to access the WebUI.
|
||||
3. 一切配置正确后,可访问 `http://localhost:7860/` 打开 WebUI。
|
||||
|
||||
4. We use [GHCR](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) to store docker images, all images can be found [here.](https://github.com/Cinnamon/kotaemon/pkgs/container/kotaemon)
|
||||
4. 我们使用 [GHCR](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) 存储 Docker 镜像,所有镜像可在[此处](https://github.com/Cinnamon/kotaemon/pkgs/container/kotaemon) 找到。
|
||||
|
||||
### Without Docker
|
||||
### 不使用 Docker
|
||||
|
||||
1. Clone the repository:
|
||||
1. 克隆仓库:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/Cinnamon/kotaemon
|
||||
cd kotaemon
|
||||
```
|
||||
|
||||
2. Setup the environment:
|
||||
2. 配置环境:
|
||||
|
||||
- **Option 1: Using [uv](https://docs.astral.sh/uv/getting-started/installation/) (recommended)**
|
||||
- **选项 1:使用 [uv](https://docs.astral.sh/uv/getting-started/installation/)(推荐)**
|
||||
|
||||
```shell
|
||||
uv sync --python 3.10
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
- **Option 2: Using conda**
|
||||
- **选项 2:使用 conda**
|
||||
|
||||
```shell
|
||||
conda create -n kotaemon python=3.10
|
||||
@@ -168,104 +172,103 @@ documents and developers who want to build their own RAG pipeline.
|
||||
pip install -e "libs/ktem"
|
||||
```
|
||||
|
||||
3. Create a `.env` file in the root of this project. Use `.env.example` as a template.
|
||||
3. 在本项目根目录创建 `.env` 文件。以 `.env.example` 为模板。
|
||||
|
||||
The `.env` file is there to serve use cases where users want to pre-config the models before starting up the app (e.g. deploy the app on HF hub). The file will only be used to populate the db once upon the first run, it will no longer be used in consequent runs.
|
||||
`.env` 文件用于满足用户在启动应用前预先配置模型的场景(例如将应用部署到 HF hub)。该文件仅在首次运行时用于填充数据库一次,后续运行将不再使用。
|
||||
|
||||
4. (Optional) To enable in-browser `PDF_JS` viewer, download [PDF_JS_DIST](https://github.com/mozilla/pdf.js/releases/download/v4.0.379/pdfjs-4.0.379-dist.zip) then extract it to `libs/ktem/ktem/assets/prebuilt`.
|
||||
4.(可选)要启用浏览器内 `PDF_JS` 查看器,请下载 [PDF_JS_DIST](https://github.com/mozilla/pdf.js/releases/download/v4.0.379/pdfjs-4.0.379-dist.zip),然后解压到 `libs/ktem/ktem/assets/prebuilt`。
|
||||
|
||||
<img src="https://raw.githubusercontent.com/Cinnamon/kotaemon/main/docs/images/pdf-viewer-setup.png" alt="pdf-setup" width="300">
|
||||
|
||||
5. Start the web server:
|
||||
5. 启动 Web 服务器:
|
||||
|
||||
```shell
|
||||
python app.py
|
||||
```
|
||||
|
||||
- The app will be automatically launched in your browser.
|
||||
- Default username and password are both `admin`. You can set up additional users directly through the UI.
|
||||
- 应用会自动在浏览器中打开。
|
||||
- 默认用户名和密码均为 `admin`。你可以通过 UI 直接添加更多用户。
|
||||
|
||||

|
||||
|
||||
6. Check the `Resources` tab and `LLMs and Embeddings` and ensure that your `api_key` value is set correctly from your `.env` file. If it is not set, you can set it there.
|
||||
6. 检查 `Resources` 标签页和 `LLMs and Embeddings`,确保你的 `api_key` 值已从 `.env` 文件正确设置。若未设置,可在该处进行配置。
|
||||
|
||||
### Setup GraphRAG
|
||||
### 配置 GraphRAG
|
||||
|
||||
> [!NOTE]
|
||||
> Official MS GraphRAG indexing only works with OpenAI or Ollama API.
|
||||
> We recommend most users to use NanoGraphRAG implementation for straightforward integration with Kotaemon.
|
||||
> 官方 MS GraphRAG 索引仅支持 OpenAI 或 Ollama API。
|
||||
> 我们建议大多数用户使用 NanoGraphRAG 实现,以便与 Kotaemon 轻松集成。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Setup Nano GRAPHRAG</summary>
|
||||
<summary>配置 Nano GRAPHRAG</summary>
|
||||
|
||||
- Install nano-GraphRAG: `pip install nano-graphrag`
|
||||
- `nano-graphrag` install might introduce version conflicts, see [this issue](https://github.com/Cinnamon/kotaemon/issues/440)
|
||||
- To quickly fix: `pip uninstall hnswlib chroma-hnswlib && pip install chroma-hnswlib`
|
||||
- Launch Kotaemon with `USE_NANO_GRAPHRAG=true` environment variable.
|
||||
- Set your default LLM & Embedding models in Resources setting and it will be recognized automatically from NanoGraphRAG.
|
||||
- 安装 nano-GraphRAG:`pip install nano-graphrag`
|
||||
- `nano-graphrag` 安装可能会引发版本冲突,请参阅 [此 issue](https://github.com/Cinnamon/kotaemon/issues/440)
|
||||
- 快速修复:`pip uninstall hnswlib chroma-hnswlib && pip install chroma-hnswlib`
|
||||
- 使用 `USE_NANO_GRAPHRAG=true` 环境变量启动 Kotaemon。
|
||||
- 在 Resources(资源)设置中配置默认 LLM 和 Embedding 模型,NanoGraphRAG 会自动识别。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Setup LIGHTRAG</summary>
|
||||
<summary>配置 LIGHTRAG</summary>
|
||||
|
||||
- Install LightRAG: `pip install git+https://github.com/HKUDS/LightRAG.git`
|
||||
- `LightRAG` install might introduce version conflicts, see [this issue](https://github.com/Cinnamon/kotaemon/issues/440)
|
||||
- To quickly fix: `pip uninstall hnswlib chroma-hnswlib && pip install chroma-hnswlib`
|
||||
- Launch Kotaemon with `USE_LIGHTRAG=true` environment variable.
|
||||
- Set your default LLM & Embedding models in Resources setting and it will be recognized automatically from LightRAG.
|
||||
- 安装 LightRAG:`pip install git+https://github.com/HKUDS/LightRAG.git`
|
||||
- `LightRAG` 安装可能会引发版本冲突,请参阅 [此 issue](https://github.com/Cinnamon/kotaemon/issues/440)
|
||||
- 快速修复:`pip uninstall hnswlib chroma-hnswlib && pip install chroma-hnswlib`
|
||||
- 使用 `USE_LIGHTRAG=true` 环境变量启动 Kotaemon。
|
||||
- 在 Resources(资源)设置中配置默认 LLM 和 Embedding 模型,LightRAG 会自动识别。
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Setup MS GRAPHRAG</summary>
|
||||
<summary>配置 MS GRAPHRAG</summary>
|
||||
|
||||
- **Non-Docker Installation**: If you are not using Docker, install GraphRAG with the following command:
|
||||
- **非 Docker 安装**:如果不使用 Docker,请使用以下命令安装 GraphRAG:
|
||||
|
||||
```shell
|
||||
pip install "graphrag<=0.3.6" future
|
||||
```
|
||||
|
||||
- **Setting Up API KEY**: To use the GraphRAG retriever feature, ensure you set the `GRAPHRAG_API_KEY` environment variable. You can do this directly in your environment or by adding it to a `.env` file.
|
||||
- **Using Local Models and Custom Settings**: If you want to use GraphRAG with local models (like `Ollama`) or customize the default LLM and other configurations, set the `USE_CUSTOMIZED_GRAPHRAG_SETTING` environment variable to true. Then, adjust your settings in the `settings.yaml.example` file.
|
||||
- **配置 API KEY**:要使用 GraphRAG 检索器功能,请确保设置 `GRAPHRAG_API_KEY` 环境变量。你可以直接在环境中设置,或将其添加到 `.env` 文件。
|
||||
- **使用本地模型与自定义设置**:如果想使用本地模型(如 `Ollama`)运行 GraphRAG,或自定义默认 LLM 及其他配置,请将 `USE_CUSTOMIZED_GRAPHRAG_SETTING` 环境变量设为 true。然后在 `settings.yaml.example` 文件中调整设置。
|
||||
|
||||
</details>
|
||||
|
||||
### Setup Local Models (for local/private RAG)
|
||||
### 配置本地模型(用于本地/私有 RAG)
|
||||
|
||||
See [Local model setup](docs/local_model.md).
|
||||
请参阅 [本地模型配置](docs/local_model.md)。
|
||||
|
||||
### Setup multimodal document parsing (OCR, table parsing, figure extraction)
|
||||
### 配置多模态文档解析(OCR、表格解析、图表提取)
|
||||
|
||||
These options are available:
|
||||
可选方案如下:
|
||||
|
||||
- [Azure Document Intelligence (API)](https://azure.microsoft.com/en-us/products/ai-services/ai-document-intelligence)
|
||||
- [Adobe PDF Extract (API)](https://developer.adobe.com/document-services/docs/overview/pdf-extract-api/)
|
||||
- [Docling (local, open-source)](https://github.com/DS4SD/docling) – see [integrations/docling.md](./docs/integrations/docling.md) for Kotaemon-specific setup.
|
||||
- [PaddleOCR (local, open-source)](https://github.com/PADDLEPADDLE/PADDLEOCR) – see [integrations/paddle_ocr.md](./docs/integrations/paddle_ocr.md) for Kotaemon-specific setup.
|
||||
- [Azure Document Intelligence(API)](https://azure.microsoft.com/en-us/products/ai-services/ai-document-intelligence)
|
||||
- [Adobe PDF Extract(API)](https://developer.adobe.com/document-services/docs/overview/pdf-extract-api/)
|
||||
- [Docling(本地、开源)](https://github.com/DS4SD/docling) – 有关 Kotaemon 专属配置,请参阅 [integrations/docling.md](./docs/integrations/docling.md)。
|
||||
- [PaddleOCR(本地、开源)](https://github.com/PADDLEPADDLE/PADDLEOCR) – 有关 Kotaemon 专属配置,请参阅 [integrations/paddle_ocr.md](./docs/integrations/paddle_ocr.md)。
|
||||
|
||||
Select corresponding loaders in `Settings -> Retrieval Settings -> File loader`
|
||||
在 `Settings -> Retrieval Settings -> File loader` 中选择相应的加载器
|
||||
|
||||
### Customize your application
|
||||
### 自定义应用
|
||||
|
||||
- By default, all application data is stored in the `./ktem_app_data` folder. You can back up or copy this folder to transfer your installation to a new machine.
|
||||
- 默认情况下,所有应用数据存储在 `./ktem_app_data` 文件夹中。你可以备份或复制该文件夹,以便将安装迁移到新机器。
|
||||
|
||||
- For advanced users or specific use cases, you can customize these files:
|
||||
- 对于高级用户或特定场景,可以自定义以下文件:
|
||||
|
||||
- `flowsettings.py`
|
||||
- `.env`
|
||||
|
||||
#### `flowsettings.py`
|
||||
|
||||
This file contains the configuration of your application. You can use the example
|
||||
[here](flowsettings.py) as the starting point.
|
||||
该文件包含应用配置。你可以参考[此处示例](flowsettings.py)作为起点。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Notable settings</summary>
|
||||
<summary>重要设置</summary>
|
||||
|
||||
```python
|
||||
# setup your preferred document store (with full-text search capabilities)
|
||||
@@ -290,22 +293,19 @@ KH_REASONINGS = [
|
||||
|
||||
#### `.env`
|
||||
|
||||
This file provides another way to configure your models and credentials.
|
||||
该文件提供另一种配置模型与凭据的方式。
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Configure model via the .env file</summary>
|
||||
<summary>通过 .env 文件配置模型</summary>
|
||||
|
||||
- Alternatively, you can configure the models via the `.env` file with the information needed to connect to the LLMs. This file is located in the folder of the application. If you don't see it, you can create one.
|
||||
- 你也可以通过 `.env` 文件配置模型,填入连接 LLM 所需的信息。该文件位于应用文件夹中;若不存在,可自行创建。
|
||||
|
||||
- Currently, the following providers are supported:
|
||||
- 目前支持以下提供商:
|
||||
|
||||
- **OpenAI**
|
||||
|
||||
In the `.env` file, set the `OPENAI_API_KEY` variable with your OpenAI API key in order
|
||||
to enable access to OpenAI's models. There are other variables that can be modified,
|
||||
please feel free to edit them to fit your case. Otherwise, the default parameter should
|
||||
work for most people.
|
||||
在 `.env` 文件中,将 `OPENAI_API_KEY` 变量设置为你的 OpenAI API key,以启用对 OpenAI 模型的访问。还有其他可修改的变量,请根据需要自行调整;否则默认参数对大多数用户应已足够。
|
||||
|
||||
```shell
|
||||
OPENAI_API_BASE=https://api.openai.com/v1
|
||||
@@ -316,9 +316,7 @@ This file provides another way to configure your models and credentials.
|
||||
|
||||
- **Azure OpenAI**
|
||||
|
||||
For OpenAI models via Azure platform, you need to provide your Azure endpoint and API
|
||||
key. You might also need to provide your developments' name for the chat model and the
|
||||
embedding model depending on how you set up Azure development.
|
||||
通过 Azure 平台使用 OpenAI 模型时,需要提供 Azure 端点和 API key。根据你在 Azure 上的部署方式,可能还需要提供聊天模型和嵌入模型的部署名称。
|
||||
|
||||
```shell
|
||||
AZURE_OPENAI_ENDPOINT=
|
||||
@@ -330,58 +328,55 @@ This file provides another way to configure your models and credentials.
|
||||
|
||||
- **Local Models**
|
||||
|
||||
- Using `ollama` OpenAI compatible server:
|
||||
- 使用 `ollama` OpenAI 兼容服务器:
|
||||
|
||||
- Install [ollama](https://github.com/ollama/ollama) and start the application.
|
||||
- 安装 [ollama](https://github.com/ollama/ollama) 并启动应用。
|
||||
|
||||
- Pull your model, for example:
|
||||
- 拉取模型,例如:
|
||||
|
||||
```shell
|
||||
ollama pull llama3.1:8b
|
||||
ollama pull nomic-embed-text
|
||||
```
|
||||
|
||||
- Set the model names on web UI and make it as default:
|
||||
- 在 Web UI 中设置模型名称并将其设为默认:
|
||||
|
||||

|
||||
|
||||
- Using `GGUF` with `llama-cpp-python`
|
||||
- 使用 `GGUF` 配合 `llama-cpp-python`
|
||||
|
||||
You can search and download a LLM to be ran locally from the [Hugging Face Hub](https://huggingface.co/models). Currently, these model formats are supported:
|
||||
你可以从 [Hugging Face Hub](https://huggingface.co/models). 搜索并下载在本地运行的 LLM。目前支持以下模型格式:
|
||||
|
||||
- GGUF
|
||||
|
||||
You should choose a model whose size is less than your device's memory and should leave
|
||||
about 2 GB. For example, if you have 16 GB of RAM in total, of which 12 GB is available,
|
||||
then you should choose a model that takes up at most 10 GB of RAM. Bigger models tend to
|
||||
give better generation but also take more processing time.
|
||||
应选择体积小于设备内存的模型,并预留约 2 GB 空间。例如,若设备共有 16 GB RAM,其中 12 GB 可用,则应选择最多占用 10 GB RAM 的模型。更大的模型通常生成效果更好,但处理时间也更长。
|
||||
|
||||
Here are some recommendations and their size in memory:
|
||||
以下是一些推荐模型及其内存占用:
|
||||
|
||||
- [Qwen1.5-1.8B-Chat-GGUF](https://huggingface.co/Qwen/Qwen1.5-1.8B-Chat-GGUF/resolve/main/qwen1_5-1_8b-chat-q8_0.gguf?download=true): around 2 GB
|
||||
- [Qwen1.5-1.8B-Chat-GGUF](https://huggingface.co/Qwen/Qwen1.5-1.8B-Chat-GGUF/resolve/main/qwen1_5-1_8b-chat-q8_0.gguf?download=true): 约 2 GB
|
||||
|
||||
Add a new LlamaCpp model with the provided model name on the web UI.
|
||||
在 Web UI 中添加一个新的 LlamaCpp 模型,使用提供的模型名称。
|
||||
|
||||
</details>
|
||||
|
||||
### Adding your own RAG pipeline
|
||||
### 添加你自己的 RAG 流水线
|
||||
|
||||
#### Custom Reasoning Pipeline
|
||||
#### 自定义推理流水线(Reasoning Pipeline)
|
||||
|
||||
1. Check the default pipeline implementation in [here](libs/ktem/ktem/reasoning/simple.py). You can make quick adjustment to how the default QA pipeline work.
|
||||
2. Add new `.py` implementation in `libs/ktem/ktem/reasoning/` and later include it in `flowssettings` to enable it on the UI.
|
||||
1. 在[此处](libs/ktem/ktem/reasoning/simple.py)查看默认流水线实现。你可以快速调整默认 QA 流水线的工作方式。
|
||||
2. 在 `libs/ktem/ktem/reasoning/` 中添加新的 `.py` 实现,随后在 `flowssettings` 中引入,以在 UI 上启用。
|
||||
|
||||
#### Custom Indexing Pipeline
|
||||
#### 自定义索引流水线(Indexing Pipeline)
|
||||
|
||||
- Check sample implementation in `libs/ktem/ktem/index/file/graph`
|
||||
- 在 `libs/ktem/ktem/index/file/graph` 中查看示例实现
|
||||
|
||||
> (more instruction WIP).
|
||||
> (更多说明待补充 WIP)。
|
||||
|
||||
<!-- end-intro -->
|
||||
|
||||
## Citation
|
||||
## 引用
|
||||
|
||||
Please cite this project as
|
||||
请按如下方式引用本项目:
|
||||
|
||||
```BibTeX
|
||||
@misc{kotaemon2024,
|
||||
@@ -392,7 +387,7 @@ Please cite this project as
|
||||
}
|
||||
```
|
||||
|
||||
## Star History
|
||||
## Star 历史
|
||||
|
||||
<a href="https://star-history.com/#Cinnamon/kotaemon&Date">
|
||||
<picture>
|
||||
@@ -402,9 +397,9 @@ Please cite this project as
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## Contribution
|
||||
## 贡献
|
||||
|
||||
Since our project is actively being developed, we greatly value your feedback and contributions. Please see our [Contributing Guide](https://github.com/Cinnamon/kotaemon/blob/main/CONTRIBUTING.md) to get started. Thank you to all our contributors!
|
||||
由于本项目仍在积极开发中,我们非常重视你的反馈与贡献。请参阅我们的[贡献指南](https://github.com/Cinnamon/kotaemon/blob/main/CONTRIBUTING.md) 以开始参与。感谢所有贡献者!
|
||||
|
||||
<a href="https://github.com/Cinnamon/kotaemon/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Cinnamon/kotaemon" />
|
||||
|
||||
Reference in New Issue
Block a user