From 3fb580cc202c6599d28ef64a143ab461e7de9fce Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:52:27 +0800 Subject: [PATCH] Updated the doc for configuring api key (#1112) ### What problem does this PR solve? #720 ### Type of change - [x] Documentation Update --- README.md | 2 +- docs/guides/configure_knowledge_base.md | 2 +- docs/guides/llm_api_key_setup.md | 64 ++++++++++++++++++------- docs/guides/manage_files.md | 2 +- docs/guides/start_chat.md | 2 +- docs/quickstart.mdx | 10 ++-- 6 files changed, 57 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index ed44ec3a5e..3bb346c52e 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ Try our demo at [https://demo.ragflow.io](https://demo.ragflow.io). > If you skip this confirmation step and directly log in to RAGFlow, your browser may prompt a `network anomaly` error because, at that moment, your RAGFlow may not be fully initialized. 5. In your web browser, enter the IP address of your server and log in to RAGFlow. - > With default settings, you only need to enter `http://IP_OF_YOUR_MACHINE` (**sans** port number) as the default HTTP serving port `80` can be omitted when using the default configurations. + > With the default settings, you only need to enter `http://IP_OF_YOUR_MACHINE` (**sans** port number) as the default HTTP serving port `80` can be omitted when using the default configurations. 6. In [service_conf.yaml](./docker/service_conf.yaml), select the desired LLM factory in `user_default_llm` and update the `API_KEY` field with the corresponding API key. > See [llm_api_key_setup](https://ragflow.io/docs/dev/llm_api_key_setup) for more information. diff --git a/docs/guides/configure_knowledge_base.md b/docs/guides/configure_knowledge_base.md index f08e1491bd..c10f026dc2 100644 --- a/docs/guides/configure_knowledge_base.md +++ b/docs/guides/configure_knowledge_base.md @@ -5,7 +5,7 @@ slug: /configure_knowledge_base # Configure a knowledge base -Knowledge base, hallucination-free chat, and file management are three pillars of RAGFlow. RAGFlow's AI chats are based on knowledge bases. Each of RAGFlow's knowledge bases serves as a knowledge source, *parsing* files uploaded from your local machine and file references generated in **File Management** into the real 'knowledge' for future AI chats. This guide demonstrates some basic usages of the knowledge base feature, covering the following topics: +Knowledge base, hallucination-free chat, and file management are the three pillars of RAGFlow. RAGFlow's AI chats are based on knowledge bases. Each of RAGFlow's knowledge bases serves as a knowledge source, *parsing* files uploaded from your local machine and file references generated in **File Management** into the real 'knowledge' for future AI chats. This guide demonstrates some basic usages of the knowledge base feature, covering the following topics: - Create a knowledge base - Configure a knowledge base diff --git a/docs/guides/llm_api_key_setup.md b/docs/guides/llm_api_key_setup.md index 07baa35c16..1e039184f3 100644 --- a/docs/guides/llm_api_key_setup.md +++ b/docs/guides/llm_api_key_setup.md @@ -3,28 +3,60 @@ sidebar_position: 4 slug: /llm_api_key_setup --- -# Set your LLM API key +# Configure your API key -You have two ways to input your LLM API key. +An API key is required for RAGFlow to interact with an online AI model. This guide provides information about setting your API key in RAGFlow. -## Before Starting The System +## Get your API key -In **user_default_llm** of [service_conf.yaml](https://github.com/infiniflow/ragflow/blob/main/docker/service_conf.yaml), you need to specify LLM factory and your own _API_KEY_. -RAGFlow supports the flowing LLMs, with more coming in the pipeline: +For now, RAGFlow supports the following online LLMs. Clik the corresponding link to apply for your API key. Most LLM providers grant newly-created accounts trial credit, which will expire in a couple of months, or a promotional amount of free quota. -- [OpenAI](https://platform.openai.com/login?launch) -- [Tongyi-Qianwen](https://dashscope.console.aliyun.com/model), -- [ZHIPU-AI](https://open.bigmodel.cn/), -- [Moonshot](https://platform.moonshot.cn/docs) -- [DeepSeek](https://platform.deepseek.com/api-docs/) -- [Baichuan](https://www.baichuan-ai.com/home) -- [VolcEngine](https://www.volcengine.com/docs/82379) +- [OpenAI](https://platform.openai.com/login?launch), +- [Tongyi-Qianwen](https://dashscope.console.aliyun.com/model), +- [ZHIPU-AI](https://open.bigmodel.cn/), +- [Moonshot](https://platform.moonshot.cn/docs), +- [DeepSeek](https://platform.deepseek.com/api-docs/), +- [Baichuan](https://www.baichuan-ai.com/home), +- [VolcEngine](https://www.volcengine.com/docs/82379). -After sign in these LLM suppliers, create your own API-Key, they all have a certain amount of free quota. +:::note +If you find your online LLM is not on the list, don't feel disheartened. The list is expanding, and you can [file a feature request](https://github.com/infiniflow/ragflow/issues/new?assignees=&labels=feature+request&projects=&template=feature_request.yml&title=%5BFeature+Request%5D%3A+) with us! Alternatively, if you have customized models or have locally-deployed models, you can [bind them to RAGFlow using Ollama or Xinference](./deploy_local_llm.md). +::: -## After Starting The System +## Configure your API key -You can also set API-Key in **User Setting** as following: +You have two options for configuring your API key: -![](https://github.com/infiniflow/ragflow/assets/12318111/e4e4066c-e964-45ff-bd56-c3fc7fb18bd3) +- Configure it in **service_conf.yaml** before starting RAGFlow. +- Configure it on the **Model Providers** page after logging into RAGFlow. +### Configure API key before starting up RAGFlow + +1. Navigate to **./docker/ragflow**. +2. Find entry **user_default_llm**: + - Update `factory` with your chosen LLM. + - Update `api_key` with yours. + - Update `base_url` if you use a proxy to connect to the remote service. +3. Reboot your system for your changes to take effect. +4. Log into RAGFlow. + _After logging into RAGFlow, you will find your chosen model appears under **Added models** on the **Model Providers** page._ + +### Configure API key after logging into RAGFlow + +:::caution WARNING +After logging into RAGFlow, configuring API key through the **service_conf.yaml** file will no longer take effect. +::: + +After logging into RAGFlow, you You can *only* configure API Key on the **Model Providers** page: + +1. Click on your logo on the top right of the page **>** **Model Providers**. +2. Find your model card under **Models to be added** and click **Add the model**: + ![add model](https://github.com/infiniflow/ragflow/assets/93570324/07e43f63-367c-4c9c-8ed3-8a3a24703f4e) +3. Paste your API key. +4. Fill in your base URL if you use a proxy to connect to the remote service. +5. Click OK to confirm your changes. + +:::note +If you wish to update an existing API key at a later point: +![update api key](https://github.com/infiniflow/ragflow/assets/93570324/0bfba679-33f7-4f6b-9ed6-f0e6e4b228ad) +::: \ No newline at end of file diff --git a/docs/guides/manage_files.md b/docs/guides/manage_files.md index f99aee2787..e2282277fa 100644 --- a/docs/guides/manage_files.md +++ b/docs/guides/manage_files.md @@ -5,7 +5,7 @@ slug: /manage_files # Manage files -Knowledge base, hallucination-free chat, and file management are three pillars of RAGFlow. RAGFlow's file management allows you to upload files individually or in bulk. You can then link an uploaded file to multiple target knowledge bases. This guide showcases some basic usages of the file management feature. +Knowledge base, hallucination-free chat, and file management are the three pillars of RAGFlow. RAGFlow's file management allows you to upload files individually or in bulk. You can then link an uploaded file to multiple target knowledge bases. This guide showcases some basic usages of the file management feature. ## Create folder diff --git a/docs/guides/start_chat.md b/docs/guides/start_chat.md index eb8f6ada97..53dc705aed 100644 --- a/docs/guides/start_chat.md +++ b/docs/guides/start_chat.md @@ -5,7 +5,7 @@ slug: /start_chat # Start an AI chat -Knowledge base, hallucination-free chat, and file management are three pillars of RAGFlow. Chats in RAGFlow are based on a particular knowledge base or multiple knowledge bases. Once you have created your knowledge base and finished file parsing, you can go ahead and start an AI conversation. +Knowledge base, hallucination-free chat, and file management are the three pillars of RAGFlow. Chats in RAGFlow are based on a particular knowledge base or multiple knowledge bases. Once you have created your knowledge base and finished file parsing, you can go ahead and start an AI conversation. ## Start an AI chat diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index ef6793536c..299619260b 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -18,10 +18,10 @@ This quick start guide describes a general process from: ## Prerequisites -- CPU ≥ 4 cores -- RAM ≥ 16 GB -- Disk ≥ 50 GB -- Docker ≥ 24.0.0 & Docker Compose ≥ v2.26.1 +- CPU ≥ 4 cores; +- RAM ≥ 16 GB; +- Disk ≥ 50 GB; +- Docker ≥ 24.0.0 & Docker Compose ≥ v2.26.1. > If you have not installed Docker on your local machine (Windows, Mac, or Linux), see [Install Docker Engine](https://docs.docker.com/engine/install/). @@ -169,7 +169,7 @@ This section provides instructions on setting up the RAGFlow server on Linux. If 5. In your web browser, enter the IP address of your server and log in to RAGFlow. :::caution WARNING -With default settings, you only need to enter `http://IP_OF_YOUR_MACHINE` (**sans** port number) as the default HTTP serving port `80` can be omitted when using the default configurations. +With the default settings, you only need to enter `http://IP_OF_YOUR_MACHINE` (**sans** port number) as the default HTTP serving port `80` can be omitted when using the default configurations. ::: ## Configure LLMs