{"id":20535,"date":"2024-09-26T10:03:20","date_gmt":"2024-09-26T02:03:20","guid":{"rendered":"https:\/\/www.1ai.net\/?p=20535"},"modified":"2024-09-26T10:03:25","modified_gmt":"2024-09-26T02:03:25","slug":"%e7%be%8e%e5%9b%be%ef%bc%9a%e5%a5%87%e6%83%b3%e5%a4%a7%e6%a8%a1%e5%9e%8b%e5%8d%87%e7%ba%a7%e8%a7%86%e9%a2%91%e7%94%9f%e6%88%90%e8%83%bd%e5%8a%9b","status":"publish","type":"post","link":"https:\/\/www.1ai.net\/en\/20535.html","title":{"rendered":"You can easily get started with the Dify open-source large model development platform, the combination of Agent and RAG to create a proprietary AI intelligent workbench"},"content":{"rendered":"<p>Dify is an AI app for building<a href=\"https:\/\/www.1ai.net\/en\/tag\/%e5%bc%80%e6%ba%90\" title=\"[View articles tagged with [open source]]\" target=\"_blank\" >Open Source<\/a>Dify is a platform that combines the concepts of Backend as Service and LLMOps, and supports multiple large language models such as Claude3 and OpenAI. It supports a variety of large-scale language models, such as Claude3, OpenAI, etc., and cooperates with multiple model vendors to ensure that developers can choose the most suitable model according to their needs.Dify greatly reduces the complexity of AI application development by providing powerful dataset management functions, visual Prompt orchestration and application operation tools.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20650\" title=\"9685923dj00skedde000yd000qo00dum\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/9685923dj00skedde000yd000qo00dum.jpg\" alt=\"9685923dj00skedde000yd000qo00dum\" width=\"960\" height=\"498\" \/><\/p>\n<p><strong>Dify<\/strong><\/p>\n<p><em><strong>one,<\/strong><\/em><em><strong>Dify<\/strong><\/em><\/p>\n<p>What is Dify (Define &amp; Modify)? Dify is an open source Large Language Model (LLM) application!<a href=\"https:\/\/www.1ai.net\/en\/tag\/%e5%bc%80%e5%8f%91%e5%b9%b3%e5%8f%b0\" title=\"_Other Organiser\" target=\"_blank\" >development platform (computing)<\/a>, designed to simplify and accelerate the creation and deployment of generative AI applications. The platform combines the concepts of Backend as Service (BaaS) and LLMOps to provide developers with a user-friendly interface and a range of powerful tools that enable them to rapidly build production-grade AI applications.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20651\" title=\"e3971ffej00skedde000pd000u000frm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/e3971ffej00skedde000pd000u000frm.jpg\" alt=\"e3971ffej00skedde000pd000u000frm\" width=\"1080\" height=\"567\" \/><\/p>\n<p><strong>Dify<\/strong><\/p>\n<ol>\n<li>Low code\/no code development: Dify allows, through visualization, to<strong>Developers Easily Define Prompts, Contexts, and Plugins<\/strong>etc., without going into the underlying technical details.<\/li>\n<li>Modular design: Dify adopts a modular design.<strong>Each module has clear functions and interfaces<\/strong>, developers can selectively use these modules to build their AI applications according to their needs.<\/li>\n<li>Rich Functional Components: the platform provides including AI workflows,<a href=\"https:\/\/www.1ai.net\/en\/tag\/rag\" title=\"[SEE ARTICLES WITH [RAG] LABELS]\" target=\"_blank\" >RAG<\/a>Pipeline,<a href=\"https:\/\/www.1ai.net\/en\/tag\/agent\" title=\"[View articles tagged with [Agent]]\" target=\"_blank\" >Agent<\/a>The company's rich set of functional components, such as model management, helps developers move from prototype to production.<\/li>\n<li>Support for multiple large language models: Dify has supported mainstream models, developers are able to choose the most suitable model to build AI applications according to their needs.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20653\" title=\"ec3b0201j00skedde001id000u000f7m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/ec3b0201j00skedde001id000u000f7m.jpg\" alt=\"ec3b0201j00skedde001id000u000f7m\" width=\"1080\" height=\"547\" \/><\/p>\n<p><strong>Dify offers four types of applications built on LLM that can be optimized and customized for different application scenarios and needs.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20652\" title=\"8cb9a65ej00skedde001md000u000cam\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/8cb9a65ej00skedde001md000u000cam.jpg\" alt=\"8cb9a65ej00skedde001md000u000cam\" width=\"1080\" height=\"442\" \/><\/p>\n<p><strong>Dify<\/strong><\/p>\n<ol>\n<li>Chat Assistant (Chat Assistant):<\/li>\n<\/ol>\n<ul>\n<li>LLM-based conversational assistants are able to interact with the user in natural language, understand the user's questions, requests or commands, and give appropriate answers or perform appropriate actions.<\/li>\n<\/ul>\n<ol>\n<li>Text Generation:<\/li>\n<\/ol>\n<ul>\n<li>Specializes in a variety of text generation tasks such as writing stories, news reports, copywriting, poetry, and other creative writing, as well as tasks such as text categorization and translation.<\/li>\n<\/ul>\n<ol>\n<li>Agent:<\/li>\n<\/ol>\n<ul>\n<li>Such assistants are not only conversational, but also have task<strong>Decomposition, reasoning, tool invocation<\/strong>and other advanced capabilities. It is able to understand complex instructions, decompose the task into multiple subtasks, and invoke the appropriate tools or APIs to accomplish these subtasks.<\/li>\n<\/ul>\n<ol>\n<li>Workflow:<\/li>\n<\/ol>\n<ul>\n<li>Flexibly organize and control the workflow of LLM based on user-defined process choreography. Users can customize a series of operational steps and logical judgments to allow LLM to perform tasks in accordance with a predetermined process.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20654\" title=\"d69548cej00skedde001od000u000c3m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/d69548cej00skedde001od000u000c3m.jpg\" alt=\"d69548cej00skedde001od000u000c3m\" width=\"1080\" height=\"435\" \/><\/p>\n<p><em><strong>II. Dify + RAG<\/strong><\/em><\/p>\n<p>How to Upload Documents to the Dify Knowledge BaseBuilding a RAGThe process of uploading documents to the Dify Knowledge Base involves multiple steps, from document selection, preprocessing, indexing schema selection, to retrieval setups, and is designed to build an efficient and intelligent knowledge retrieval system.<\/p>\n<p>1. Create a knowledge base: Dify \"Knowledge\" in the main navigation bar, in this page you can see the existing knowledge base.<\/p>\n<ul>\n<li>Create a new knowledge base: drag and drop or select files to upload, batch uploads are supported, but the number is limited by the subscription plan.<\/li>\n<li>Empty Knowledge Base Option: You can choose to create an empty knowledge base if no documents have been prepared yet.<\/li>\n<li>External Data Sources: When using an external data source (such as Notion or Site Synchronization), the knowledge base type will be fixed and it is recommended to create separate knowledge bases for each data source.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20655\" title=\"4df698d4j00skedde000ud000u000f3m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/4df698d4j00skedde000ud000u000f3m.jpg\" alt=\"4df698d4j00skedde000ud000u000f3m\" width=\"1080\" height=\"543\" \/><\/p>\n<p>2. Text pre-processing and cleaning: after the content is uploaded to the knowledge base, chunking and data cleaning are required, and this stage can be understood as the pre-processing and structuring of the content.<\/p>\n<ul>\n<li>Auto Mode: Dify automatically splits and cleans up content to streamline the document preparation process.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20656\" title=\"45ff98a2j00skedde000nd000hs007rm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/45ff98a2j00skedde000nd000hs007rm.jpg\" alt=\"45ff98a2j00skedde000nd000hs007rm\" width=\"640\" height=\"279\" \/><\/p>\n<ul>\n<li>Custom Mode: For situations where finer control is required, Custom Mode can be selected for manual adjustment.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20657\" title=\"874cea73j00skedde0020d000u000hym\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/874cea73j00skedde0020d000u000hym.jpg\" alt=\"874cea73j00skedde0020d000u000hym\" width=\"1080\" height=\"646\" \/><\/p>\n<p>3. Indexing mode: Choose the appropriate indexing mode according to the application scenario, such as high-quality mode, economic mode or question-and-answer mode.<\/p>\n<ul>\n<li>High-quality mode: using Embedding model to convert text into numerical vectors, supporting vector search, full-text search and hybrid search.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20658\" title=\"5a2709a1j00skedde0029d000u000xxm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/5a2709a1j00skedde0029d000u000xxm.jpg\" alt=\"5a2709a1j00skedde0029d000u000xxm\" width=\"1080\" height=\"1221\" \/><\/p>\n<ul>\n<li>Economic model: offline vector engine and keyword indexing are used, which reduces the accuracy but eliminates the additional token consumption and related costs.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20659\" title=\"4d48593fj00skedde002kd000u00126m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/4d48593fj00skedde002kd000u00126m.jpg\" alt=\"4d48593fj00skedde002kd000u00126m\" width=\"1080\" height=\"1374\" \/><\/p>\n<ul>\n<li><strong>Q&amp;A mode:<\/strong>The system performs text segmentation and generates QA Q&amp;A pairs for each paragraph by way of summarization.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20660\" title=\"6c25b6b2j00skedde0028d000u000jem\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/6c25b6b2j00skedde0028d000u000jem.jpg\" alt=\"6c25b6b2j00skedde0028d000u000jem\" width=\"1080\" height=\"698\" \/><\/p>\n<p>4. Retrieve settings:<\/p>\n<p><strong>(1) In high-quality indexing mode, Dify provides three search settings: vector search, full-text search, and hybrid search.<\/strong><\/p>\n<ul>\n<li>Vector search: vectorize the query, calculate the distance to the text vectors in the knowledge base, and identify the closest block of text.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20661\" title=\"a6a2be93j00skedde000nd000u000c2m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/a6a2be93j00skedde000nd000u000c2m.jpg\" alt=\"a6a2be93j00skedde000nd000u000c2m\" width=\"1080\" height=\"434\" \/><\/p>\n<ul>\n<li>Full-text search: Search based on keyword matching.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20662\" title=\"72c823f5j00skedde000qd000km00bdm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/72c823f5j00skedde000qd000km00bdm.jpg\" alt=\"72c823f5j00skedde000qd000km00bdm\" width=\"742\" height=\"409\" \/><\/p>\n<ul>\n<li>Hybrid search: combining the advantages of vector and full-text search.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20663\" title=\"48b8826bj00skedde001fd000t000i6m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/48b8826bj00skedde001fd000t000i6m.jpg\" alt=\"48b8826bj00skedde001fd000t000i6m\" width=\"1044\" height=\"654\" \/><\/p>\n<ul>\n<li>Rerank model: semantic reordering of retrieval results to optimize sorting results.<\/li>\n<\/ul>\n<p><strong>(2) In economic indexing mode, Dify provides a single search setting: inverted index and TopK.<\/strong><\/p>\n<ul>\n<li>Inverted index: an index structure designed for quick retrieval of keywords in a document.<\/li>\n<li>TopK and Score Threshold: set the number of retrieved results and the similarity threshold.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20664\" title=\"8eeac68dj00skedde000id000u0008tm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/8eeac68dj00skedde000id000u0008tm.jpg\" alt=\"8eeac68dj00skedde000id000u0008tm\" width=\"1080\" height=\"317\" \/><\/p>\n<p><em><strong>III. Dify + Agent<\/strong><\/em><\/p>\n<p>How to build Agent on Dify platform?On Dify platform, Agent creation and deployment is realized by selecting model, writing hints, adding tools and knowledge base, configuring inference mode and conversation opener, and finally debugging preview and publishing as webapp.<\/p>\n<p>1. Explore and integrate application templates<\/p>\n<p>The Dify platform offers a rich Explore section, which contains several Agent Assistant application templates. Users can integrate these templates directly into their workspace to get started quickly. It also allows users to create custom agent assistants to meet specific individual or organizational needs.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20665\" title=\"1766b1b5j00skedde0014d000u000icm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/1766b1b5j00skedde0014d000u000icm.jpg\" alt=\"1766b1b5j00skedde0014d000u000icm\" width=\"1080\" height=\"660\" \/><\/p>\n<p>2. Selection of a reasoning model<\/p>\n<p>The task completion ability of an agent assistant depends heavily on the reasoning ability of the selected LLM model. It is recommended to use a more powerful family of models, such as GPT-4, to obtain more stable and accurate task completion results.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20666\" title=\"24ba3c38j00skedde001wd000u000icm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/24ba3c38j00skedde001wd000u000icm.jpg\" alt=\"24ba3c38j00skedde001wd000u000icm\" width=\"1080\" height=\"660\" \/><\/p>\n<p>3. Writing tips and setting up processes<\/p>\n<p>In the \"Instructions\" section, the user can write detailed information about the agent assistant's task objectives, workflow, required resources, constraints and other prompts. This information will help the agent assistant better understand and perform the task.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20667\" title=\"05f2f66cj00skedde001md000u000hgm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/05f2f66cj00skedde001md000u000hgm.jpg\" alt=\"05f2f66cj00skedde001md000u000hgm\" width=\"1080\" height=\"628\" \/><\/p>\n<p>4. Adding tools and knowledge bases<\/p>\n<ul>\n<li>Tools Integration: In the Tools section, users can add a variety of built-in or customized tools to enhance the functionality of the Agent Assistant. These tools can include Internet searching, scientific computing, image creation, and more to help the Agent Assistant interact more richly with the real world.<\/li>\n<li>Knowledgebase: In the Context section, users can integrate knowledgebase tools to provide agent assistants with external background knowledge and information retrieval capabilities.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20668\" title=\"117fbb86j00skedde001ed000u000icm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/117fbb86j00skedde001ed000u000icm.jpg\" alt=\"117fbb86j00skedde001ed000u000icm\" width=\"1080\" height=\"660\" \/><\/p>\n<p>5. Reasoning model settings<\/p>\n<p>Dify supports two inference modes: Function Calling and ReAct.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20669\" title=\"9f5504caj00skedde001ad000u000icm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/9f5504caj00skedde001ad000u000icm.jpg\" alt=\"9f5504caj00skedde001ad000u000icm\" width=\"1080\" height=\"660\" \/><\/p>\n<ul>\n<li>Function Calling: For models that support this mode (e.g. GPT-3.5, GPT-4), it is recommended to use this mode for better and more stable performance.<\/li>\n<li>ReAct: For model families that do not support Function Calling, Dify provides the ReAct inference framework as an alternative to achieve similar functionality.<\/li>\n<\/ul>\n<p>6. Configuring dialog openers<\/p>\n<p>The user can set up conversation openers and initial questions for the agent assistant to show the types of tasks it can perform and examples of questions it can ask when the user first interacts with the agent assistant.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20670\" title=\"151194f3j00skedde001pd000u000icm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/151194f3j00skedde001pd000u000icm.jpg\" alt=\"151194f3j00skedde001pd000u000icm\" width=\"1080\" height=\"660\" \/><\/p>\n<p>7. Debugging and previewing<\/p>\n<p>Before publishing the Agent Assistant as an application, users can debug and preview it on the Dify platform to evaluate its effectiveness and accuracy in accomplishing tasks.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20671\" title=\"d6688e25j00skedde001ud000u000ibm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/d6688e25j00skedde001ud000u000ibm.jpg\" alt=\"d6688e25j00skedde001ud000u000ibm\" width=\"1080\" height=\"659\" \/><\/p>\n<p>8. Application release<\/p>\n<p>Once the Agent Assistant is configured and debugged, users can publish it as a web application (webapp) for wider use. This will make the features and services of the Agent Assistant available to a wider group of users across platforms and devices.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20672\" title=\"08a46141j00skedde001md000u000icm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/09\/08a46141j00skedde001md000u000icm.jpg\" alt=\"08a46141j00skedde001md000u000icm\" width=\"1080\" height=\"660\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>Dify is an open source platform for building AI applications.Dify combines Backend as Service and LLMOps concepts. It supports a variety of large-scale language models, such as Claude3, OpenAI, etc., and cooperates with multiple model vendors to ensure that developers can choose the most suitable model according to their needs.Dify greatly reduces the complexity of AI application development by providing powerful dataset management features, visual Prompt orchestration, and application operation tools. Dify I. Dify What is Dify (Define &amp; Modify) Dify is an open source Large Language Model (LLM) application development platform designed to simplify and accelerate the<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[144],"tags":[1405,449,4487,4488,219],"collection":[],"class_list":["post-20535","post","type-post","status-publish","format-standard","hentry","category-baike","tag-agent","tag-dify","tag-rag","tag-4488","tag-219"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/20535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/comments?post=20535"}],"version-history":[{"count":0,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/20535\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/media?parent=20535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/categories?post=20535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/tags?post=20535"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/collection?post=20535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}