Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

general_purpose_chatbot.md 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. ---
  2. sidebar_position: 2
  3. slug: /general_purpose_chatbot
  4. ---
  5. # Create chatbot
  6. Create a general-purpose chatbot.
  7. ---
  8. :::danger DEPRECATED!
  9. A new version is coming soon.
  10. :::
  11. Chatbot is one of the most common AI scenarios. However, effectively understanding user queries and responding appropriately remains a challenge. RAGFlow's general-purpose chatbot agent is our attempt to tackle this longstanding issue.
  12. This chatbot closely resembles the chatbot introduced in [Start an AI chat](../chat/start_chat.md), but with a key difference - it introduces a reflective mechanism that allows it to improve the retrieval from the target knowledge bases by rewriting the user's query.
  13. This document provides guides on creating such a chatbot using our chatbot template.
  14. ## Prerequisites
  15. 1. Ensure you have properly set the LLM to use. See the guides on [Configure your API key](../models/llm_api_key_setup.md) or [Deploy a local LLM](../models/deploy_local_llm.mdx) for more information.
  16. 2. Ensure you have a knowledge base configured and the corresponding files properly parsed. See the guide on [Configure a knowledge base](../dataset/configure_knowledge_base.md) for more information.
  17. 3. Make sure you have read the [Introduction to Agentic RAG](./agent_introduction.md).
  18. ## Create a chatbot agent from template
  19. To create a general-purpose chatbot agent using our template:
  20. 1. Click the **Agent** tab in the middle top of the page to show the **Agent** page.
  21. 2. Click **+ Create agent** on the top right of the page to show the **agent template** page.
  22. 3. On the **agent template** page, hover over the card on **General-purpose chatbot** and click **Use this template**.
  23. *You are now directed to the **no-code workflow editor** page.*
  24. ![workflow_editor](https://github.com/user-attachments/assets/52e7dc62-4bf5-4fbb-ab73-4a6e252065f0)
  25. :::tip NOTE
  26. RAGFlow's no-code editor spares you the trouble of coding, making agent development effortless.
  27. :::
  28. ## Understand each component in the template
  29. Here’s a breakdown of each component and its role and requirements in the chatbot template:
  30. - **Begin**
  31. - Function: Sets an opening greeting for users.
  32. - Purpose: Establishes a welcoming atmosphere and prepares the user for interaction.
  33. - **Interact**
  34. - Function: Serves as the interface between human and the bot.
  35. - Role: Acts as the downstream component of **Begin**.
  36. - **Retrieval**
  37. - Function: Retrieves information from specified knowledge base(s).
  38. - Requirement: Must have `knowledgebases` set up to function.
  39. - **Relevant**
  40. - Function: Assesses the relevance of the retrieved information from the **Retrieval** component to the user query.
  41. - Process:
  42. - If relevant, it directs the data to the **Generate** component for final response generation.
  43. - Otherwise, it triggers the **Rewrite** component to refine the user query and redo the retrival process.
  44. - **Generate**
  45. - Function: Prompts the LLM to generate responses based on the retrieved information.
  46. - Note: The prompt settings allow you to control the way in which the LLM generates responses. Be sure to review the prompts and make necessary changes.
  47. - **Rewrite**:
  48. - Function: Refines a user query when no relevant information from the knowledge base is retrieved.
  49. - Usage: Often used in conjunction with **Relevant** and **Retrieval** to create a reflective/feedback loop.
  50. ## Configure your chatbot agent
  51. 1. Click **Begin** to set an opening greeting:
  52. ![opener](https://github.com/user-attachments/assets/4416bc16-2a84-4f24-a19b-6dc8b1de0908)
  53. 2. Click **Retrieval** to select the right knowledge base(s) and make any necessary adjustments:
  54. ![setting_knowledge_bases](https://github.com/user-attachments/assets/5f694820-5651-45bc-afd6-cf580ca0228d)
  55. 3. Click **Generate** to configure the LLM's summarization behavior:
  56. 3.1. Confirm the model.
  57. 3.2. Review the prompt settings. If there are variables, ensure they match the correct component IDs:
  58. ![prompt_settings](https://github.com/user-attachments/assets/19e94ea7-7f62-4b73-b526-32fcfa62f1e9)
  59. 4. Click **Relevant** to review or change its settings:
  60. *You may retain the current settings, but feel free to experiment with changes to understand how the agent operates.*
  61. ![relevant_settings](https://github.com/user-attachments/assets/9ff7fdd8-7a69-4ee2-bfba-c7fb8029150f)
  62. 5. Click **Rewrite** to select a different model for query rewriting or update the maximum loop times for query rewriting:
  63. ![choose_model](https://github.com/user-attachments/assets/2bac1d6c-c4f1-42ac-997b-102858c3f550)
  64. ![loop_time](https://github.com/user-attachments/assets/09a4ce34-7aac-496f-aa59-d8aa33bf0b1f)
  65. :::danger NOTE
  66. Increasing the maximum loop times may significantly extend the time required to receive the final response.
  67. :::
  68. 1. Update your workflow where you see necessary.
  69. 2. Click to **Save** to apply your changes.
  70. *Your agent appears as one of the agent cards on the **Agent** page.*
  71. ## Test your chatbot agent
  72. 1. Find your chatbot agent on the **Agent** page:
  73. ![find_chatbot](https://github.com/user-attachments/assets/6e6382c6-9a86-4190-9fdd-e363b7f64ba9)
  74. 2. Experiment with your questions to verify if this chatbot functions as intended:
  75. ![test_chatbot](https://github.com/user-attachments/assets/c074d3bd-4c39-4b05-a68b-1fd361f256b3)