diff --git a/backend/app/rag/embed_model_option.py b/backend/app/rag/embed_model_option.py index 042ab7226..2ff5cfffd 100644 --- a/backend/app/rag/embed_model_option.py +++ b/backend/app/rag/embed_model_option.py @@ -27,7 +27,7 @@ class EmbeddingModelOption(BaseModel): provider_description="The OpenAI API provides a simple interface for developers to create an intelligence layer in their applications, powered by OpenAI's state of the art models.", provider_url="https://platform.openai.com", default_embedding_model="text-embedding-3-small", - embedding_model_description=f"Please select a text embedding model with {settings.EMBEDDING_DIMS} dimensions.", + embedding_model_description=f"Find more information about OpenAI Embedding at https://platform.openai.com/docs/guides/embeddings", credentials_display_name="OpenAI API Key", credentials_description="The API key of OpenAI, you can find it in https://platform.openai.com/api-keys", credentials_type="str", @@ -35,11 +35,11 @@ class EmbeddingModelOption(BaseModel): ), EmbeddingModelOption( provider=EmbeddingProvider.JINA, - provider_display_name="Jina", + provider_display_name="JinaAI", provider_description="Jina AI provides multimodal, bilingual long-context embeddings for search and RAG", provider_url="https://jina.ai/embeddings/", default_embedding_model="jina-embeddings-v2-base-en", - embedding_model_description=f"Find more information about Jina AI Embeddings at https://jina.ai/embeddings/, we need a model with {settings.EMBEDDING_DIMS} dimensions.", + embedding_model_description=f"Find more information about Jina AI Embeddings at https://jina.ai/embeddings/", credentials_display_name="Jina API Key", credentials_description="The API key of Jina, you can find it in https://jina.ai/embeddings/", credentials_type="str", @@ -51,7 +51,7 @@ class EmbeddingModelOption(BaseModel): provider_description="Cohere provides industry-leading large language models (LLMs) and RAG capabilities tailored to meet the needs of enterprise use cases that solve real-world problems.", provider_url="https://cohere.com/embeddings", default_embedding_model="embed-multilingual-v3.0", - embedding_model_description=f"Documentation: https://docs.cohere.com/docs/cohere-embed, we need a model with {settings.EMBEDDING_DIMS} dimensions.", + embedding_model_description=f"Documentation: https://docs.cohere.com/docs/cohere-embed", credentials_display_name="Cohere API Key", credentials_description="You can get one from https://dashboard.cohere.com/api-keys", credentials_type="str", @@ -63,7 +63,7 @@ class EmbeddingModelOption(BaseModel): provider_description="Ollama is a lightweight framework for building and running large language models and embed models.", provider_url="https://ollama.com", default_embedding_model="nomic-embed-text", - embedding_model_description=f"https://ollama.com/blog/embedding-models, we need a model with {settings.EMBEDDING_DIMS} dimensions.", + embedding_model_description=f"Documentation: https://ollama.com/blog/embedding-models", default_config={ "api_base": "http://localhost:11434", }, @@ -76,13 +76,13 @@ class EmbeddingModelOption(BaseModel): EmbeddingModelOption( provider=EmbeddingProvider.LOCAL, provider_display_name="Local Embedding", - provider_description="TIDB.AI's local embedding server, deployed on your own infrastructure and powered by sentence-transformers.", + provider_description="Autoflow's local embedding server, deployed on your own infrastructure and powered by sentence-transformers.", default_embedding_model="BAAI/bge-m3", embedding_model_description="Find more models in huggingface.", default_config={ "api_url": "http://local-embedding-reranker:5001/api/v1/embedding", }, - config_description="api_url is the url of the tidb ai local embedding server.", + config_description="api_url is the embedding endpoint url serviced by the autoflow local embedding server.", credentials_display_name="Local Embedding API Key", credentials_description="Local Embedding server doesn't require an API key, set a dummy string here is ok.", credentials_type="str", @@ -94,7 +94,7 @@ class EmbeddingModelOption(BaseModel): provider_description="OpenAI-Like is a set of platforms that provide text embeddings similar to OpenAI. Such as ZhiPuAI.", provider_url="https://open.bigmodel.cn/dev/api/vector/embedding-3", default_embedding_model="embedding-3", - embedding_model_description=f"Please select a text embedding model with {settings.EMBEDDING_DIMS} dimensions.", + embedding_model_description="", credentials_display_name="OpenAI Like API Key", credentials_description="The API key of OpenAI Like. For ZhipuAI, you can find it in https://open.bigmodel.cn/usercenter/apikeys", credentials_type="str", diff --git a/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/data-sources/new/page.tsx b/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/data-sources/new/page.tsx index cec0558d9..04cd04748 100644 --- a/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/data-sources/new/page.tsx +++ b/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/data-sources/new/page.tsx @@ -15,7 +15,7 @@ export default function NewKnowledgeBaseDataSourcePage ({ params }: { params: { <> , url: `/knowledge-bases/${id}` }, { title: 'DataSources', url: `/knowledge-bases/${id}/data-sources` }, { title: 'New' }, diff --git a/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/documents/[documentId]/chunks/page.tsx b/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/documents/[documentId]/chunks/page.tsx index 30a55dc97..999a03e56 100644 --- a/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/documents/[documentId]/chunks/page.tsx +++ b/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/documents/[documentId]/chunks/page.tsx @@ -24,7 +24,7 @@ export default function DocumentChunksPage ({ params }: { params: { id: string, <> , url: `/knowledge-bases/${kbId}` }, { title: document?.name ?? }, { title: 'Chunks' }, diff --git a/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(tabs)/layout.tsx b/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(tabs)/layout.tsx index 17beb4165..eef0c8cbe 100644 --- a/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(tabs)/layout.tsx +++ b/frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(tabs)/layout.tsx @@ -17,7 +17,7 @@ export default function KnowledgeBaseLayout ({ params, children }: { params: { i <> diff --git a/frontend/app/src/components/ui/sidebar.tsx b/frontend/app/src/components/ui/sidebar.tsx index 8fd421a23..5dabdd20b 100644 --- a/frontend/app/src/components/ui/sidebar.tsx +++ b/frontend/app/src/components/ui/sidebar.tsx @@ -637,6 +637,7 @@ const SidebarMenuBadge = React.forwardRef< "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", + "peer-data-[size=md]/menu-sub-button:top-1", className )} {...props} @@ -722,6 +723,7 @@ const SidebarMenuSubButton = React.forwardRef< data-size={size} data-active={isActive} className={cn( + "peer/menu-sub-button", "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", diff --git a/frontend/app/src/pages/docs/_meta.ts b/frontend/app/src/pages/docs/_meta.ts index 2e7eecaf7..a3ab99c52 100644 --- a/frontend/app/src/pages/docs/_meta.ts +++ b/frontend/app/src/pages/docs/_meta.ts @@ -31,6 +31,9 @@ export default { "reranker-model": { "title": "Reranker Model" }, + "knowledge-base": { + "title": "Knowledge Base" + }, "data-source": { "title": "Data Source" }, diff --git a/frontend/app/src/pages/docs/data-source.mdx b/frontend/app/src/pages/docs/data-source.mdx index 95bc50703..aa635cbf7 100644 --- a/frontend/app/src/pages/docs/data-source.mdx +++ b/frontend/app/src/pages/docs/data-source.mdx @@ -1,3 +1,9 @@ +import { Callout } from "nextra/components"; + + + This page was deprecated. Please refer to [Knowledge Base document](/docs/knowledge-base) + + # Add Data Source In order to provide answers to users, you need to add data source to the tool. The data source can be your own docs, knowledge base, etc. diff --git a/frontend/app/src/pages/docs/deploy-with-docker.mdx b/frontend/app/src/pages/docs/deploy-with-docker.mdx index 65b024477..7aa88bada 100644 --- a/frontend/app/src/pages/docs/deploy-with-docker.mdx +++ b/frontend/app/src/pages/docs/deploy-with-docker.mdx @@ -1,13 +1,20 @@ # Deploy with Docker Compose -This document provides instructions for deploying the entire RAG using Docker Compose. +import { Callout } from 'nextra/components' -## Deploy +This document provides instructions for deploying the entire Autoflow application using Docker Compose. + +## Prerequisites + +1. Set up a [TiDB Serverless cluster](https://docs.pingcap.com/tidbcloud/tidb-cloud-quickstart). -> **Prerequisites:** -> -> 1. Set up a [TiDB Serverless cluster](https://docs.pingcap.com/tidbcloud/tidb-cloud-quickstart). -> 2. Install [Docker Compose](https://docs.docker.com/compose/install/). + > **Note** + > + > TiDB Vector Search is only available for TiDB Self-Managed (TiDB >= v8.4) and [TiDB Cloud Serverless](https://ai.pingcap.com/). + +2. Install [Docker Compose](https://docs.docker.com/compose/install/). + +## Deploy 1. Clone the repository: @@ -16,72 +23,7 @@ This document provides instructions for deploying the entire RAG using Docker Co cd autoflow/; ``` -2. Select an embedding model for pingcap/autoflow. - - We recommend using the OpenAI `text-embedding-3-small` model for Autoflow due to its performance and compatibility. However, other supported embedding models can also be utilized. - - - OpenAI - - **Model:** `text-embedding-3-small` - - **Embedding Dimensions (EMBEDDING_DIMS):** 1536 - - **Maximum Tokens (EMBEDDING_MAX_TOKENS):** 8191 - - JinaAI - - **Model:** `jina-clip-v1` - - **Embedding Dimensions (EMBEDDING_DIMS):** 768 - - **Maximum Tokens (EMBEDDING_MAX_TOKENS):** 8192 - - Additional models can be found at [JinaAI Embeddings](https://jina.ai/embeddings/). - - Local Embedding Server - - **Model:** `BAAI/bge-m3` - - **Embedding Dimensions (EMBEDDING_DIMS):** 1024 - - **Maximum Tokens (EMBEDDING_MAX_TOKENS):** 8192 - - We also support embedding models that conform to the OpenAI API format. You can select the "OpenAI-Like" option to use your own embedding model. Details for specific models are provided below: - - - ZhipuAI (Default Option for OpenAI-Like) - - **Model:** `embedding-3` - - **Embedding Dimensions (EMBEDDING_DIMS):** 2048 - - **Maximum Tokens (EMBEDDING_MAX_TOKENS):** 8192 - - More information is available at [ZhipuAI API Documentation](https://open.bigmodel.cn/dev/api/vector/embedding-3). - - **Configuration Note:** Since ZhipuAI is the default option for OpenAI-Like models, no additional configuration is required in the "Advanced Settings". - - Other OpenAI-Like Models - - **Set EMBEDDING_DIMS and EMBEDDING_MAX_TOKENS**: Refer to the model's API documentation to find the correct values for `EMBEDDING_DIMS` and `EMBEDDING_MAX_TOKENS`. - - **Configure API Base in "Advanced Settings"**: - - Add the following configuration in JSON format: - - ```json - { - "api_base": "{api_base}", - } - ``` - - - OpenAI and ZhipuAI models have predefined configurations in their types. These examples are provided for reference when integrating other models. - - - - Example 1: For OpenAI's embedding API (`https://api.openai.com/v1/embeddings`), the `api_base` should be set to `https://api.openai.com/v1`, resulting in the following configuration: - - ```json - { - "api_base": "https://api.openai.com/v1" - } - ``` - - - Example 2: For ZhipuAI's embedding API (`https://open.bigmodel.cn/api/paas/v4/embeddings`), the `api_base` should be set to `https://open.bigmodel.cn/api/paas/v4`, resulting in the following configuration: - - ```json - { - "api_base": "https://open.bigmodel.cn/api/paas/v4" - } - ``` - -import { Callout } from 'nextra/components' - - -Note: You cannot change the embedding model after deployment because different models have varying vector dimensions and generate different vectors for the same input text. -If you want to use a different embedding model after deployment, you need to recreate the app and database. - - -3. Copy and edit the `.env` file: +2. Copy and edit the `.env` file: ```bash cp .env.example .env @@ -93,15 +35,15 @@ If you want to use a different embedding model after deployment, you need to rec - `TIDB_HOST`, `TIDB_USER`, `TIDB_PASSWORD` and `TIDB_DATABASE`: get them from your [TiDB Serverless cluster](https://tidbcloud.com/) - Note: TiDB Serverless will provide a default database name called `test`, if you want to use another database name, you need to create a new database in the TiDB Serverless console. - Note: Don't use '#' in the password, it will cause an error when connecting to the database. See [issue](https://github.com/pydantic/pydantic/issues/8061). - - `EMBEDDING_DIMS` and `EMBEDDING_MAX_TOKENS`: set them according to the embedding model you choose before, it can not be changed after the deployment. + - `EMBEDDING_MAX_TOKENS`: set them according to the embedding model you choose before, it can not be changed after the deployment. -4. Migrate the database schema: +3. Migrate the database schema: ```bash docker compose run backend /bin/sh -c "alembic upgrade head" ``` -5. Bootstrap the database with initial data: +4. Bootstrap the database with initial data: ```bash docker compose run backend /bin/sh -c "python bootstrap.py" @@ -109,7 +51,7 @@ If you want to use a different embedding model after deployment, you need to rec Running the bootstrap script creates an admin user. You can find the username and password in the output. -6. Start the services: +5. Start the services: ```bash docker compose up @@ -121,21 +63,22 @@ If you want to use a different embedding model after deployment, you need to rec docker compose --profile local-embedding-reranker up ``` -7. Open your browser and visit `http://localhost:3000` to access the web interface. +6. Open your browser and visit `http://localhost:3000` to access the web interface. That's it! You can now use pingcap/autoflow locally. You can also go to https://tidb.ai to experience the live demo. ## Configuration -After you deploy the tool, you need to initialize the tool by following the popup wizard. The wizard will guide you through the following steps: +After you deploy the application, you need to initialize the application by following [quick start guide](/quick-start). + +1. Set up the default LLM model in the **Models > LLMs** page. -* Set up the default LLM model. -* Set up the default Embedding model. -* Set up `Data Source` to index the data. +2. Set up the default Embedding model in the **Models > Embedding Models** page. -![initialization](https://github.com/user-attachments/assets/7f9253da-3d6f-4ccd-838d-feed3f0b6f05 "Initialization") +3. Add a new Knowledge Base in the **Knowledge Bases** page. +4. Configure default Chat Engine and set up the new knowledge base as the retrieval database. ## Upgrade diff --git a/frontend/app/src/pages/docs/embedding-model.mdx b/frontend/app/src/pages/docs/embedding-model.mdx index 08b4f5357..c44a9a707 100644 --- a/frontend/app/src/pages/docs/embedding-model.mdx +++ b/frontend/app/src/pages/docs/embedding-model.mdx @@ -1,17 +1,127 @@ # Configure the Embedding Model -The Embedding Model is a machine learning model that is trained to generate embeddings for a given input. The embeddings are then used to generate recommendations for the user. - import { Callout } from 'nextra/components' - -Note: The Embedding Model is configured at the beggining of the deployment process. As different embedding models have different dimensions of vectors, you can not change the embedding model after the deployment. +Embedding Model is the machine learning model responsible for converting given input into numerical vectors (embeddings), which represent the semantic meaning of the input text. + +In Autoflow, we use the Embedding Model to vectorize documents and store them in TiDB, enabling us to leverage the TiDB's Vector Search capability to retrieval the relevant documents for user querie. + +## Manage Embedding Models + +You can manage the Embedding Models in the **Models > Embedding Models** page in the admin console. + +### Add New Embedding Model + +Click the **New Embedding Model** button, select your preferred embedding model provider, and configure the model parameters. + +![Add Embedding Model](https://github.com/user-attachments/assets/70c9f8d7-0e6a-46e7-909f-03f94062d5e2) + +## Supported Providers + +We recommend using the OpenAI `text-embedding-3-small` model for Autoflow due to its performance and compatibility, but the mainstream embedding model providers and self-hosted embedding server are also supported. + +### OpenAI + +OpenAI provides a variety of [Embedding Models](https://platform.openai.com/docs/guides/embeddings#embedding-models), such as: + +| Embedding Model | Vector Dimensions | Max Tokens | +| ------------------------ | ----------------- | ---------- | +| `text-embedding-3-small` | 1536 | 8191 | + +### OpenAI-Like + +Autoflow also support embedding model providers (such as [ZhipuAI](#zhipuai)) that conform to the OpenAI API specification. + +To use OpenAI-Like embedding model providers, you need to provide the **base URL** of the embedding API as the following JSON format in **Advanced Settings**: + +```json +{ + "api_base": "{api_base_url}" +} +``` + +#### ZhipuAI + +For example, the embedding API endpoint for ZhipuAI is: + +`https://open.bigmodel.cn/api/paas/v4/embeddings` + +You need to set up the base URL in the **Advanced Settings** as follows: + +```json +{ + "api_base": "https://open.bigmodel.cn/api/paas/v4" +} +``` + +**Supported Models**: + +| Embedding Model | Vector Dimensions | Max Tokens | +| --------------- | ----------------- | ---------- | +| `embedding-3` | 2048 | 8192 | + +For more information, see the [ZhipuAI embedding models documentation](https://open.bigmodel.cn/dev/api/vector/embedding-3). + +### JinaAI + +JinaAI provides multimodal multilingual long-context Embedding Models for RAG applications. + +**Supported Models**: + +| Embedding Model | Vector Dimensions | Max Tokens | +| -------------------- | ----------------- | ---------- | +| `jina-clip-v1` | 768 | 8192 | +| `jina-embeddings-v3` | 1024 | 8192 | + +For more information, see the [JinaAI embedding models documentation](https://jina.ai/embeddings/). + +### Cohere + +Cohere provides industry-leading large language models (LLMs) and RAG capabilities tailored to meet the needs of enterprise use cases that solve real-world problems. + +**Supported Models**: + +| Embedding Model | Vector Dimensions | Max Tokens | +| ------------------------- | ----------------- | ---------- | +| `embed-multilingual-v3.0` | 1024 | 512 | + +For more information, see the [Cohere Embed documentation](https://docs.cohere.com/docs/cohere-embed). + +### Ollama + +Ollama is a lightweight framework for building and running large language models and embed models locally. + +Ollama supports a variety of [embedding models](https://ollama.com/search?c=embedding), such as: + +| Embedding Model | Vector Dimensions | Max Tokens | +| ------------------ | ----------------- | ---------- | +| `nomic-embed-text` | 768 | 8192 | + +To use Ollama, you'll need to configure the API base URL in the **Advanced Settings**: + +```json +{ + "api_base": "http://localhost:11434" +} +``` + +For more information, see the [Ollama embedding models documentation](https://ollama.com/blog/embedding-models). + +### Local Embedding Server + +Autoflow's local embedding server is a self-hosted embedding service built upon [sentence-transformers](https://www.sentence-transformers.org/) and deployed on your own infrastructure. + +You can choose from a variety of pre-trained models from [Hugging Face](https://huggingface.co/models), such as: + +| Embedding Model | Vector Dimensions | Max Tokens | +| --------------- | ----------------- | ---------- | +| `BAAI/bge-m3` | 1024 | 8192 | -If you want to change the embedding model, you need to: -* Redeploy the RAG app currently. -* Or you can start a discussion in the [GitHub Discussions](https://github.com/pingcap/autoflow/discussions) - +To configure the Local Embedding Service, set the API URL in the **Advanced Settings**: -You can enter the admin panel to view the current embedding model and its configuration. +```json +{ + "api_url": "http://local-embedding-reranker:5001/api/v1/embedding" +} +``` -![embedding-model-config](https://github.com/user-attachments/assets/5cb589c1-3579-417e-9730-dcbe5aee4f84 "Embedding Model Config") diff --git a/frontend/app/src/pages/docs/knowledge-base.mdx b/frontend/app/src/pages/docs/knowledge-base.mdx new file mode 100644 index 000000000..2464b13d1 --- /dev/null +++ b/frontend/app/src/pages/docs/knowledge-base.mdx @@ -0,0 +1,102 @@ +import { Callout } from 'nextra/components' + +# Knowledge Base + +AutoFlow use knowledge base to manage **data sources** and **indexes**. +[Chat engines](/docs/chat-engine) uses documents from knowledge base to answer users question. + +## Configure + +### Create Knowledge Base + +![Image](https://github.com/user-attachments/assets/24e3686b-40f0-4738-8d45-02d9b8c945b0) + +Goto the knowledge base page and click the `New Knowledge Base` button + +![Image](https://github.com/user-attachments/assets/61a332b0-b1de-42f2-a107-6b08c743b12d) + +There are several fields to be filled: + +| Field | Description | Required | Updatable | +|------------------|--------------------------------------------------------------------------------------|----------|-----------| +| Name | The name of the knowledge base. | Yes | Yes | +| Description | Describe the knowledge base. | No | Yes | +| LLM | The LLM used during building vector index and knowledge graph index. | Yes | No | +| Embedding Model | the embedding model used by vector index and knowledge graph index. | Yes | No | +| Indexing Methods | Vector index is forced to be enabled. The knowledge graph index is used by GraphRAG. | Yes | No | + +### Documents Management + +AutoFlow support to view and delete documents uploaded through data source. The default page of knowledge base shows it's documents. + +![Image](https://github.com/user-attachments/assets/878d2809-97a6-4a87-8d3a-3481f8bb863b) + +#### Delete Documents + + + **This operation cannot be undone**. + + Deleting documents will trigger **asynchornize** deletion process related `indexes` and `sub knowledge graphs`. + + +Scroll horizontally to the end of the documents table, click the `...` button and click the `Delete` item on the dropdown menu. + +### Data Source Management + +Each Knowledge Base could contain multiple data sources. You can click the `Data Sources` tab to view all data sources. + +![Image](https://github.com/user-attachments/assets/dc865796-3660-4e25-9218-9ad4efd0fb97) + +AutoFlow support three types of data sources currently: +- File uploads: Markdown (\*.md), PDF (\*.pdf), Microsoft Word (\*.docx), Microsoft PowerPoint (\*.pptx), Microsoft Excel (\*.xlsx) and Text (\*.txt) files. +- Website pages by sitemap +- Certain web wages + +#### Create Data Source + +You can click the button on top of data sources list to create new data sources. + +#### Update Data source + +You can rename data source by click the `Configure` button of data source. + +#### Delete Data source + + + **This operation cannot be undone**. + + Deleting data sources will trigger **asynchornize** deletion process related **documents**, **chunks of vector index** + and **entities and relationships of knowledge + graph index**. + + +You can delete data source by click the `Delete` button of data source. + + +## Indexing + +### Index Methods Introduction + +#### Vector Index + + + TBD + + +#### Knowledge Graph Index + + + TBD + + +### Index Progress + + + TBD + + +#### Failure retry + + + TBD + diff --git a/frontend/app/src/pages/docs/quick-start.mdx b/frontend/app/src/pages/docs/quick-start.mdx index b07ed7b98..d6a500343 100644 --- a/frontend/app/src/pages/docs/quick-start.mdx +++ b/frontend/app/src/pages/docs/quick-start.mdx @@ -4,49 +4,67 @@ Here is a documentation page that shows how to setup a same tool like https://ti ## Step 1: Deployment -As this tool is open source, you can deploy it on your own server. We provide a guide to deploy the entire RAG using Docker Compose. +You can deploy self-hosted Autoflow on your server with Docker Compose. [Read the deployment guide](./deploy-with-docker) ## Step 2: Configure -After deployment, you need to configure the tool to use your own settings. +After deployment, you need to login to the admin dashboard to configure the tool withyour own settings. ### Configure the LLM - Large Language Model -The LLM is used for extracting knowledge from docs and generating responses. You can change the default LLM to another one. +Go to the **Models > LLMs** page to [configure the LLM model](./llm). -[Configure LLM](./llm) +> The LLM is used for extracting knowledge from docs and generating responses. You can change the default LLM to another one. +![Set up LLM model](https://github.com/user-attachments/assets/c343c1bb-1c82-4fab-a3b9-72987d271a45) + ### Configure the Embedding Model -The Embedding Model is a machine learning model that is trained to generate embeddings for a given input. We must translate text to vectors with this model before insert vector to database. +Go to the **Models > Embedding Models** page to [configure the embedding model](./embedding-model). + +> The Embedding Model is a machine learning model that is trained to generate embeddings for a given input. We must translate text to vectors with this model before insert vector to database. -[Configure Embedding Service](./embedding-model) +![Set up Embedding model](https://github.com/user-attachments/assets/2d78b771-d759-481c-a2ef-92333281ff1e) ### Configure the Reranker [Optional] -The Reranker is a machine learning model that is trained to rerank the results retrieved from the database. We use this model to improve performance of answers. +> The Reranker is an essential tool that optimizes the order of results from initial searches. It is optional but recommended. + +Go to the **Models > Rerankers** page to configure [the reranker model](./reranker-model). + +![Set up Reranker](https://github.com/user-attachments/assets/96d187f2-23f6-49fd-a2bb-7c241a438b07) + + +## Step 3: Add a New Knowledge Base and Upload Documents + +Go to the **Knowledge Base** page to add a new knowledge base and upload documents. + +![Add Knowledge Base](https://github.com/user-attachments/assets/f78be4ac-0211-48bf-9706-bb36240414cd) + +After adding a new knowledge base, you can upload your documents from local or crawl from the web in the **Data Source** subpage. + +![Add Data Source to Knowledge Base](https://github.com/user-attachments/assets/506db914-d73a-4625-a119-461fdb73ba8e) -[Configure Reranker](./reranker-model) +> After adding data source, there will be a period of time for indexing the data. -> Note: Reranker is used to improve the performance of the answers. If you don't have a reranker model, you can skip this step. -> But we recommend you to use a reranker model to improve the performance of the answers. +For more details, please refer to [Knowledge Base](./knowledge-base) documentation. +## Step 4: Set up the Chat Engine -## Step 3: Add Data Source +Go to the **Chat Engines** page to [set up the chat engine](./chat-engine). -After deployment and configuration, you need to add data source to the tool for example your own docs, knowledge base, etc. +> The chat engine is used to chat with users. -[Add Data Source](./data-source) +![Set up Chat Engine](https://github.com/user-attachments/assets/2572dc02-ce77-4d2f-a4ba-68bc6858d44c) -> After adding data source, there will be a period of time for the tool to index the data. During this time, the tool will not be able to provide answers to users. -## Step 4: Usage +## Step 5: Usage -After deployment, configuration and adding data source, you can use the tool to chat with users to answer their questions. +After deployment, configuration and uploading documents, you can use the tool to chat with users to answer their questions. pingcap/autoflow provides several features to help you chat with users: diff --git a/frontend/app/src/pages/docs/requirements.mdx b/frontend/app/src/pages/docs/requirements.mdx index 12f08f973..00da2ab86 100644 --- a/frontend/app/src/pages/docs/requirements.mdx +++ b/frontend/app/src/pages/docs/requirements.mdx @@ -3,7 +3,7 @@ In this section, we will cover the requirements for deploying the project. ## Software Requirements -* An [TiDB Serverless Vector](https://pingcap.com/ai) account. +* An [TiDB Serverless](https://pingcap.com/ai) account. * Currently only TiDB Serverless tier has the support for the Vector Search. You can use the free tier with 25GiB storage. We suggest to choose a nearby region to reduce the latency. * TiDB will probably introduce the Vector Search feature to the open source version next quarter, so stay tuned. * Docker Compose, you can install it from [here](https://docs.docker.com/compose/install/). diff --git a/releases/v0.3.0.md b/releases/v0.3.0.md new file mode 100644 index 000000000..5a6aa103b --- /dev/null +++ b/releases/v0.3.0.md @@ -0,0 +1,28 @@ +# Release Notes for v0.3.0 (release candidate) + +## Highlights + +- Rename project to `autoflow` +- Multiple Knowledge Bases support +- Support new embedding models providers + - [Ollama](../embedding-model.mdx#ollama) + - [OpenAI Like](../embedding-model.mdx#openai-like) + - [ZhipuAI](../embedding-model.mdx#zhipuai) + +## Breaking Changes + +- [Knowledge Base](/docs/knowledge-base) + - Deprecate old datasource management. [Manual migration](#manual-migration) is required. + - Support different Embedding Models for each KB + - Individual vector index and knowledge graph index for each KB + - Move vector search and graph search API to knowledge base level + - Move index progress and error retries to knowledge base + +## Improvements + +- Support create chat engine from default config + + +## Manual Migration + +> TBD