From 8cdf10148d12a32e80b82589b069676a39d64282 Mon Sep 17 00:00:00 2001 From: writinwaters <93570324+writinwaters@users.noreply.github.com> Date: Fri, 27 Dec 2024 17:07:31 +0800 Subject: [PATCH] Initial draft of the begin component reference (#4272) ### What problem does this PR solve? ### Type of change - [x] Documentation Update --- agent/templates/general_chat_bot.json | 4 +- .../{agentic_rag => agent}/_category_.json | 0 .../agent_introduction.md | 0 .../general_purpose_chatbot.md | 0 .../{agentic_rag => agent}/text2sql_agent.md | 8 +++ .../agent_component_reference/_category_.json | 2 +- .../agent_component_reference/begin.mdx | 70 +++++++++++++++++++ docs/references/faq.md | 2 +- docs/release_notes.md | 1 + web/src/locales/en.ts | 4 +- .../form/begin-form/begin-dynamic-options.tsx | 2 +- 11 files changed, 86 insertions(+), 7 deletions(-) rename docs/guides/{agentic_rag => agent}/_category_.json (100%) rename docs/guides/{agentic_rag => agent}/agent_introduction.md (100%) rename docs/guides/{agentic_rag => agent}/general_purpose_chatbot.md (100%) rename docs/guides/{agentic_rag => agent}/text2sql_agent.md (99%) rename docs/{guides/agentic_rag => references}/agent_component_reference/_category_.json (90%) create mode 100644 docs/references/agent_component_reference/begin.mdx diff --git a/agent/templates/general_chat_bot.json b/agent/templates/general_chat_bot.json index 6645e9887..331782fa8 100644 --- a/agent/templates/general_chat_bot.json +++ b/agent/templates/general_chat_bot.json @@ -85,7 +85,7 @@ }, "5. chitchatting": { "description": "Regarding the issues of small talk, companionship, sharing, and emotional intimacy.", - "examples": "What's your name?\nAre you female o male.\nWhat a bad day!\nTerrible day.\nHow are you today?\nDo you have boy friend?", + "examples": "What's your name?\nWhat a bad day!\nTerrible day.\nHow are you today?", "to": "Generate:FiveDragonsLay" } }, @@ -637,7 +637,7 @@ }, "5. chitchatting": { "description": "Regarding the issues of small talk, companionship, sharing, and emotional intimacy.", - "examples": "What's your name?\nAre you female o male.\nWhat a bad day!\nTerrible day.\nHow are you today?\nDo you have boy friend?", + "examples": "What's your name?\nWhat a bad day!\nTerrible day.\nHow are you today?", "to": "Generate:FiveDragonsLay" } }, diff --git a/docs/guides/agentic_rag/_category_.json b/docs/guides/agent/_category_.json similarity index 100% rename from docs/guides/agentic_rag/_category_.json rename to docs/guides/agent/_category_.json diff --git a/docs/guides/agentic_rag/agent_introduction.md b/docs/guides/agent/agent_introduction.md similarity index 100% rename from docs/guides/agentic_rag/agent_introduction.md rename to docs/guides/agent/agent_introduction.md diff --git a/docs/guides/agentic_rag/general_purpose_chatbot.md b/docs/guides/agent/general_purpose_chatbot.md similarity index 100% rename from docs/guides/agentic_rag/general_purpose_chatbot.md rename to docs/guides/agent/general_purpose_chatbot.md diff --git a/docs/guides/agentic_rag/text2sql_agent.md b/docs/guides/agent/text2sql_agent.md similarity index 99% rename from docs/guides/agentic_rag/text2sql_agent.md rename to docs/guides/agent/text2sql_agent.md index aa8766f82..da0d35a97 100644 --- a/docs/guides/agentic_rag/text2sql_agent.md +++ b/docs/guides/agent/text2sql_agent.md @@ -4,8 +4,11 @@ slug: /text2sql_agent --- # Create a Text2SQL agent + Build a Text2SQL agent leverging RAGFlow's RAG capabilities. Contributed by @TeslaZY. + ## Scenario + The Text2SQL agent is designed to bridge the gap between Natural Language Processing (NLP) and Structured Query Language (SQL). Its key advantages are as follows: - **Assisting non-technical users with SQL**: Not all users have a background in SQL or understand the structure of the tables involved in queries. With a Text2SQL agent, users can pose questions or request data in natural language without needing an in-depth knowledge of the database structure or SQL syntax. @@ -35,9 +38,11 @@ A list of components required: - ExeSQL ## Procedure + ### Preparation of Data #### Database Environment + Mysql-8.0.39 #### Database Table Creation Statements @@ -261,7 +266,9 @@ CREATE TABLE OrderDetails ( ![DDL knowledge base](https://github.com/user-attachments/assets/2c073e1b-8fdd-443e-98ca-4fd36f9d93e0) #### Configure DB_Description Knowledge Base + 1. the content of the DB_Description text is as follows: +2. ```markdown ### Customers (Customer Information Table) The Customers table records detailed information about different customers in the online store. Here is the meaning of each field within this table: @@ -294,6 +301,7 @@ The OrderDetails table provides detailed information about each item in an order - Quantity: The number of units of the product ordered. - TotalPrice: The total price for this particular item in the order, calculated as UnitPrice * Quantity. ``` + 2. set the chunk data for the DB_Description knowledge base ![DB_Description knowledge base](https://github.com/user-attachments/assets/0e3f1cad-dd67-4d7c-ae2d-b31ca3be664d) #### Configure Q->SQL Knowledge Base diff --git a/docs/guides/agentic_rag/agent_component_reference/_category_.json b/docs/references/agent_component_reference/_category_.json similarity index 90% rename from docs/guides/agentic_rag/agent_component_reference/_category_.json rename to docs/references/agent_component_reference/_category_.json index 503831131..28678a5fb 100644 --- a/docs/guides/agentic_rag/agent_component_reference/_category_.json +++ b/docs/references/agent_component_reference/_category_.json @@ -1,6 +1,6 @@ { "label": "Agent Component Reference", - "position": 1, + "position": 3, "link": { "type": "generated-index", "description": "A complete reference for RAGFlow's agent components." diff --git a/docs/references/agent_component_reference/begin.mdx b/docs/references/agent_component_reference/begin.mdx new file mode 100644 index 000000000..701835fed --- /dev/null +++ b/docs/references/agent_component_reference/begin.mdx @@ -0,0 +1,70 @@ +--- +sidebar_position: 1 +slug: /begin_component +--- + +# Begin component + +The starting component in a workflow. + +--- + +The **Begin** component sets an opening greeting or accepts inputs from the user. It is automatically populated onto the canvas when you create an agent, whether from a template or from scratch (from a blank template). There should be only one **Begin** component in the workflow. + +## Scenarios + +A **Begin** component is essential in all cases. Every agent includes a **Begin** component, which cannot be deleted. + +## Configurations + +Click the component to display its **Configuration** window. Here, you can set an opening greeting and the input parameters (global variables) for the agent. + +### ID + +The ID is the unique identifier for the component within the workflow. Unlike the IDs of other components, the ID of the **Begin** component *cannot* be changed. + +### Opening greeting + +An opening greeting is the agent's first message to the user. It can be a welcoming remark or an instruction to guide the user forward. + +### Global variables + +You can set global variables within the **Begin** component, which can be either required or optional. Once established, users will need to provide values for these variables when interacting or with the agent. Click **+ Add variable** to add a global variable, each with the following attributes: + +- **Key**: *Required* + The unique variable name. +- **Name**: *Required* + A descriptive name providing additional details about the variable. + For example, if **Key** is set to `lang`, you can set its **Name** to `Target language`. +- **Type**: *Required* + The type of the variable: + - **line**: Accepts a single line of text without line breaks. + - **paragraph**: Accepts multiple lines of text, including line breaks. + - **options**: Requires the user to select a value for this variable from a dropdown menu. And you are required to set *at least* one option for the dropdown menu. + - **file**: Requires the user to upload a file from their device. + - **integer**: Accepts an integer as input. + - **boolean**: Requires the user to toggle between on and off. +- **Optional**: A toggle indicating whether the variable is optional. + +## Examples + +As mentioned earlier, the **Begin** component is indispensable for an agent. Still, you can take a look at our three-step interpreter agent, where the **Begin** component takes two global variables: + +1. Click the **Agent** tab in the middle top of the page to show the **Agent** page. +2. Click **+ Create agent** on the top right of the page to show the **agent template** page. +3. On the **agent template** page, hover over the card on **Interperter** and click **Use this template**. +4. Name the new agent and click **OK** to enter the workflow editor. +5. Click the **Begin** component to display its **Configuration** window. + +## Frequently asked questions + +### Is the uploaded file in a knowledge base? + +No. Files uploaded to an agent as input are not stored in a knowledge base and will not be chunked using RAGFlow's built-in chunk methods. However, RAGFlow's built-in OSR, DLR, and TSR models will still be applied to process the document. + +### File size limit for uploaded file + +The maximum file size for each uploaded file is determined by the variable `MAX_CONTENT_LENGTH` in `/docker/.env`. It defaults to 128 MB. If you change the default file size, ensure you also update the value of `client_max_body_size` in `/docker/nginx/nginx.conf` accordingly. + + + diff --git a/docs/references/faq.md b/docs/references/faq.md index 8be0c86aa..c0de02945 100644 --- a/docs/references/faq.md +++ b/docs/references/faq.md @@ -1,5 +1,5 @@ --- -sidebar_position: 3 +sidebar_position: 10 slug: /faq --- diff --git a/docs/release_notes.md b/docs/release_notes.md index 8587bd657..0c146748e 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -21,6 +21,7 @@ Released on December 25, 2024. This release fixes the following issues: - The `SCORE not found` and `position_int` errors returned by [Infinity](https://github.com/infiniflow/infinity). +- Once an embedding model in a specific knowledge base is changed, embedding models in other knowledge bases can no longer be changed. - Slow response in question-answering and AI search due to repetitive loading of the embedding model. - Fails to parse documents with RAPTOR. - Using the **Table** parsing method results in information loss. diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 040bcbd56..99624e743 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -350,7 +350,7 @@ The above is the content you need to summarize.`, language: 'Language', emptyResponse: 'Empty response', emptyResponseTip: `Set this as a response if no results are retrieved from the knowledge bases for your query, or leave this field blank to allow the LLM to improvise when nothing is found.`, - setAnOpener: 'Set an opener', + setAnOpener: 'Opening greeting', setAnOpenerInitial: `Hi! I'm your assistant, what can I do for you?`, setAnOpenerTip: 'Set an opening greeting for users.', knowledgeBases: 'Knowledge bases', @@ -677,7 +677,7 @@ The above is the content you need to summarize.`, msg: 'Messages', messagePlaceholder: 'message', messageMsg: 'Please input message or delete this field.', - addField: 'Add field', + addField: 'Add option', addMessage: 'Add message', loop: 'Loop', loopTip: diff --git a/web/src/pages/flow/form/begin-form/begin-dynamic-options.tsx b/web/src/pages/flow/form/begin-form/begin-dynamic-options.tsx index b68a13d5b..bcc9c5788 100644 --- a/web/src/pages/flow/form/begin-form/begin-dynamic-options.tsx +++ b/web/src/pages/flow/form/begin-form/begin-dynamic-options.tsx @@ -55,7 +55,7 @@ const BeginDynamicOptions = () => { icon={} block > - Add field + Add option