From ac15c4db618abee817c0ca6cbee0cac6469c9cd7 Mon Sep 17 00:00:00 2001 From: Matthew Hand Date: Wed, 30 Oct 2024 19:41:26 +0000 Subject: [PATCH 1/5] docs: Add RAG tutorial for OpenWebUI --- docs/tutorials/tips/rag-tutorial.md | 105 ++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 docs/tutorials/tips/rag-tutorial.md diff --git a/docs/tutorials/tips/rag-tutorial.md b/docs/tutorials/tips/rag-tutorial.md new file mode 100644 index 0000000..e9e64de --- /dev/null +++ b/docs/tutorials/tips/rag-tutorial.md @@ -0,0 +1,105 @@ +--- +sidebar_position: 3 +title: "Open WebUI RAG Tutorial" +--- + +:::warning +This tutorial is a community contribution and is not supported by the OpenWebUI team. It serves only as a demonstration on how to customize OpenWebUI for your specific use case. Want to contribute? Check out the contributing tutorial. +::: + +# Tutorial: Configuring RAG with OpenWebUI Documentation + +In this tutorial, you will learn how to use **Retrieval-Augmented Generation (RAG)** with OpenWebUI to load real-world documentation as a knowledge base. We will walk through how to use the latest **OpenWebUI Documentation** as an example for this setup. + +--- + +## Overview + +### What is RAG? + +Retrieval-Augmented Generation (RAG) combines **LLMs** with **retrieved knowledge** from external sources. The system retrieves relevant data from uploaded documents or knowledge bases, enhancing the quality and accuracy of responses. + +This tutorial demonstrates how to: +- Upload the latest OpenWebUI Documentation as a knowledge base. +- Connect it to a custom model. +- Query the knowledge base for enhanced assistance. + +--- + +## Setup + +### Step-by-Step Setup: OpenWebUI Documentation as Knowledge Base + +Follow these steps to set up RAG with **OpenWebUI Documentation**: + +1. **Download the Documentation**: + - Download the latest documentation: + [https://github.com/open-webui/docs/archive/refs/heads/main.zip](https://github.com/open-webui/docs/archive/refs/heads/main.zip) + +2. **Extract the Files**: + - Extract the `main.zip` file to get all documentation files. + +3. **Locate the Markdown Files**: + - In the extracted folder, locate all files with `.md` and `.mdx`extensions (tip: search for `*.md*`). + +4. **Create a Knowledge Base**: + - Navigate to **Workspace** > **Knowledge** > **+ Create a Knowledge Base**. + - Name it: `OpenWebUI Documentation` + - Purpose: **Assistance** + + > Click **Create Knowledge**. + +5. **Upload the Files**: + - Drag and drop the `.md` and `.mdx` files from the extracted folder into the **OpenWebUI Documentation** knowledge base. + +--- + +## Create and Configure the Model + +### Create a Custom Model with the Knowledge Base + +1. **Navigate to Models**: + - Go to **Workspace** > **Models** > **+ Add New Model**. + +2. **Configure the Model**: + - **Name**: `OpenWebUI` + - **Base Model**: *(Select the appropriate Llama or other available model)* + - **Knowledge Source**: Select **OpenWebUI Documentation** from the dropdown. + +3. **Save the Model**. + +--- + +## Examples and Usage + +### Query the OpenWebUI Documentation Model + +1. **Start a New Chat**: + - Navigate to **New Chat** and select the `OpenWebUI` model. + +2. **Example Queries**: + + ``` + User: "How do I configure environment variables?" + System: "Refer to Section 3.2: Use the `.env` file to manage configurations." + ``` + + ``` + User: "How do I update OpenWebUI using Docker?" + System: "Refer to `docker/updating.md`: Use `docker pull` and restart the container." + ``` + + With the RAG-enabled model, the system retrieves the most relevant sections from the documentation to answer your query. + +--- + +## Next Steps + +### Next Steps + +- **Add More Knowledge**: Continue expanding your knowledge base by adding more documents. + +--- + +With this setup, you can effectively use the **OpenWebUI Documentation** to assist users by retrieving relevant information for their queries. Enjoy building and querying your custom knowledge-enhanced models! + From ab6a6edcf3b2e8e0ab0025d1e35ec70901b94472 Mon Sep 17 00:00:00 2001 From: Matthew Hand Date: Wed, 30 Oct 2024 20:02:04 +0000 Subject: [PATCH 2/5] fix: Remove trailing whitespace from rag-tutorial.md --- docs/tutorials/tips/rag-tutorial.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tutorials/tips/rag-tutorial.md b/docs/tutorials/tips/rag-tutorial.md index e9e64de..c2a2e50 100644 --- a/docs/tutorials/tips/rag-tutorial.md +++ b/docs/tutorials/tips/rag-tutorial.md @@ -33,7 +33,7 @@ This tutorial demonstrates how to: Follow these steps to set up RAG with **OpenWebUI Documentation**: 1. **Download the Documentation**: - - Download the latest documentation: + - Download the latest documentation: [https://github.com/open-webui/docs/archive/refs/heads/main.zip](https://github.com/open-webui/docs/archive/refs/heads/main.zip) 2. **Extract the Files**: @@ -44,7 +44,7 @@ Follow these steps to set up RAG with **OpenWebUI Documentation**: 4. **Create a Knowledge Base**: - Navigate to **Workspace** > **Knowledge** > **+ Create a Knowledge Base**. - - Name it: `OpenWebUI Documentation` + - Name it: `OpenWebUI Documentation` - Purpose: **Assistance** > Click **Create Knowledge**. @@ -62,8 +62,8 @@ Follow these steps to set up RAG with **OpenWebUI Documentation**: - Go to **Workspace** > **Models** > **+ Add New Model**. 2. **Configure the Model**: - - **Name**: `OpenWebUI` - - **Base Model**: *(Select the appropriate Llama or other available model)* + - **Name**: `OpenWebUI` + - **Base Model**: *(Select the appropriate Llama or other available model)* - **Knowledge Source**: Select **OpenWebUI Documentation** from the dropdown. 3. **Save the Model**. From 13df25eebb819cef8b4a8856ea47ffaf2108eb63 Mon Sep 17 00:00:00 2001 From: Matthew Hand Date: Wed, 30 Oct 2024 20:39:19 +0000 Subject: [PATCH 3/5] fix: Apply Prettier formatting to docusaurus.config.ts to fix CI --- docusaurus.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index f1d2740..ad581fe 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -46,7 +46,7 @@ const config: Config = { // Please change this to your repo. // Remove this to remove the "edit this page" links. editUrl: "https://github.com/open-webui/docs/blob/main", - exclude: ['**/tab-**/**'], + exclude: ["**/tab-**/**"], }, // blog: false, blog: { From f0f737a1a9790e740f4af0231ee4eae8e97a9650 Mon Sep 17 00:00:00 2001 From: Slavik Date: Wed, 30 Oct 2024 22:59:28 -0400 Subject: [PATCH 4/5] add Authenik details to sso.md --- docs/tutorials/features/sso.md | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/tutorials/features/sso.md b/docs/tutorials/features/sso.md index 045bb1b..1b9fd54 100644 --- a/docs/tutorials/features/sso.md +++ b/docs/tutorials/features/sso.md @@ -227,16 +227,28 @@ services: - 4180:4180/tcp ``` + +### Authentik + +To configure a [Authentik](https://goauthentik.io/) OAuth client, please refer to [documentation](https://docs.goauthentik.io/docs/applications) on how to create an application and `OAuth2/OpenID Provider`. +The allowed redirect URI should include `/oauth/google/callback`. + +While creating provider, please note `App-name`, `Client-ID` and `Client-Secret` and use it for open-webui environment variables: + +``` + - 'ENABLE_OAUTH_SIGNUP=true' + - 'OAUTH_MERGE_ACCOUNTS_BY_EMAIL=false' + - 'OAUTH_PROVIDER_NAME=Authentik' + - 'OPENID_PROVIDER_URL=https:///application/o//.well-known/openid-configuration' + - 'OAUTH_CLIENT_ID=' + - 'OAUTH_CLIENT_SECRET=' + - 'OAUTH_SCOPES=openid email profile' + - 'OPENID_REDIRECT_URI=https:///oauth/oidc/callback' +``` + ### Authelia [Authelia](https://www.authelia.com/) can be configured to return a header for use with trusted header authentication. Documentation is available [here](https://www.authelia.com/integration/trusted-header-sso/introduction/). No example configs are provided due to the complexity of deploying Authelia. - -### Authentik - -[Authentik](https://goauthentik.io/) can be configured to return a header for use with trusted header authentication. -Documentation is available [here](https://docs.goauthentik.io/docs/providers/proxy/). - -No example configs are provided due to the complexity of deploying Authentik. From 5a9a9f4a77e71fffe048322c75ff797a5558fff0 Mon Sep 17 00:00:00 2001 From: "slavik.fursov" Date: Thu, 31 Oct 2024 06:36:07 -0700 Subject: [PATCH 5/5] sso.md: few fixes for Authentik config docs --- docs/tutorials/features/sso.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/features/sso.md b/docs/tutorials/features/sso.md index 1b9fd54..11c8a33 100644 --- a/docs/tutorials/features/sso.md +++ b/docs/tutorials/features/sso.md @@ -231,13 +231,13 @@ services: ### Authentik To configure a [Authentik](https://goauthentik.io/) OAuth client, please refer to [documentation](https://docs.goauthentik.io/docs/applications) on how to create an application and `OAuth2/OpenID Provider`. -The allowed redirect URI should include `/oauth/google/callback`. +The allowed redirect URI should include `/oauth/oidc/callback`. While creating provider, please note `App-name`, `Client-ID` and `Client-Secret` and use it for open-webui environment variables: ``` - 'ENABLE_OAUTH_SIGNUP=true' - - 'OAUTH_MERGE_ACCOUNTS_BY_EMAIL=false' + - 'OAUTH_MERGE_ACCOUNTS_BY_EMAIL=true' - 'OAUTH_PROVIDER_NAME=Authentik' - 'OPENID_PROVIDER_URL=https:///application/o//.well-known/openid-configuration' - 'OAUTH_CLIENT_ID='