diff --git a/docs.json b/docs.json index 852b356c..6d4e8037 100644 --- a/docs.json +++ b/docs.json @@ -158,6 +158,18 @@ "en/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods" ] }, + { + "group": "Create from Knowledge Pipeline", + "pages": [ + "en/guides/knowledge-base/knowledge-pipeline/readme", + "en/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline", + "en/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration", + "en/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline", + "en/guides/knowledge-base/knowledge-pipeline/upload-files", + "en/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base", + "en/guides/knowledge-base/knowledge-pipeline/authorize-data-source" + ] + }, { "group": "Manage Knowledge", "pages": [ @@ -782,6 +794,18 @@ "zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods" ] }, + { + "group": "通过知识流水线创建知识库", + "pages": [ + "zh-hans/guides/knowledge-base/knowledge-pipeline/readme", + "zh-hans/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline", + "zh-hans/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration", + "zh-hans/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline", + "zh-hans/guides/knowledge-base/knowledge-pipeline/upload-files", + "zh-hans/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base", + "zh-hans/guides/knowledge-base/knowledge-pipeline/authorize-data-source" + ] + }, { "group": "管理知识库", "pages": [ @@ -1453,6 +1477,18 @@ "ja-jp/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods" ] }, + { + "group": "ナレッジパイプライン", + "pages": [ + "ja-jp/guides/knowledge-base/knowledge-pipeline/readme", + "ja-jp/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline", + "ja-jp/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration", + "ja-jp/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline", + "ja-jp/guides/knowledge-base/knowledge-pipeline/upload-files", + "ja-jp/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base", + "ja-jp/guides/knowledge-base/knowledge-pipeline/authorize-data-source" + ] + }, { "group": "ナレッジベースの管理", "pages": [ diff --git a/en/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx b/en/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx new file mode 100644 index 00000000..6f6854f0 --- /dev/null +++ b/en/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx @@ -0,0 +1,100 @@ +--- +title: Authorize Data Source +--- + +Dify supports connections to various external data sources. To ensure data security and access control, different data sources require appropriate authorization configurations. Dify provides two main authorization methods: **API Key** and **OAuth**. + +## Accessing Data Source Authorization + +In Dify, you can access data source authorization through the following two methods: + +### I. Knowledge Pipeline Orchestration +When orchestrating a knowledge pipeline, select the data source node that requires authorization. Click **Connect** on the right panel. + +![Knowledge Pipeline Authorization](/images/knowledge-base/authorize-data-1.PNG) + +### II. Settings +Click your avatar in the upper right corner and select **Settings**. Navigate to **Data Sources** and find the data source you wish to authorize. + +![Settings Authorization](/images/knowledge-base/authorize-data-2.PNG) + +## Supported Data Source Authorization + +| Data Source | API Key | OAuth | +|-----------------|---------|-------| +| Notion | ✅ | ✅ | +| Jina Reader | ✅ | | +| Firecrawl | ✅ | | +| Google Drive | | ✅ | +| Dropbox | | ✅ | +| OneDrive | | ✅ | + +## Authorization Processes + +### API Key Authorization +API Key authorization is a key-based authentication method suitable for enterprise-level services and developer tools. You need to generate API Keys from the corresponding service providers and configure them in Dify. + +#### Process +1. On the **Data Source** page, navigate to the corresponding data source. Click **Configure** and then **Add API Key**. + + ![Add API Key](/images/knowledge-base/authorize-data-3.PNG) + +2. In the pop-up window, fill in the **Authorization Name** and **API Key**. Click **Save** to complete the setup. + + ![API Key Configuration](/images/knowledge-base/authorize-data-4.png) + +The API key will be securely encrypted. Once completed, you can start using the data source (e.g., Jina Reader) for knowledge pipeline orchestration. + +![API Key Complete](/images/knowledge-base/authorize-data-6.png) + +### OAuth Authorization +OAuth is an open standard authorization protocol that allows users to authorize third-party applications to access their resources on specific service providers without exposing passwords. + +#### Process +1. On the **Data Source** page, select an OAuth-supported data source. Click **Configure** and then **Add OAuth**. + + ![Add OAuth](/images/knowledge-base/authorize-data-7.png) + +2. Review the permission scope and click **Allow Access**. + +
+
+ ![OAuth Permissions](/images/knowledge-base/authorize-data-8.png) +
+
+ ![OAuth Allow](/images/knowledge-base/authorize-data-9.png) +
+
+ +#### OAuth Client Settings +Dify provides two OAuth client configuration methods: **Default** and **Custom**. + +![OAuth Client Settings](/images/knowledge-base/authorize-data-10.png) + + + + The default client is primarily supported in the SaaS version, using OAuth client parameters that are pre-configured and maintained by Dify. Users can add OAuth credentials with one click without additional configuration. + + + Custom client is supported across all versions of Dify. Users need to register OAuth applications on third-party platforms and obtain client parameters themselves. This is mainly suitable for data sources that don't have default configuration in the SaaS version, or when enterprises have special security compliance requirements. + + + +**Process for Custom OAuth** +1. On the **Data Source** page, select an OAuth-supported data source. Click **Configure** and then the **Setting icon** on the right side of **Add OAuth**. + + ![Custom OAuth Settings](/images/knowledge-base/authorize-data-11.png) + +2. Choose **Custom**, enter the **Client ID** and **Client Secret**. Click **Save and Authorize** to complete the authorization. + + ![Custom OAuth Configuration](/images/knowledge-base/authorize-data-12.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) diff --git a/en/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx b/en/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx new file mode 100644 index 00000000..1db0fc74 --- /dev/null +++ b/en/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx @@ -0,0 +1,74 @@ +--- +title: "Step 1: Create Knowledge Pipeline" +--- + +![Create Knowledge Pipeline](/images/knowledge-base/create-knowledge-pipeline-1.png) + +Navigate to Knowledge at the top, then click Create from Knowledge Pipeline on the left. There're three ways for you to get started. + +### Build from Scratch + +![Build from Scratch](/images/knowledge-base/create-knowledge-pipeline-2.png) + +Click Blank Knowledge Pipeline to build a custom pipeline from scratch. Choose this option when you need custom processing strategies based on specific data source and business requirements. + +### Templates +Dify offers two types of templates: **Built-in Pipeline** and **Customized**. Both template cards display name of knowledge base, description, and tags (including chunk structure). + +![](/images/knowledge-base/create-knowledge-pipeline-4-1.png) + +#### Built-in Pipeline +Built-in pipelines are official knowledge base templates pre-configured by Dify. These templates are optimized for common document structures and use cases. Simply click **Choose** to get started. + +![Built-in Templates](/images/knowledge-base/create-knowledge-pipeline-4.png) + +**Types** +| Name | Chunk Structure | Index Method | Retrieval Setting | Description | +|------|-----------------|--------------|-------------------|-------------| +| General Mode-ECO | General | Economical | Inverted Index | Divide document content into smaller paragraphs, directly used for matching user queries and retrieval. | +| Parent-child-HQ | Parent-Child | High Quality | Hybrid Search | Adopt advanced chunking strategy, dividing document text into larger parent chunks and smaller child chunks. The parent chunks contain child chunks which ensure both retrieval precision and maintain contextual integrity. | +| Simple Q&A | Question & Answer | High Quality | Vector Search | Convert tabular data into question-answer format, using question matching to quickly hit corresponding answer information. | +| Complex PDF with Images & Tables | Parent-child | High Quality | Hybrid Search - Weighted Score | Extract image and table content from PDF files. | +| Contextual Enrichment Using LLM | Parent-child | High Quality | Hybrid Search - Weighted Score | Extract images and tables from documents and automatically generate descriptive annotations by using large language models, achieving intelligent contextual enhancement. | +| Convert to Markdown | Parent-child | High Quality | Hybrid Search - Weighted Score | Designed for Office native file formats such as DOCX, XLSX, and PPTX, converting them to Markdown format for better information processing. ⚠️ Note: PDF files are not recommended. | +| LLM Generated Q&A | Question & Answer | High Quality | Vector Search | Generate structured question-answer pairs with large language models based on original text paragraphs. Find relevant answer by using question matching mechanism. | + +To preview the selected built-in pipeline, click **Details** on any template card. Then, check information in the popup window, including: orchestration structure, pipeline description, and chunk structure. Click **Use this Knowledge Pipeline** for orchestration. + +![Template Details](/images/knowledge-base/create-knowledge-pipeline-5.png) + +#### Customized + +![Customized Templates](/images/knowledge-base/create-knowledge-pipeline-6.png) + +Customized templates are user-created and published knowledge pipeline. You can choose a template to start, export the DSL, or view detailed information for any template. + +![Template Actions](/images/knowledge-base/create-knowledge-pipeline-7.png) + +To create a knowledge base from a template, click **Choose** on the template card. You can also create knowledge base by clicking **Use this Knowledge Pipeline** when previewing a template. Click **More** to edit pipeline information, export pipeline, or delete the template. + +### Import Pipeline + +![Import DSL](/images/knowledge-base/create-knowledge-pipeline-3.png) + +Import a pipeline of a previously exported knowledge pipeline to quickly reuse existing configurations and modify them for different scenarios or requirements. Navigate to the bottom left of the page and click **Import from a DSL File**. Dify DSL is a YAML-based standard that defines AI application configurations, including model parameters, prompt design, and workflow orchestration. Similar to workflow DSL, knowledge pipeline uses the same YAML format standard to define processing workflows and configurations within a knowledge base. + +What's in a knowledge pipeline DSL: + +| Name | Description | +|-------------------------|-------------------------------------------------------------------| +| Data Sources | Local files, websites, online documents, online drive, web crawler| +| Data Processing | Document extraction, content chunking, cleaning strategies | +| Knowledge Configuration | Indexing methods, retrieval settings, storage parameters | +| Node Orchestration | Arrangement and sequence | +| User Input Form | Custom parameter fields (if configured) | + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) diff --git a/en/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx b/en/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx new file mode 100644 index 00000000..337d80ab --- /dev/null +++ b/en/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx @@ -0,0 +1,524 @@ +--- +title: "Step 2: Knowledge Pipeline Orchestration" +--- + +Imagine setting up a factory production line where each station (node) performs a specific task, and you connect them to assemble widgets into a final product. This is knowledge pipeline orchestration—a visual workflow builder that allows you to configure data processing sequences through a drag-and-drop interface. It provides control over document ingestion, processing, chunking, indexing, and retrieval strategies. + +In this section, you'll learn about the knowledge pipeline process, understand different nodes, how to configure them, and customize your own data processing workflows to efficiently manage and optimize your knowledge base. + +### Interface Status + +When entering the knowledge pipeline orchestration canvas, you’ll see: +- **Tab Status**: Documents, Retrieval Test, and Settings tabs will be grayed out and unavailable at the moment +- **Essential Steps**: You must complete knowledge pipeline orchestration and publishing before uploading files + +Your starting point depends on the template choice you made previously. If you chose **Blank Knowledge Pipeline**, you'll see a canvas that contains Knowledge Base node only. There'll be a note with guide next to the node that walks you through the general steps of pipeline creation. + +![Blank Pipeline](/images/knowledge-base/create-knowledge-pipeline-8.png) + +If you selected a specific pipeline template, there'll be a ready-to-use workflow that you can use or modify on the canvas right away. + +![Template Pipeline](/images/knowledge-base/create-knowledge-pipeline-9.png) + +## The Complete Knowledge Pipeline Process + +Before we get started, let's break down the knowledge pipeline process to understand how your documents are transformed into a searchable knowledge base. + +The knowledge pipeline includes these key steps: + + + Data Source → Data Processing (Extractor + Chunker) → Knowledge Base Node (Chunk Structure + Retrieval Setting) → User Input Field → Test & Publish + + +1. **Data Source**: Content from various data sources (local files, Notion, web pages, etc.) +2. **Data Processing**: Process and transform data content + - Extractor: Parse and structure document content + - Chunker: Split structured content into manageable segments +3. **Knowledge Base**: Set up chunk structure and retrieval settings +4. **User Input Field**: Define parameters that pipeline users need to input for data processing +5. **Test & Publish**: Validate and officially activate the knowledge base + +--- + +## Step 1: Data Source + +In a knowledge base, you can choose single or multiple data sources. Currently, Dify supports 4 types of data sources: **file upload, online drive, online documents, and web crawler**. + +Visit the [Dify Marketplace](https://marketplace.dify.ai) for more data sources. + +### File Upload + +Upload local files through drag-and-drop or file selection. + +
+
+ ![](/images/knowledge-base/knowledge-pipeline-orchestration-1.PNG) +
+
+ **Configuration Options** + + | Item | Description | + |----------------|-----------------------------------------------------------------------------| + | File Format | Support PDF, XLSX, DOCX, etc. Users can customize their selection | + | Upload Method | Upload local files or folders through drag-and-drop or file selection. Batch upload is supported. | + + **Limitations** + + | Item | Description | + |--------------|-----------------------------------------------------------------------------| + | File Quantity| Maximum 50 files per upload | + | File Size | Each file must not exceed 15MB | + | Storage | Limits on total document uploads and storage space may vary for different SaaS subscription plans | + + **Output Variables** + + | Output Variable | Format | + |-----------------|------------------| + | `{x} Document` | Single document | +
+
+--- + +### Online Doc + +#### Notion + +Integrate with your Notion workspace to seamlessly import pages and databases, always keeping your knowledge base automatically updated. + +
+
+ ![Notion](/images/knowledge-base/knowledge-pipeline-orchestration-2.PNG) +
+
+ **Configuration Options** + + | Item | Option | Output Variable | Description | + |------------|-----------|-----------------|------------------------------------------| + | Extractor | Enabled | `{x} Content` | Structured and processed information | + | | Disabled | `{x} Document` | Original text | +
+
+--- + +### Web Crawler + +Transform web content into formats that can be easily read by large language models. The knowledge base supports Jina Reader and Firecrawl. + +#### Jina Reader + +An open-source web parsing tool providing simple and easy-to-use API services, suitable for fast crawling and processing web content. + +
+
+ ![Jina Reader](/images/knowledge-base/knowledge-pipeline-orchestration-3.png) +
+
+ **Parameter Configuration** + + | Parameter | Type | Description | + |----------------|-----------|--------------------------------------| + | URL | Required | Target webpage address | + | Crawl sub-page | Optional | Whether to crawl linked pages | + | Use sitemap | Optional | Crawl by using website sitemap | + | Limit | Required | Set maximum number of pages to crawl | + | Enable Extractor | Optional | Choose data extraction method | +
+
+ +#### Firecrawl + +An open-source web parsing tool that provides more refined crawling control options and API services. It supports deep crawling of complex website structures, recommended for batch processing and precise control. + +
+
+ ![](/images/knowledge-base/knowledge-pipeline-orchestration-4.png) +
+
+ **Parameter Configuration** + + | Parameter | Type | Description | + |-------------------------|-----------|---------------------------------------------------------------| + | URL | Required | Target webpage address | + | Limit | Required | Set maximum number of pages to crawl | + | Crawl sub-page | Optional | Whether to crawl linked pages | + | Max depth | Optional | How many levels deep the crawler will traverse from the starting URL | + | Exclude paths | Optional | Specify URL patterns that should not be crawled | + | Include only paths | Optional | Crawl specified paths only | + | Extractor | Optional | Choose data processing method | + | Extract Only Main Content | Optional | Isolate and retrieve the primary, meaningful text and media from a webpage | +
+
+ +--- + +### Online Drive + +Connect your online cloud storage services (e.g., Google Drive, Dropbox, OneDrive) and let Dify automatically retrieve your files. Simply select and import the documents you need for processing, without manually downloading and re-uploading files. + + +Need help with authorization? Please check [Authorize Data Source](/en/guides/knowledge-base/knowledge-pipeline/authorize-data-source) for detailed guidance on authorizing different data sources. + + +--- + +## Step 2: Set Up Data Processing Tools + +In this stage, these tools extract, chunk, and transform the content for optimal knowledge base storage and retrieval. Think of this step like meal preparation. We clean raw materials up, chop them into bite-sized pieces, and organize everything, so the dish can be cooked up quickly when someone orders it. + +### Doc Processor + +Documents come in different formats - PDF, XLSX, DOCX. However, LLM can't read these files directly. That's where extractors come in. They support multiple formats and handle the conversion, so your content is ready for the next step of the LLMs. + +You can choose Dify's Doc Extractor to process files, or select tools based on your needs from Marketplace which offers Dify Extractor and third-party tools like MinerU, Unstructured, and more. + +#### Doc Extractor + +![](/images/knowledge-base/knowledge-pipeline-orchestration-4-1.png) + +As an information processing center, document extractor node identifies and reads files from input variables, extracts information, and finally converts them into a format that works with the next node. + + +For more information, please refer to the [Document Extractor](/en/guides/workflow/node/doc-extractor). + + +#### Dify Extractor + +Dify Extractor is a built-in document parser presented by Dify. It supports multiple common file formats and is specially optimized for Doc files. It can extract and store images from documents and return image URLs. + +![Dify Extractor](/images/knowledge-base/knowledge-pipeline-orchestration-5.png) + +#### MinerU + +
+
+ ![MinerU](/images/knowledge-base/knowledge-pipeline-orchestration-6.png) +
+
+ [MinerU](https://marketplace.dify.ai/plugins/langgenius/mineru) is a high-quality document parser that converts documents into machine-readable formats (Markdown, JSON) with a focus on preserving complex structures and mathematical notations. + + Compared with basic PDF extractors, MinerU removes headers, footers, and page numbers while preserving semantic coherence. It also automatically detects scanned PDFs and garbled documents, enabling OCR functionality for 84 languages. Try MinerU with scientific papers with complex formulas (auto converts to LaTex), multi-column layouts, academic publications documents with mixed content (text + images + tables). +
+
+ +#### Unstructured + +
+
+ ![Unstructured](/images/knowledge-base/knowledge-pipeline-orchestration-7.png) +
+
+ [Unstructured](https://marketplace-staging.dify.dev/plugins/langgenius/unstructured) transforms documents into structured, machine-readable formats with highly customizable processing strategies. It offers multiple extraction strategies (auto, hi_res, fast, OCR-only) and chunking methods (by_title, by_page, by_similarity) to handle diverse document types, offering detailed element-level metadata including coordinates, confidence scores, and layout information. It’s recommended for enterprise document workflows, processing of mixed file types, and cases that require precise control over document processing parameters. +
+
+ + +Explore more tools in the [Dify Marketplace](https://marketplace.dify.ai). + + +--- + +### Chunker + +Similar to human limited attention span, large language models cannot process huge amount of information simultaneously. Therefore, after information extraction, the chunker splits large document content into smaller and manageable segments (called "chunks"). + +Different documents require different chunking strategies. A product manual works best when split by product features, while research papers should be divided by logical sections. Dify offers 3 types of chunkers for various document types and use cases. + +#### Overview of Different Chunkers + +| Chunker Type | Highlights | Best for | +|----------------------|----------------------------------------------|---------------------------------------------------| +| General Chunker | Fixed-size chunks with customizable delimiters | Simple documents with basic structure | +| Parent-child Chunker | Dual-layer structure: precise matching + rich context | Complex documents requiring rich context preservation | +| Q&A Processor | Processes question-answer pairs from spreadsheets | Structured Q&A data from CSV/Excel files | + +#### Common Text Pre-processing Rules + +All chunkers support these text cleaning options: + +| Preprocessing Option | Description | +|------------------------------------------|-------------------------------------------------------------------| +| Replace consecutive spaces, newlines and tabs | Clean up formatting by replacing multiple whitespace characters with single spaces | +| Remove all URLs and email addresses | Automatically detect and remove web links and email addresses from text | + +#### General Chunker + +Basic document chunking processing, suitable for documents with relatively simple structures. You can configure text chunking and text preprocessing rules according to the following configuration. + +**Input and Output Variable** + +| Type | Variable | Description | +|----------------|-----------------|-------------------------------------------------------------------| +| Input Variable | `{x} Content` | Complete document content that the chunker will split into smaller segments | +| Output Variable | `{x} Array[Chunk]` | Array of chunked content, each segment optimized for retrieval and analysis | + +**Chunk Settings** + +| Configuration Item | Description | +|-------------------------|-----------------------------------------------------------------------------| +| Delimiter | Default value is `\n` (line breaks for paragraph segmentation). You can customize chunking rules following regex. The system will automatically execute segmentation when the delimiter appears in text. | +| Maximum Chunk Length | Specifies the maximum character limit within a segment. When this length is exceeded, forced segmentation will occur. | +| Chunk Overlap | When segmenting data, there is some overlap between segments. This overlap helps improve information retention and analysis accuracy, enhancing recall effectiveness. | + +#### Parent-child Chunker + +By using a dual-layer segmentation structure to resolve the contradiction between context and accuracy, parent-child clunker achieves the balance between precise matching and comprehensive contextual information in Retrieval Augmented Generation (RAG) systems. + +**How Parent-child Chunker Works** + +Child Chunks for query matching: Small, precise information segments (usually single sentences) to match user queries with high accuracy. + +Parent Chunks provide rich context: Larger content blocks (paragraphs, sections, or entire documents) that contain the matching child chunks, giving the large language model (LLM) comprehensive background information. + +| Type | Variable | Description | +|----------------|------------------------|-------------------------------------------------------------------| +| Input Variable | `{x} Content` | Complete document content that the chunker will split into smaller segments | +| Output Variable | `{x} Array[ParentChunk]` | Array of parent chunks | + +**Chunk Settings** + +| Configuration Item | Description | +|------------------------------|-----------------------------------------------------------------------------| +| Parent Delimiter | Set delimiter for parent chunk splitting | +| Parent Maximum Chunk Length | Set maximum character count for parent chunks | +| Child Delimiter | Set delimiter for child chunk splitting | +| Child Maximum Chunk Length | Set maximum character count for child chunks | +| Parent Mode | Choose between Paragraph (split text into paragraphs) or "Full Document" (use entire document as parent chunk) for direct retrieval | + +#### Q&A Processor + +Combining extraction and chunking in one node, Q&A Processor is specifically designed for structured Q&A datasets from CSV and Excel files. Perfect for FAQ lists, shift schedules, and any spreadsheet data with clear question-answer pairs. + +**Input and Output Variable** + +| Type | Variable | Description | +|----------------|-----------------|---------------------------------------| +| Input Variable | `{x} Document` | A single file | +| Output Variable | `{x} Array[QAChunk]` | QA chunk | + +**Variable Configuration** + +| Configuration Item | Description | +|-----------------------------|----------------------------------| +| Column Number for Question |Set content column as question | +| Column Number for Answer |Set column answer as answer | + +--- + +## Step 3: Configure Knowledge Base Node + +Now that your documents are processed and chunked, it's time to set up how they'll be stored and retrieved. Here, you can select different indexing methods and retrieval strategies based on your specific needs. + +Knowledge base node configuration includes: Input Variable, Chunk Structure, Index Method, and Retrieval Settings. + +### Chunk Structure + +![Chunk Structure](/images/knowledge-base/knowledge-pipeline-orchestration-8.png) + +Chunk structure determines how the knowledge base organizes and indexes your document content. Choose the structure mode that best fits your document type, use case, and cost. + +The knowledge base supports three chunk modes: **General Mode, Parent-child Mode, and Q&A Mode**. If you're creating a knowledge base for the first time, we recommend choosing Parent-child Mode. + + +**Important Reminder**: Chunk structure cannot be modified once saved and published. Please choose carefully. + + +#### General Mode + +Suitable for most standard document processing scenarios. It provides flexible indexing options—you can choose appropriate indexing methods based on different quality and cost requirements. + +General mode supports both high-quality and economical indexing methods, as well as various retrieval settings. + +#### Parent-child Mode + +It provides precise matching and corresponding contextual information during retrieval, suitable for professional documents that need to maintain complete context. + +Parent-child mode supports HQ (High Quality) mode only, offering child chunks for query matching and parent chunks for contextual information during retrieval. + +#### Q&A Mode + +Create documents that pair questions with answers when using structured question-answer data. These documents are indexed based on the question portion, enabling the system to retrieve relevant answers based on query similarity. + +Q&A Mode supports HQ (High Quality) mode only. + +### Input Variable + +Input variables receive processing results from data processing nodes as the data source for knowledge base. You need to connect the output from chunker to the knowledge base as input. + +The node supports different types of standard inputs based on the selected chunk structure: +- **General Mode**: {x} Array[Chunk] - General chunk array +- **Parent-child Mode**: {x} Array[ParentChunk] - Parent chunk array +- **Q&A Mode**: {x} Array[QAChunk] - Q&A chunk array + +### Index Method & Retrieval Setting + +The index method determines how your knowledge base builds content indexes, while retrieval settings provide corresponding retrieval strategies based on the selected index method. Think of it in this way: index method determines how to organize your documents, while retrieval settings tell users what methods they can use to find documents. + +The knowledge base provides two index methods: **High Quality** and **Economy**, each offering different retrieval setting options. + +High quality mode uses embedding models to convert segmented text blocks into numerical vectors, helping to compress and store large amounts of text information more effectively. This enables the system to find semantically relevant accurate answers even when the user's question wording doesn't exactly match the document. + +In economy mode, each block uses 10 keywords for retrieval without calling embedding models, generating no costs. + + +Please refer to [Select the Indexing Method and Retrieval Setting](/en/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods) for more details. + + +#### Index Methods and Retrieval Settings + +| Index Method | Available Retrieval Settings | Description | +|--------------|------------------------------|-----------------------------------------------------------------------------| +| High Quality | Vector Retrieval | Understand deeper meaning of queries based on semantic similarity | +| | Full-text Retrieval | Keyword-based retrieval providing comprehensive search capabilities | +| | Hybrid Retrieval | Combine both semantic and keywords | +| Economy | Inverted Index | Common search engine retrieval method, matches queries with key content | + +You can also refer to the table below for information on configuring chunk structure, indexing methods, parameters, and retrieval settings. + +| Chunk Structure | Index Methods | Parameters | Retrieval Settings | +|-------------------|--------------------|--------------------|-------------------------------------| +| General mode | High Quality


Economy | Embedding Model


Number of Keywords | Vector Retrieval
Full-text Retrieval
Hybrid Retrieval
Inverted Index | +| Parent-child Mode | High Quality Only | Embedding Model | Vector Retrieval
Full-text Retrieval
Hybrid Retrieval | +| Q&A Mode | High Quality Only | Embedding Model | Vector Retrieval
Full-text Retrieval
Hybrid Retrieval | + +--- + +## Step 4: Create User Input Form + +User input forms are essential for collecting the initial information your pipeline needs to run effectively. Similar to [start node](/en/guides/workflow/node/start) in workflow, this form gathers necessary details from users - such as files to upload, specific parameters for document processing - ensuring your pipeline has all the information it needs to deliver accurate results. + +This way, you can create specialized input forms for different use scenarios, improving pipeline flexibility and usability for various data sources or document processing steps. + +### Create User Input Form + +There're two ways to create user input field: + +1. **Pipeline Orchestration Interface** + Click on the **Input field** to start creating and configuring input forms. + ![](/images/knowledge-base/knowledge-pipeline-orchestration-9.png) + +2. **Node Parameter Panel** + Select a node. Then, in parameter input on the right-side panel, click + Create user input for new input items. New input items will also be collected in the Input Field. + ![](/images/knowledge-base/knowledge-pipeline-orchestration-10.png) + +### Add User Input Fields + +#### Unique Inputs for Each Entrance + +![](/images/knowledge-base/knowledge-pipeline-orchestration-11.png) + +These inputs are specific to each data source and its downstream nodes. Users only need to fill out these fields when selecting the corresponding data source, such as different URLs for different data sources. + +**How to create**: Click the `+` button on the right side of a data source to add fields for that specific data source. These fields can only be referenced by that data source and its subsequently connected nodes. +![](/images/knowledge-base/knowledge-pipeline-orchestration-12.png) + +#### Global Inputs for All Entrances + +![](/images/knowledge-base/knowledge-pipeline-orchestration-13.png) + +Global shared inputs can be referenced by all nodes. These inputs are suitable for universal processing parameters, such as delimiters, maximum chunk length, document processing configurations, etc. Users need to fill out these fields regardless of which data source they choose. + +**How to create**: Click the `+` button on the right side of Global Inputs to add fields that can be referenced by any node. + +### Supported Input Field Types + +The knowledge pipeline supports seven types of input variables: + +
+
+ ![](/images/knowledge-base/knowledge-pipeline-orchestration-14.png) +
+
+ | Field Type | Description | + |-------------|-----------------------------------------------------------------------------| + | Text | Short text input by knowledge base users, maximum length 256 characters | + | Paragraph | Long text input for longer character strings | + | Select | Fixed options preset by the orchestrator for users to choose from, users cannot add custom content | + | Boolean | Only true/false values | + | Number | Only accepts numerical input | + | Single | Upload a single file, supports multiple file types (documents, images, audio, and other file types) | + | File List | Batch file upload, supports multiple file types (documents, images, audio, and other file types) | +
+
+ + +For more information about supported field types, please refer to the [Input Fields documentation](/en/guides/workflow/node/start#input-field). + + +### Field Configuration Options + +All input field types include: required, optional, and additional settings. You can set whether fields are required by checking the appropriate option. + +| Setting | Name | Description | Example | +|-----------------------|---------------|-----------------------------------------------------------------------------|------------------------------------------| +| Required Settings | Variable Name | Internal system identifier, usually named using English and underscores | `user_email` | +| | Display Name | Interface display name, usually concise and readable text | User Email | +| Type-specific Settings | | Special requirements for different field types | Text field max length 100 characters | +| Additional Settings | Default Value | Default value when user hasn't provided input | Number field defaults to 0, text field defaults to empty | +| | Placeholder | Hint text displayed when input box is empty | "Please enter your email" | +| | Tooltip | Explanatory text to guide user input, usually displayed on mouse hover | "Please enter a valid email address" | +| Special Optional Settings | | Additional setting options based on different field types | Validation of email format | + +After completing configuration, click the preview button in the upper right corner to browse the form preview interface. You can drag and adjust field groupings. If an exclamation mark appears, it indicates that the reference is invalid after moving. + +![](/images/knowledge-base/knowledge-pipeline-orchestration-15.png) + +--- + +## Step 5: Name the Knowledge Base + +![Name Knowledge Base](/images/knowledge-base/create-knowledge-pipeline-11.png) + +By default, the knowledge base name will be "Untitled + number", permissions are set to "Only me", and the icon will be an orange book. If you import it from a DSL file, it will use the saved icon. + +Edit knowledge base inforamtion by clicking **Settings** in the left panel and fill in the information below: +- **Name & Icon** + Pick a name for your knowledge base. + Choose an emoji, upload an image, or paste an image URL as the icon of this knowledge base. +- **Knowledge Description** + Provide a brief description of your knowledge base. This helps the AI better understand and retrieve your data. If left empty, Dify will apply the default retrieval strategy. +- **Permissions** + Select the appropriate access permissions from the dropdown menu. + +--- + +## Step 6: Testing + +You're almost there! This is the final step of the knowledge pipeline orchestration. + +After completing the orchestration, you need to validate all the configuration first. Then, do some running tests and confirm all the settings. Finally, publish the knowledge pipeline. + +### Configuration Completeness Check + +Before testing, it's recommended to check the completeness of your configuration to avoid test failures due to missing configurations. + +Click the checklist button in the upper right corner, and the system will display any missing parts. + +![](/images/knowledge-base/knowledge-pipeline-orchestration-16.png) + +After completing all configurations, you can preview the knowledge base pipeline's operation through test runs, confirm that all settings are accurate, and then proceed with publishing. + +### Test Run + +![](/images/knowledge-base/knowledge-pipeline-orchestration-17.png) + +1. **Start Test**: Click the "Test Run" button in the upper right corner +2. **Import Test File**: Import files in the data source window that pops up on the right + + **Important Note**: For better debugging and observation, only one file upload is allowed per test run. + +3. **Fill Parameters**: After successful import, fill in corresponding parameters according to the user input form you configured earlier +4. **Start Test Run**: Click next step to start testing the entire pipeline + +During testing, you can access [History Logs](/en/guides/workflow/debug-and-preview/history-and-logs#application-run-history) (track all run records with timestamps, execution status, and input/output summaries) and [Variable Inspector](/en/guides/workflow/debug-and-preview/variable-inspect) (a dashboard at the bottom showing input/output data for each node to help identify issues and verify data flow) for efficient troubleshooting and error fixing. + +![Testing Tools](/images/knowledge-base/knowledge-pipeline-orchestration-18.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/en/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx b/en/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx new file mode 100644 index 00000000..73d87650 --- /dev/null +++ b/en/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx @@ -0,0 +1,24 @@ +--- +title: "Step 5: Manage and Use Knowledge Base" +--- + +After creating your knowledge base, continuous management and optimization will provide accurate contextual information for your applications. These are the options for follow-up maintenance. + +### Knowledge Pipeline +View and modify your orchestrated pipeline nodes and configurations. + + +Find more information in [Manage Knowledge](/en/guides/knowledge-base/knowledge-and-documents-maintenance/introduction). + + +![Knowledge Management](/images/knowledge-base/create-knowledge-pipeline-21.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/en/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx b/en/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx new file mode 100644 index 00000000..744b7361 --- /dev/null +++ b/en/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx @@ -0,0 +1,50 @@ +--- +title: "Step 3: Publish Knowledge Pipeline" +--- + +After completing pipeline orchestration and debugging, click **Publish** and **Confirm** in the pop-up window. + +
+
+ ![Publish Confirmation](/images/knowledge-base/create-knowledge-pipeline-12-1.png) +
+
+ ![Publish Success](/images/knowledge-base/create-knowledge-pipeline-12.png) +
+
+ + +Important reminder: Once published, the chunk structure cannot be modified. + + +
+
+ ![Publish Complete](/images/knowledge-base/create-knowledge-pipeline-13.png) +
+
+ Once it is published, you can:

+ + **Add Documents (Go to add documents)** + Click this option to jump to the knowledge base data source selection interface, where you can directly upload documents.

+ + **Access API (Access API Reference)** + Go to the API documentation page where you can get the knowledge base API calling methods and instructions.

+ + **Publish as a Knowledge Pipeline** + you can optionally use **Publish as a Knowledge Pipeline** to save it as a reusable template that will appear in the Customized section for future use. +
+
+ + +Limitation: **Publish as a Knowledge Pipeline** is not available in Sandbox plan. To save and publish as a knowledge pipeline, please [upgrade](https://dify.ai/pricing) to professional or team plans. + + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/en/guides/knowledge-base/knowledge-pipeline/readme.mdx b/en/guides/knowledge-base/knowledge-pipeline/readme.mdx new file mode 100644 index 00000000..5f65a5eb --- /dev/null +++ b/en/guides/knowledge-base/knowledge-pipeline/readme.mdx @@ -0,0 +1,51 @@ +--- +title: Create from Knowledge Pipeline +--- + +A knowledge pipeline is a document processing workflow that transforms raw data into searchable knowledge bases. Think of orchestrating a workflow, now you can visually combine and configure different processing nodes and tools to optimize data processing for better accuracy and relevance. + +Every knowledge pipeline normally follows a structured flow through four key steps: + +**Data Sources → Data Extraction → Data Processing → Knowledge Storage** + +Each step serves a specific purpose: gathering content from various sources, converting it to processable text, refining it for search, and storing it in a format that enables fast, accurate retrieval. + +Dify provides built-in pipeline templates that is optimized for certain use cases, or you can also create knowledge pipelines from scratch. In this session, we will go through creating options, general process of building knowledge pipelines, and how to manage it. + + + + + Start from built-in templates, blank knowledge pipeline or import existing pipeline. + + + + + Get to know how the knowledge pipeline works, orchestrate different nodes and make sure it’s ready to use. + + + + + Let's make it ready for document processing. + + + + + Add documents and process them into the searchable knowledge base. + + + + + Maintain documents, test retrieval, modify settings, and more. + + + + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/knowledge-base/knowledge-pipeline/create-from-knowledge-pipeline.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/en/guides/knowledge-base/knowledge-pipeline/upload-files.mdx b/en/guides/knowledge-base/knowledge-pipeline/upload-files.mdx new file mode 100644 index 00000000..5f783aae --- /dev/null +++ b/en/guides/knowledge-base/knowledge-pipeline/upload-files.mdx @@ -0,0 +1,58 @@ +--- +title: "Step 4: Upload Files" +--- + +After publishing knowledge pipeline, there're two ways to upload files as below: + +A: Click **Go to Documents** in the success notification to add or manage documents. After entering Documents page, click **Add File** to upload. + +
+
+ ![Option A-1](/images/knowledge-base/create-knowledge-pipeline-14.png) +
+
+ ![Option A-2](/images/knowledge-base/create-knowledge-pipeline-15.png) +
+
+ +B: Click **Go to Add Documents** to add documents. + +
+
+ ![Option B-1](/images/knowledge-base/create-knowledge-pipeline-16.png) +
+
+ ![Option B-2](/images/knowledge-base/create-knowledge-pipeline-17.png) +
+
+ +### Upload Process + +1. **Select Data Source** + Choose from the data source types configured in your pipeline. Dify currently supports 4 types of data sources: File Upload (pdf, docx, etc.), Online Drive (Google Drive, OneDrive, etc.), Online Doc (Notion), and Web Crawler (Jina Reader, Firecrawl). + Please visit [Dify Marketplace](https://marketplace.dify.ai/) to install additional data sources. + +2. **Fill in Processing Parameters and Preview** + If you configured user input fields during pipeline orchestration, users will need to fill in the required parameters and variables at this step. After completing the form, click **Preview** to see chunking results. Click **Save & Process** to complete knowledge base creation and start data processing. + + Important reminder: Chunk structure remains consistent with the pipeline configuration and won't change with user input parameters. + + ![Parameter Input](/images/knowledge-base/create-knowledge-pipeline-18.png) + +3. **Process Documents** + Track the progress of document processing. After embedding is completed, click **Go to Document**. + ![Processing Progress](/images/knowledge-base/create-knowledge-pipeline-19.png) + +4. **Access Documents List** + Click **Go to Documents** to view the Documents page, where you can browse all uploaded file, processing status, etc. + ![Documents List](/images/knowledge-base/create-knowledge-pipeline-20.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/guides/knowledge-base/knowledge-pipeline/upload-files.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/images/knowledge-base/authorize-data-1.PNG b/images/knowledge-base/authorize-data-1.PNG new file mode 100644 index 00000000..f2987fa2 Binary files /dev/null and b/images/knowledge-base/authorize-data-1.PNG differ diff --git a/images/knowledge-base/authorize-data-10.png b/images/knowledge-base/authorize-data-10.png new file mode 100644 index 00000000..1dde570a Binary files /dev/null and b/images/knowledge-base/authorize-data-10.png differ diff --git a/images/knowledge-base/authorize-data-11.png b/images/knowledge-base/authorize-data-11.png new file mode 100644 index 00000000..3bc84dc5 Binary files /dev/null and b/images/knowledge-base/authorize-data-11.png differ diff --git a/images/knowledge-base/authorize-data-12.png b/images/knowledge-base/authorize-data-12.png new file mode 100644 index 00000000..2ecc3ad8 Binary files /dev/null and b/images/knowledge-base/authorize-data-12.png differ diff --git a/images/knowledge-base/authorize-data-2.PNG b/images/knowledge-base/authorize-data-2.PNG new file mode 100644 index 00000000..b8384492 Binary files /dev/null and b/images/knowledge-base/authorize-data-2.PNG differ diff --git a/images/knowledge-base/authorize-data-3.PNG b/images/knowledge-base/authorize-data-3.PNG new file mode 100644 index 00000000..b5abe7bd Binary files /dev/null and b/images/knowledge-base/authorize-data-3.PNG differ diff --git a/images/knowledge-base/authorize-data-4.png b/images/knowledge-base/authorize-data-4.png new file mode 100644 index 00000000..6d61ce42 Binary files /dev/null and b/images/knowledge-base/authorize-data-4.png differ diff --git a/images/knowledge-base/authorize-data-6.png b/images/knowledge-base/authorize-data-6.png new file mode 100644 index 00000000..c23dc6b0 Binary files /dev/null and b/images/knowledge-base/authorize-data-6.png differ diff --git a/images/knowledge-base/authorize-data-7.png b/images/knowledge-base/authorize-data-7.png new file mode 100644 index 00000000..2c8151e9 Binary files /dev/null and b/images/knowledge-base/authorize-data-7.png differ diff --git a/images/knowledge-base/authorize-data-8.png b/images/knowledge-base/authorize-data-8.png new file mode 100644 index 00000000..6f2a25bb Binary files /dev/null and b/images/knowledge-base/authorize-data-8.png differ diff --git a/images/knowledge-base/authorize-data-9.png b/images/knowledge-base/authorize-data-9.png new file mode 100644 index 00000000..004f17ce Binary files /dev/null and b/images/knowledge-base/authorize-data-9.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-1.png b/images/knowledge-base/create-knowledge-pipeline-1.png new file mode 100644 index 00000000..e05926bb Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-1.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-11.png b/images/knowledge-base/create-knowledge-pipeline-11.png new file mode 100644 index 00000000..eb5bce01 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-11.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-12-1.png b/images/knowledge-base/create-knowledge-pipeline-12-1.png new file mode 100644 index 00000000..4829655e Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-12-1.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-12.png b/images/knowledge-base/create-knowledge-pipeline-12.png new file mode 100644 index 00000000..1d0c059f Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-12.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-13.png b/images/knowledge-base/create-knowledge-pipeline-13.png new file mode 100644 index 00000000..611004ad Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-13.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-14.png b/images/knowledge-base/create-knowledge-pipeline-14.png new file mode 100644 index 00000000..648f84b7 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-14.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-15.png b/images/knowledge-base/create-knowledge-pipeline-15.png new file mode 100644 index 00000000..58046d6f Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-15.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-16.png b/images/knowledge-base/create-knowledge-pipeline-16.png new file mode 100644 index 00000000..7014430c Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-16.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-17.png b/images/knowledge-base/create-knowledge-pipeline-17.png new file mode 100644 index 00000000..e8e5438c Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-17.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-18.png b/images/knowledge-base/create-knowledge-pipeline-18.png new file mode 100644 index 00000000..dca7fdef Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-18.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-19.png b/images/knowledge-base/create-knowledge-pipeline-19.png new file mode 100644 index 00000000..d7d188d6 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-19.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-2.png b/images/knowledge-base/create-knowledge-pipeline-2.png new file mode 100644 index 00000000..728dba8b Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-2.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-20.png b/images/knowledge-base/create-knowledge-pipeline-20.png new file mode 100644 index 00000000..64e85565 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-20.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-21.png b/images/knowledge-base/create-knowledge-pipeline-21.png new file mode 100644 index 00000000..08fe6298 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-21.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-3.png b/images/knowledge-base/create-knowledge-pipeline-3.png new file mode 100644 index 00000000..674d2821 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-3.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-4-1.png b/images/knowledge-base/create-knowledge-pipeline-4-1.png new file mode 100644 index 00000000..22c541e3 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-4-1.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-4.png b/images/knowledge-base/create-knowledge-pipeline-4.png new file mode 100644 index 00000000..8d59599c Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-4.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-5.png b/images/knowledge-base/create-knowledge-pipeline-5.png new file mode 100644 index 00000000..a2c74b9f Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-5.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-6.png b/images/knowledge-base/create-knowledge-pipeline-6.png new file mode 100644 index 00000000..0468bb60 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-6.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-7.png b/images/knowledge-base/create-knowledge-pipeline-7.png new file mode 100644 index 00000000..485c8c84 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-7.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-8.png b/images/knowledge-base/create-knowledge-pipeline-8.png new file mode 100644 index 00000000..ad6333b2 Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-8.png differ diff --git a/images/knowledge-base/create-knowledge-pipeline-9.png b/images/knowledge-base/create-knowledge-pipeline-9.png new file mode 100644 index 00000000..83cbabec Binary files /dev/null and b/images/knowledge-base/create-knowledge-pipeline-9.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-1.PNG b/images/knowledge-base/knowledge-pipeline-orchestration-1.PNG new file mode 100644 index 00000000..02397daf Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-1.PNG differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-10.png b/images/knowledge-base/knowledge-pipeline-orchestration-10.png new file mode 100644 index 00000000..4286a190 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-10.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-11.png b/images/knowledge-base/knowledge-pipeline-orchestration-11.png new file mode 100644 index 00000000..50a7a1fc Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-11.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-12.png b/images/knowledge-base/knowledge-pipeline-orchestration-12.png new file mode 100644 index 00000000..b0e29057 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-12.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-13.png b/images/knowledge-base/knowledge-pipeline-orchestration-13.png new file mode 100644 index 00000000..645b5e31 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-13.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-14.png b/images/knowledge-base/knowledge-pipeline-orchestration-14.png new file mode 100644 index 00000000..221890fc Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-14.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-15.png b/images/knowledge-base/knowledge-pipeline-orchestration-15.png new file mode 100644 index 00000000..2dd4d940 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-15.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-16.png b/images/knowledge-base/knowledge-pipeline-orchestration-16.png new file mode 100644 index 00000000..34aae2a4 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-16.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-17.png b/images/knowledge-base/knowledge-pipeline-orchestration-17.png new file mode 100644 index 00000000..301a0d34 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-17.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-18.png b/images/knowledge-base/knowledge-pipeline-orchestration-18.png new file mode 100644 index 00000000..a302a422 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-18.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-19.png b/images/knowledge-base/knowledge-pipeline-orchestration-19.png new file mode 100644 index 00000000..c43a0f92 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-19.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-2.PNG b/images/knowledge-base/knowledge-pipeline-orchestration-2.PNG new file mode 100644 index 00000000..11273eb2 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-2.PNG differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-3.png b/images/knowledge-base/knowledge-pipeline-orchestration-3.png new file mode 100644 index 00000000..f4edd3cc Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-3.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-4-1.png b/images/knowledge-base/knowledge-pipeline-orchestration-4-1.png new file mode 100644 index 00000000..00b604a1 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-4-1.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-4.png b/images/knowledge-base/knowledge-pipeline-orchestration-4.png new file mode 100644 index 00000000..a3e6e6d9 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-4.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-5.png b/images/knowledge-base/knowledge-pipeline-orchestration-5.png new file mode 100644 index 00000000..b709ec0c Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-5.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-6.png b/images/knowledge-base/knowledge-pipeline-orchestration-6.png new file mode 100644 index 00000000..9ad13671 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-6.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-7.png b/images/knowledge-base/knowledge-pipeline-orchestration-7.png new file mode 100644 index 00000000..b5f39e11 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-7.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-8.png b/images/knowledge-base/knowledge-pipeline-orchestration-8.png new file mode 100644 index 00000000..16a7b0ed Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-8.png differ diff --git a/images/knowledge-base/knowledge-pipeline-orchestration-9.png b/images/knowledge-base/knowledge-pipeline-orchestration-9.png new file mode 100644 index 00000000..301a0d34 Binary files /dev/null and b/images/knowledge-base/knowledge-pipeline-orchestration-9.png differ diff --git a/ja-jp/guides/knowledge-base/connect-external-knowledge-base.mdx b/ja-jp/guides/knowledge-base/connect-external-knowledge-base.mdx index 8e9525b2..e71c8aff 100644 --- a/ja-jp/guides/knowledge-base/connect-external-knowledge-base.mdx +++ b/ja-jp/guides/knowledge-base/connect-external-knowledge-base.mdx @@ -120,7 +120,7 @@ title: 外部ナレッジベースとの接続 DifyはLlamaCloudプラグインを公式に提供しており、LlamaCloudナレッジベースに簡単に接続することができます。 -##### プラグインのインストール +**プラグインのインストール** 1. Difyの[マーケットプレイス](https://marketplace.dify.ai/)にアクセスし、`LlamaCloud`を検索します 2. 指示に従ってLlamaCloudプラグインをインストールおよび設定します @@ -132,7 +132,7 @@ LlamaCloudプラグインを使用すると、カスタムAPIを作成するこ 詳細については、プラグインの[GitHubリポジトリ](https://github.com/langgenius/dify-official-plugins/tree/main/extensions/llamacloud)を参照してください。 -##### ビデオチュートリアル +**ビデオチュートリアル** 以下の動画では、LlamaCloudプラグインを使用して外部ナレッジベースに接続する方法を詳しく説明しています: diff --git a/ja-jp/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx b/ja-jp/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx new file mode 100644 index 00000000..4eac75fe --- /dev/null +++ b/ja-jp/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx @@ -0,0 +1,110 @@ +--- +title: データソース認証 +--- + +Difyは、多様な外部データソースへの接続をサポートしています。データの安全性とアクセス制御を確保するため、各データソースごとに適切な認証設定が必要です。Difyでは主に **APIキー** と **OAuth** の2つの認証方式を提供しており、安全に必要なデータへアクセス・インポートすることが可能です。 + +## データソース認証画面へのアクセス方法 + +Difyでは、以下の2つの方法でデータソースの認証設定にアクセスできます。 + +### I. ナレッジパイプラインの編集画面から + +ナレッジパイプラインの編集画面で、認証が必要なデータソースノードを選択し、画面右側のパネルで **接続**(Connect)をクリックします。 + +![ナレッジパイプライン認証画面](/images/knowledge-base/authorize-data-1.PNG) + +### II. 設定画面から + +画面右上のアバターをクリックして **設定** を選択し、**データソース**に進み、認証したいデータソースを選択してください。 + +![設定画面の認証](/images/knowledge-base/authorize-data-2.PNG) + +## 対応データソースと認証方式 + +| データソース | APIキー | OAuth | +|-----------------|---------|-------| +| Notion | ✅ | ✅ | +| Jina Reader | ✅ | | +| Firecrawl | ✅ | | +| Google Drive | | ✅ | +| Dropbox | | ✅ | +| OneDrive | | ✅ | + +## 認証方式と設定の流れ + +### APIキー認証 + +APIキー認証は、企業向けサービスや開発者ツールに適したキーベースの認証方式です。対応サービスの管理画面などでAPIキーを生成し、Difyに登録して設定を行います。 + +#### 設定手順 + +1. データソースの設定画面で、該当のデータソースを選択し、右側の **設定** をクリックして **APIキーを追加** を選びます。 + + ![APIキー追加](/images/knowledge-base/authorize-data-3.PNG) + +2. ポップアップで「認証名」と「APIキー」を入力し、**保存** をクリックして設定を完了します。 + + ![APIキー設定](/images/knowledge-base/authorize-data-4.png) + +APIキーは暗号化されて安全に保管されます。設定が成功すると「Connected」状態となり、ナレッジパイプライン内で該当データソース(例:Jina Reader)が利用可能になります。 + +![APIキー設定完了](/images/knowledge-base/authorize-data-6.png) + +### OAuth認証 + +OAuthは、パスワードを開示せず、ユーザーが第三者アプリケーションに特定サービス上のリソースへのアクセスを許可できるオープンスタンダードの認証プロトコルです。 + +Difyでは、OAuth認証は**デフォルト設定**と**カスタム設定**の2種類を提供しています。 + +#### 設定手順 + +1. データソース設定画面でOAuth対応のデータソースを選択し、**設定** → **OAuthを追加** をクリックします。 + + ![OAuth追加](/images/knowledge-base/authorize-data-7.png) + +2. 権限範囲を確認し、**アクセスを許可** をクリックします。 + +
+
+ ![OAuth権限確認](/images/knowledge-base/authorize-data-8.png) +
+
+ ![アクセス許可](/images/knowledge-base/authorize-data-9.png) +
+
+ +#### OAuthクライアント設定 + +Difyでは、以下の2種類のOAuthクライアント設定方法を提供しています。 + +![OAuthクライアント設定](/images/knowledge-base/authorize-data-10.png) + + + + SaaS版でのみ利用可能な方式です。Difyが事前に設定・管理するOAuthクライアントパラメータを用い、ワンクリックでOAuth認証情報を追加できます。追加の設定は不要です。 + + + Dify全バージョンで利用可能です。SaaS版でデフォルト設定のないデータソースや、企業のセキュリティポリシーやコンプライアンス要件に応じて、第三者プラットフォームでOAuthアプリを登録し、ご自身でクライアント情報を取得・管理します。 + + + +**カスタムOAuth設定手順** + +1. データソース設定画面で該当データソースを選び、**設定** をクリック。**OAuthを追加** の右側にある **設定アイコン** を選択します。 + + ![カスタムOAuth設定画面](/images/knowledge-base/authorize-data-11.png) + +2. **カスタム** を選択し、**Client ID** と **Client Secret** を入力します。**保存して認証する**(Save and Authorize)をクリックして、OAuth認証を完了します。 + + ![カスタムOAuth設定](/images/knowledge-base/authorize-data-12.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[このページを編集](https://github.com/langgenius/dify-docs/edit/main/ja-jp/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx) | [問題を報告](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) diff --git a/ja-jp/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx b/ja-jp/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx new file mode 100644 index 00000000..53fd0fa8 --- /dev/null +++ b/ja-jp/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx @@ -0,0 +1,79 @@ +--- +title: "ステップ1:ナレッジパイプラインの作成" +--- + +![ナレッジベースパイプラインの作成](/images/knowledge-base/create-knowledge-pipeline-1.png) + +画面上部の**ナレッジベース**をクリックし、左メニューから**ナレッジベースパイプラインから作成**を選択します。開始方法は以下の3通りです。 + +### 1. ゼロから作成する + +![ゼロから構築](/images/knowledge-base/create-knowledge-pipeline-2.png) + +**空白のナレッジベースパイプライン**をクリックすると、カスタムパイプラインを一から構築できます。特定のデータソースやビジネス要件に合わせた処理戦略が必要な場合に選択します。 + +### 2. テンプレートから作成する + +Difyは2種類のテンプレートを提供しています:**内部パイプライン**と**カスタマイズ済み**。どちらもカード上にナレッジベース名、説明、タグ(チャンキング構造など)が表示されます。 + +![](/images/knowledge-base/create-knowledge-pipeline-4-1.png) + +#### 内部パイプライン(Built-in Pipeline) + +内部パイプラインはDify公式があらかじめ用意したナレッジベーステンプレートで、一般的なドキュメント構造やユースケースに最適化されています。使用したいテンプレートの「選択」をクリックするだけで導入できます。 + +![内部テンプレート](/images/knowledge-base/create-knowledge-pipeline-4.png) + +**テンプレートの種類** + +| テンプレート名 | チャンキング構造 | インデックス方式 | 検索設定 | 説明 | +|---------------|------------------|------------------|----------|------| +| 汎用分割モード
(General Mode) | 汎用モード | 省リソース | 逆インデックス | ドキュメントを小さな段落へ分割し、ユーザークエリのマッチングと直接検索に利用されます。 | +| 親子分割モード
(Parent-child Structure) | 親子モード | 高品質 | ハイブリッド検索 | ドキュメントを大きな親チャンクと小さな子チャンクに分割。親チャンクが子チャンクを包含し、検索精度と文脈整合性の両立を実現します。 | +| 簡単なQ&A
(Simple Q&A) | Q&Aモード | 高品質 | ベクター検索 | 表形式データをQ&A形式へと変換し、質問マッチングを通じて迅速に回答が取得できます。 | +| 複雑なPDF(画像やテーブルを含む)
(Complex PDF with Images & Tables) | 親子モード | 高品質 | ハイブリッド検索・重み付けスコア | PDF内の画像や表の内容も抽出可能です。 | +| LLMによる文脈強化
(Contextual Enrichment Using LLM) | 親子モード | 高品質 | ハイブリッド検索・重み付けスコア | ドキュメントから画像や表を抽出し、LLMで説明注釈を自動生成して文脈を高度に強化します。 | +| Markdownへの変換
(Convert to Markdown) | 親子モード | 高品質 | ハイブリッド検索・重み付けスコア | DOCX、XLSX、PPTXほかOfficeファイルをMarkdownへ変換し、情報処理を最適化します。※PDFは推奨されません。 | +| LLMによるQ&Aの自動生成
(LLM Generated Q&A) | Q&Aモード | 高品質 | ベクター検索 | LLMによるQ&Aペアを原文テキストから自動生成し、質問マッチングで関連回答を検索します。 | + +テンプレートカードの「詳細」ボタンをクリックすると、ポップアップでオーケストレーション構造、パイプライン説明、チャンキング構造を確認できます。内容を確認して**このナレッジベースパイプラインを使用**をクリックすれば、そのテンプレートでオーケストレーションを開始できます。 + +![テンプレート詳細](/images/knowledge-base/create-knowledge-pipeline-5.png) + +#### カスタマイズ済み(Customized) + +![カスタマイズ済みテンプレート](/images/knowledge-base/create-knowledge-pipeline-6.png) + +カスタマイズ済みテンプレートはユーザーが作成・公開したナレッジパイプラインです。テンプレートの選択、DSLのエクスポート、詳細情報の確認が可能です。 + +![テンプレート操作](/images/knowledge-base/create-knowledge-pipeline-7.png) + +テンプレートカードの**選択**または詳細プレビューから**このナレッジベースパイプラインを使用**を押せば、そのテンプレートでナレッジベースを作成できます。「…」メニューから、情報編集・ナレッジパイプラインのエクスポート・テンプレート削除も可能です。 + +### 3. ナレッジパイプラインをインポートする + +![ナレッジパイプラインのインポート](/images/knowledge-base/create-knowledge-pipeline-3.png) + +以前にエクスポートしたナレッジパイプラインのDSLファイルをインポートすれば、既存の設定を再利用したり、異なるシナリオ向けに修正を加えたりできます。画面左下の**DSLファイルからインポート**をクリックしてください。 + +ナレッジパイプラインのオーケストレーションが完了したら、ナレッジパイプラインを保存してエクスポートし、他のユーザーと共有できます。ナレッジベースユーザーは、ナレッジパイプラインをインポートすることで、既存のナレッジパイプラインを迅速に再利用し、さまざまなシナリオやニーズに合わせて変更できます。ナレッジパイプラインも同様のYAMLフォーマットでワークフローや構成を定義します。 + +ナレッジパイプラインには、以下のものが含まれます: + +| 項目 | 説明 | +|------|------| +| データソース | ローカルファイル、ウェブサイト、オンラインドキュメント、オンラインドライブ、ウェブクローラー | +| データ処理 | ドキュメント抽出、コンテンツ分割、クリーニング戦略 | +| ナレッジベース設定 | インデックス方式、検索設定、保存パラメータ | +| ノードオーケストレーション | ノードの配置および処理順序(ノードは処理の実行単位です) | +| ユーザー入力フォーム | カスタムパラメータ入力フィールド(設定がある場合) | + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[このページを編集](https://github.com/langgenius/dify-docs/edit/main/ja-jp/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx) | [問題を報告](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) diff --git a/ja-jp/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx b/ja-jp/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx new file mode 100644 index 00000000..21ebf01f --- /dev/null +++ b/ja-jp/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx @@ -0,0 +1,512 @@ +--- +title: ステップ2:ナレッジパイプラインのオーケストレーション +--- + +# ナレッジパイプラインの構築 + +工場の生産ラインを例に考えてみましょう。各ステーション(ノード)が特定の作業を担当し、それらを連携させて部品を組み立て、最終製品を完成させます。ナレッジパイプラインの構築も同様のプロセスです。視覚的なワークフロー設計ツールを使用し、ドラッグ&ドロップ操作だけで容易にデータ処理の流れを設計できます。これにより、ドキュメントの取り込み、処理、分割、インデックス化、検索戦略を自在に管理できます。 + +本ステップでは、ナレッジパイプライン全体のプロセス、各ノードの役割や設定方法について学び、独自のデータ処理フローをカスタマイズして、効率的にナレッジベースを管理・最適化する方法を解説します。 + +### インターフェースの状態 + +オーケストレーションキャンバスに入ると、次の状態を確認できます。 +- **タブの状態**: 「Documents(ドキュメント)」「Retrieval Test(検索テスト)」「Settings(設定)」タブはグレーアウトされ利用不可です。 +- **必要ステップ**:パイプラインのオーケストレーションと公開が完了しないと、ファイルアップロードやその他機能は利用できません。 + +選択したテンプレートによって、初期画面の表示が異なります。 + +**空白ナレッジベースパイプライン**を選択した場合は、ナレッジベースノードだけが配置されたキャンバスが表示され、ノード横のガイドの指示に従って作成を進めます。 + +![空白パイプライン](/images/knowledge-base/create-knowledge-pipeline-8.png) + +**特定のパイプラインテンプレート**を選択した場合は、あらかじめワークフローが組まれた状態でキャンバスに表示され、すぐに利用・編集が可能です。 + +![テンプレートパイプライン](/images/knowledge-base/create-knowledge-pipeline-9.png) + +## ナレッジパイプラインの全体プロセス + +まず、ナレッジパイプラインにおける処理プロセスを分解し、ドキュメントがどのように検索可能なナレッジベースへと変換されるのかを理解しましょう。 + +ナレッジパイプラインは、以下の主要なステップから構成されます: + + +データソース → データ処理(抽出器+分割器)→ ナレッジベースノード(分割構造+検索設定)→ ユーザー入力フォーム → テスト&公開 + + +1. **データソース**:さまざまな情報源(ローカルファイル、Notion、Webページなど)からのコンテンツ +2. **データ処理**:データ内容の加工と変換 + - 抽出器(Extractor):ドキュメントの解析・構造化 + - 分割器(Chunker):構造化された内容を扱いやすい断片に分割 +3. **ナレッジベース**:分割構造と検索設定の構築 +4. **ユーザー入力フォーム**:ユーザーがパイプライン実行時に必要なパラメータや情報を入力するための定義 +5. **テスト&公開**:設定の検証および運用開始 + +--- + +## ステップ1:データソースの設定 + +ナレッジベースには、単一または複数のデータソースを選択できます。現在、Difyでは主に4種類のデータソースをサポートしています:**ファイルアップロード、クラウドストレージ、オンラインドキュメント、Webクローラー**。 + +さらに多様なデータソースについては、[Dify Marketplace](https://marketplace.dify.ai)をご参照ください。 + +### ファイルアップロード + +ローカルファイルはドラッグ&ドロップまたはファイル選択でアップロードできます。 + +
+
+ ![ファイルアップロード](/images/knowledge-base/knowledge-pipeline-orchestration-1.PNG) +
+
+ **設定オプション** + + | 項目 | 説明 | + |----------------|------------------------------------| + | ファイル形式 | PDF、XLSX、DOCXなどに対応 | + | アップロード方法 | ドラッグ&ドロップまたは選択、バッチ対応 | + + **制限事項** + + | 項目 | 説明 | + |--------------|-------------------------------------------------| + | ファイル数 | 1回あたり最大50ファイルまで | + | ファイルサイズ | 1ファイルあたり最大15MB | + | ストレージ | サブスクリプションプランによりアップロード上限が異なります | + + **出力変数** + + | 出力変数 | 形式 | + |----------------|-----------------| + | `{x} Document` | 単一ドキュメント | +
+
+ +--- + +### オンラインドキュメント + +#### Notion + +Notionワークスペースと連携し、ページやデータベースをシームレスにインポート可能です。ナレッジベースは常に自動で最新状態に保たれます。 + +
+
+ ![Notion](/images/knowledge-base/knowledge-pipeline-orchestration-2.PNG) +
+
+ **設定オプション** + + | 項目 | オプション | 出力変数 | 説明 | + |------------|------------|-----------------|------------------------| + | Extractor | 有効 | `{x} Content` | 構造化・処理済み情報 | + | | 無効 | `{x} Document` | オリジナルテキスト | +
+
+ +--- + +### Webクローラー + +Webコンテンツを大規模言語モデルでも読みやすい形式に変換します。ナレッジベースはJina ReaderとFirecrawlをサポートしています。 + +#### Jina Reader + +シンプルかつ使いやすいAPIを提供するオープンソースのWeb解析ツールです。Webコンテンツの高速クロールと処理に適しています。 + +
+
+ ![Jina Reader](/images/knowledge-base/knowledge-pipeline-orchestration-3.png) +
+
+ **パラメータ設定** + + | パラメータ | 種類 | 説明 | + |--------------------|--------|------------------------------------------------| + | URL | 必須 | 対象Webページのアドレス | + | サブページのクロール | 任意 | リンク先ページもクロールするか | + | サイトマップ使用 | 任意 | サイトマップを利用してクロール | + | 制限 | 必須 | クロールする最大ページ数 | + | Extractor有効化 | 任意 | データ抽出方式の選択 | +
+
+ +#### Firecrawl + +きめ細かなクロール制御オプションとAPIサービスを持つオープンソースのWeb解析ツールです。複雑なサイトの深層クロールやバッチ処理に適しています。 + +
+
+ ![Firecrawl](/images/knowledge-base/knowledge-pipeline-orchestration-4.png) +
+
+ **パラメータ設定** + + | パラメータ | 種類 | 説明 | + |-----------------------|--------|------------------------------------------------| + | URL | 必須 | 対象Webページのアドレス | + | 制限 | 必須 | クロールする最大ページ数 | + | サブページクロール | 任意 | リンク先ページもクロールするか | + | 最大深度 | 任意 | 開始URLからクロールする階層の深さ | + | 除外パス | 任意 | クロール対象から除外したいURLパターン | + | 限定パス | 任意 | 指定したパスのみクロール | + | Extractor | 任意 | データ抽出方式の選択 | + | 主要コンテンツのみ抽出 | 任意 | ページの主要テキストやメディアのみ抽出 | +
+
+ +--- + +### クラウドストレージ + +Google Drive、Dropbox、OneDriveなどのクラウドストレージサービスと連携し、Difyが自動でファイルを取得します。選択したドキュメントをインポートするだけなので、事前の手動ダウンロードは不要です。 + + +認証に関するサポートが必要な場合は、[データソース認証ガイド](/ja-jp/guides/knowledge-base/knowledge-pipeline/authorize-data-source)をご参照ください。 + + +--- + +## ステップ2:データ処理ツールの設定 + +このステップでは、コンテンツの抽出、分割、最適なナレッジベース用フォーマットへの変換を行います。これは、料理でいう「食材の下準備」と同じく、後に素早く加工できる状態を整える工程です。 +  +### ドキュメントプロセッサ + +PDF, XLSX, DOCXなど多様な形式のドキュメントが存在しますが、LLMはこれらをそのまま扱えません。そのため、抽出器(Extractor)が各種ファイルを解析・変換し、LLMが扱いやすい形式に変換します。 + +Difyのドキュメント抽出器、あるいはMarketplaceから「Dify Extractor」「MinerU」「Unstructured」等のツールを選択できます。 + +#### Doc Extractor(ドキュメント抽出器) + +![Doc Extractor](/images/knowledge-base/knowledge-pipeline-orchestration-4-1.png) + +情報処理の中核となり、入力ファイルを識別・読取・情報抽出を行い、次のノードで利用できる形式へ変換します。 + + +詳細は[ドキュメント抽出器](/ja-jp/guides/workflow/node/doc-extractor)をご参照ください。 + + +#### Dify Extractor + +Dify Extractorは、Difyが提供する内蔵ドキュメント解析ツールです。一般的なファイル形式に幅広く対応し、特にDocファイルに最適化されています。画像抽出・保存や、画像URL返却も可能です。 + +![Dify Extractor](/images/knowledge-base/knowledge-pipeline-orchestration-5.png) + +#### MinerU + +
+
+ ![MinerU](/images/knowledge-base/knowledge-pipeline-orchestration-6.png) +
+
+ [MinerU](https://marketplace.dify.ai/plugins/langgenius/mineru)は、複雑な構造や数式表現を保持したまま、PDF等をMarkdownやJSONなどの機械可読形式へ高品質に変換できるツールです。 + + 基本的なPDF抽出ツールと比べ、ヘッダー・フッター・ページ番号を除去しつつ意図した論理構造を保持できます。また、スキャン画像・文字化けドキュメントの自動検出や、84言語対応のOCR(光学文字認識)もサポート。LaTeX形式の数式抽出や多カラム・テーブル・画像混在ドキュメントの解析にも最適です。 +
+
+ +#### Unstructured + +
+
+ ![Unstructured](/images/knowledge-base/knowledge-pipeline-orchestration-7.png) +
+
+ [Unstructured](https://marketplace.dify.ai/plugins/langgenius/unstructured)は、高度なカスタマイズ可能性を備えた抽出戦略でドキュメントを機械可読形式へ変換します。 + 抽出戦略(auto, hi_res, fast, OCR-only)や分割方法(by_title, by_page, by_similarity)に柔軟に対応。要素ごとの座標や信頼度、レイアウトなどリッチなメタデータも出力し、企業のドキュメントワークフローや混合タイプファイルの精密な処理に適しています。 +
+
+ + +他のツールについては[Dify Marketplace](https://marketplace.dify.ai)をご覧ください。 + + +--- + +### 分割器(Chunker) + +人間が一度に多くの情報を集中して理解できないように、LLMも大量情報の同時処理が苦手です。そのため、分割器は抽出後のドキュメントを小さな「チャンク」と呼ばれる断片に分割します。 + +用途やドキュメントの種類に応じ、最適な分割戦略が異なります。たとえば製品マニュアルは機能ごと、論文は論理セクションごとが理想的です。Difyでは主に3種類の分割器を用意しています。 + +#### 分割器の種類概要 + +| 分割器タイプ | 特徴 | 最適用途 | +|-----------------|---------------------------------------------|-------------------------------| +| 汎用分割器 | 固定サイズ分割、区切り文字のカスタマイズ可能 | シンプルなドキュメント | +| 親子分割器 | 二層構造:マッチング精度+豊富なコンテキスト | コンテキスト保持必須な複雑文書 | +| Q&Aプロセッサ | スプレッドシートのQ&Aペア処理 | 構造化Q&Aデータ(CSV/Excel等) | + +#### 共通テキスト前処理ルール + +すべての分割器で利用できるテキストクリーニングオプション: + +| オプション | 説明 | +|-----------------------------------|----------------------------------------------| +| 連続空白・改行・タブの統一 | 連続する空白文字を単一空白へ変換 | +| URL・メールアドレスの削除 | Webリンクやメールアドレスを自動検出し削除 | + +#### 汎用分割器(General Chunker) + +シンプルな構造の文書向けの基本的な分割モジュールです。テキスト分割や前処理オプションを柔軟にカスタマイズ可能です。 + +**入力と出力変数** + +| タイプ | 変数 | 説明 | +|------------|----------------------|----------------------------------------------------| +| 入力変数 | `{x} Content` | 分割対象となる文書コンテンツ | +| 出力変数 | `{x} Array[Chunk]` | 分割済みコンテンツ配列(各要素は検索・分析向け) | + +**分割設定** + +| 設定項目 | 説明 | +|-------------------|--------------------------------------------------------------------------| +| 区切り文字 | デフォルトは`\n`(段落区切り用改行)。正規表現も利用可。 | +| 最大チャンク長 | 各セグメントの最大文字数(上限超過時は自動分割) | +| チャンク重複 | 分割時にセグメント間で部分重複させることで情報保持・検索精度を向上 | + +#### 親子分割器(Parent-child Chunker) + +クエリマッチング精度と豊富なコンテキスト両立のため、二層チャンク構造を採用しています。 + +**親子分割器の仕組み** + +- **子チャンク(高精度マッチング用)**:通常、1文ごとの細かなセグメント +- **親チャンク(豊富なコンテキスト)**:該当する子チャンクを含む広い範囲(段落やセクション単位) + +| タイプ | 変数 | 説明 | +|------------|---------------------------|------------------------------| +| 入力変数 | `{x} Content` | 原文テキスト | +| 出力変数 | `{x} Array[ParentChunk]` | 親チャンク配列 | + +**分割設定** + +| 設定項目 | 説明 | +|---------------------|-------------------------------------------------| +| 親チャンク区切り文字 | 親チャンクの分割ルール設定 | +| 親チャンク最大長 | 親チャンクの最大文字数 | +| 子チャンク区切り文字 | 子チャンク分割ルール | +| 子チャンク最大長 | 子チャンクの最大文字数 | +| 親モード | 「段落」または「全文書」いずれか選択 | + +#### Q&Aプロセッサ + +抽出&分割を1ノードで実施。FAQやQ&Aペアをテーブルとして持つCSV/Excelファイル専用です。 + +**入出力変数** + +| タイプ | 変数 | 説明 | +|-----------|------------------------|---------------------------------------| +| 入力変数 | `{x} Document` | 単一ファイル | +| 出力変数 | `{x} Array[QAChunk]` | Q&Aチャンク配列 | + +**変数設定** + +| 設定項目 | 説明 | +|-----------------|------------------| +| 質問用カラム番号 | 質問内容の列番号 | +| 回答用カラム番号 | 回答内容の列番号 | + +--- + +## ステップ3:ナレッジベースノードの設定 + +ドキュメントの処理・分割が完了したら、保存や検索の方法を設定します。ここでは、インデックス作成方法や検索戦略を用途に応じて選択可能です。 + +本ノードの設定項目は、入力変数、チャンク構造、インデックス方式、検索設定となります。 + +### チャンク構造 + +![チャンク構造](/images/knowledge-base/knowledge-pipeline-orchestration-8.png) + +チャンク構造は、ナレッジベースが文書コンテンツをどう整理・インデックス化するかを定めます。用途やコストに適したモードを選択してください。 + +ナレッジベースは3つのチャンクモードをサポートします:**汎用モード**、**親子モード**、**Q&Aモード**。初めて設定する場合は親子モードが推奨されます。 + + +**重要:** チャンク構造は一度保存・公開すると変更できません。慎重にご選択ください。 + + +#### 汎用モード + +標準的なドキュメント処理に最適です。ニーズに応じ、柔軟なインデックスと検索設定が選択可能です。 + +#### 親子モード + +検索時の高精度マッチングと文脈提供が必要なエンタープライズ向け専門ドキュメントに最適です。HQ(高品質)インデックスのみ対応です。 + +#### Q&Aモード + +構造化された質問回答データ向けです。Q&Aペアが質問部に基づいてインデックス化され、関連回答が検索できます。こちらもHQモードのみ対応です。 + +### 入力変数 + +入力変数はデータ処理ノードからの出力をナレッジベースのデータソースとして受け取ります。分割器の出力をナレッジベースノードへ接続します。 + +- **汎用モード**:`{x} Array[Chunk]`(汎用チャンク配列) +- **親子モード**:`{x} Array[ParentChunk]`(親チャンク配列) +- **Q&Aモード**:`{x} Array[QAChunk]`(Q&Aチャンク配列) + +### インデックス方法と検索設定 + +インデックス方法はナレッジベース内のコンテンツ整理法を決定し、検索設定はそれに基づいた検索戦略を指定します。 +ナレッジベースでは**高品質**と**コスト効率**の2方式があり、それぞれ検索方法が異なります。 + +**高品質モード**では、埋め込みモデル(Embedding)によりテキストをベクトル化し、意味的な関連性検索が可能です(完全一致でなくても適切な回答に辿り着けます)。 + +**コスト効率モード**では、各ブロックは10個のキーワードでインデックス化され、埋め込みモデルのコストは発生しません。 + + +詳細は[インデックス方法と検索設定の選択](/ja-jp/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods)もご参照ください。 + + +#### インデックス方法と検索設定概要 + +| インデックス方法 | 検索設定 | 説明 | +|----------------|----------------|-----------------------------------------------------| +| 高品質 | ベクトル検索 | 意味的類似性(自然言語での深い検索) | +| | 全文検索 | キーワードベースの包括的検索 | +| | ハイブリッド検索| 意味検索+キーワード検索の組合せ | +| コスト効率 | 逆引きインデックス| 一般的な検索エンジン型方式 | + +詳細は以下の表をご参照ください。 + +| チャンク構造 | インデックス方法 | パラメータ | 検索設定 | +|-------------|----------------|-------------------|----------------------| +| 汎用モード | 高品質


コスト効率 | 埋め込みモデル


キーワード数 | ベクトル
全文
ハイブリッド検索
逆引きインデックス | +| 親子モード | 高品質のみ | 埋め込みモデル | ベクトル
全文
ハイブリッド検索 | +| Q&Aモード | 高品質のみ | 埋め込みモデル | ベクトル
全文
ハイブリッド検索 | + +--- + +## ステップ4:ユーザー入力フォームの作成 + +ユーザー入力フォームは、パイプライン実行時に必要な初期情報をユーザーから収集します。[ワークフローの開始ノード](/ja-jp/guides/workflow/node/start)と同様に、必要な设置情報(アップロードファイル、特定パラメータなど)を収集し、パイプラインの柔軟性・利便性を高めます。 + +### フォームの作成方法 + +1. **パイプライン構築UI** + - 「入力フィールド」をクリックして作成・設定を開始 + ![入力フィールド](/images/knowledge-base/knowledge-pipeline-orchestration-9.png) + +2. **ノードパラメータパネル** + - ノード選択後、パラメータ入力欄の「+ ユーザー入力を作成」をクリック + ![ノードパラメータ](/images/knowledge-base/knowledge-pipeline-orchestration-10.png) + +### ユーザー入力フィールドの追加 + +#### 各エントランス固有入力 + +![固有入力](/images/knowledge-base/knowledge-pipeline-orchestration-11.png) + +これは各データソースや下流ノードに固有です。該当データソース選択時のみ入力対象となります(例:異なるURLの指定等)。 + +**作成方法**:データソース横の`+`ボタンからそのソース専用フィールドを追加できます。選択したソースからのみアクセス可能です。 + +![データソース固有入力](/images/knowledge-base/knowledge-pipeline-orchestration-12.png) + +#### すべてのエントランス共通入力 + +![共通入力](/images/knowledge-base/knowledge-pipeline-orchestration-13.png) + +全ノードから参照できるグローバル共有入力です。チャンク区切りや最大長等、汎用パラメータの入力に適します。 + +**作成方法**:グローバル入力の`+`ボタンから追加できます。 + +### サポートされる入力フィールドタイプ + +ナレッジパイプラインでは7種の入力変数をサポートします: + +
+
+ ![フィールドタイプ](/images/knowledge-base/knowledge-pipeline-orchestration-14.png) +
+
+ | フィールドタイプ | 説明 | + |---------------|-----------------------------------------------------------------------| + | テキスト | 256文字以内の短文の入力欄 | + | 段落 | 長文テキストの入力欄 | + | セレクト | 設定済み候補リストから選択(カスタム不可) | + | ブール値 | 真偽値 | + | 数値 | 数値のみ入力 | + | 単一ファイル | 単一ファイルアップロード(各ファイルタイプ対応) | + | ファイルリスト | 複数ファイルの一括アップロード(各ファイルタイプ対応) | +
+
+ + +詳細は[入力フィールドのドキュメント](/ja-jp/guides/workflow/node/start#input-field)をご参照ください。 + + +### フィールド設定オプション + +全入力フィールドには必須/任意および追加設定があります。適切なチェックで必須化等を指定します。 + +| 設定 | 名称 | 説明 | 例 | +|-------------------|---------------|--------------------------------------------------|--------------------------| +| 必須設定 | 変数名 | 内部識別用(英数字・アンダースコア推奨) | `user_email` | +| | 表示名 | UI上に表示される名称 | ユーザーメール | +| タイプ固有設定 | | タイプごとの条件 | テキストの最大長制限等 | +| 追加設定 | デフォルト値 | 未入力時の既定値 | 数値は0、テキストは空文字 | +| | プレースホルダー | 入力欄が空のときのヒント表示 | 「メールアドレス入力」 | +| | ツールチップ | 補足説明(マウスホバー時表示) | 「有効なメールアドレスを…」 | +| 特殊任意設定 | | タイプごとの特殊バリデーション | メール形式チェック等 | + +設定後、右上のプレビューボタンで実際のフォーム動作確認やフィールド並び替えが可能です。「!」マーク表示時は参照無効を示します。 + +![フォームプレビュー](/images/knowledge-base/knowledge-pipeline-orchestration-15.png) + +--- + +## ステップ5:ナレッジベースの命名 + +![ナレッジベース命名](/images/knowledge-base/create-knowledge-pipeline-11.png) + +デフォルトのナレッジベース名は「Untitled+番号」、権限は「自分のみ」、アイコンはオレンジ色の書籍です。DSLファイルからインポートした場合は元のアイコンが適用されます。 + +左パネルの「設定」をクリックし、以下を設定してください。 +- **名前とアイコン** + ナレッジベース名を決定します。絵文字選択、画像アップロード、画像URLによるアイコン設定が可能です。 +- **ナレッジベース説明** + 簡単な説明を記入してください。AIがデータをより適切に理解し検索できるようになります。未入力の場合はDifyのデフォルト検索戦略が使われます。 +- **権限** + ドロップダウンから適切なアクセス権限を選択してください。 + +--- + +## ステップ6:テスト + +いよいよ最終工程です! + +設定が整ったら、まずは全設定の完全性チェックを行いましょう。チェックは右上のチェックリストボタンで行え、不足項目があると通知されます。 + +![チェックリスト](/images/knowledge-base/knowledge-pipeline-orchestration-16.png) + +全設定完了後、テスト実行でパイプライン全体の動作確認を行い、不備がないことを確認した上で公開します。 + +### テスト実行 + +![テスト実行](/images/knowledge-base/knowledge-pipeline-orchestration-17.png) + +1. **テスト開始**:**テスト実行**をクリック +2. **テストファイルインポート**:右側ウィンドウからファイル選択 + + **注意:** デバッグのため、1回につき1ファイルのみアップロード可能です。 + +3. **パラメータ入力**:設定した入力フォームに従い必要なパラメータを入力 +4. **パイプライン実行**:**次へ**をクリックしテスト開始 + +テスト時は、[履歴ログ](/ja-jp/guides/workflow/debug-and-preview/history-and-logs#アプリケーション実行履歴)(実行記録の確認)や[変数インスペクタ](/ja-jp/guides/workflow/debug-and-preview/variable-inspect)(ノード入出力内容の可視化)が問題特定に役立ちます。 + +![テストツール](/images/knowledge-base/knowledge-pipeline-orchestration-18.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[このページを編集](https://github.com/langgenius/dify-docs/edit/main/ja-jp/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx) | [問題を報告](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/ja-jp/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx b/ja-jp/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx new file mode 100644 index 00000000..1441c759 --- /dev/null +++ b/ja-jp/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx @@ -0,0 +1,25 @@ +--- +title: "ステップ5:ナレッジベースの管理と活用" +--- + +ナレッジベース作成後は、継続的な管理・最適化により、アプリケーションに正確なコンテキスト情報を提供することが大切です。管理には以下のオプションがあります。 + +## ナレッジパイプライン + +オーケストレーションしたパイプラインノードや設定の確認・修正が可能です。 + + +詳細は[ナレッジ管理](/ja-jp/guides/knowledge-base/knowledge-and-documents-maintenance/introduction)のガイドをご参照ください。 + + +![ナレッジ管理](/images/knowledge-base/create-knowledge-pipeline-21.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[このページを編集](https://github.com/langgenius/dify-docs/edit/main/ja-jp/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx) | [問題を報告](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/ja-jp/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx b/ja-jp/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx new file mode 100644 index 00000000..165504f8 --- /dev/null +++ b/ja-jp/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx @@ -0,0 +1,52 @@ +--- +title: "ステップ3:ナレッジパイプラインの公開" +--- + +オーケストレーション・デバッグが完了したら**公開**をクリックし、確認ダイアログで**確定**を押します。 + +
+
+ ![公開確認](/images/knowledge-base/create-knowledge-pipeline-12-1.png) +
+
+ ![公開成功](/images/knowledge-base/create-knowledge-pipeline-12.png) +
+
+ + +**重要な注意点**:公開後はチャンキング構造を変更できません。チャンキング構造はナレッジベースの保存方式や検索戦略に影響し、データの一貫性とユーザー体験を確保するため、各ナレッジベースは**一種類のチャンキング構造**のみをサポートします。 + + +
+
+ ![公開完了](/images/knowledge-base/create-knowledge-pipeline-13.png) +
+
+ 公開が完了すると、以下の操作が可能です:

+ + **ドキュメントの追加(Go to add documents)**
+ このオプションをクリックすると、ナレッジベースのデータソース選択画面に移動し、直接ドキュメントをアップロードできます。

+ + **APIへのアクセス(Access API Reference)**
+ APIドキュメントページに移動し、ナレッジベースのAPI呼び出し方法や利用手順を確認できます。

+ + **ナレッジパイプラインとして公開(Publish as a Knowledge Pipeline)**
+ 「ナレッジパイプラインとして公開」を選択することで、このパイプラインを再利用可能なテンプレートとして保存できます。作成したテンプレートはカスタマイズセクションに表示され、将来再利用できます。 +
+
+ +公開後、**ナレッジベースパイプラインとして公開**を選択すれば、カスタマイズ済みセクションに再利用可能なテンプレートとして登録できます。 + + +**制限事項**:**ナレッジベースパイプラインとして公開**機能はSandboxプランでは利用できません。この機能を使用する場合は、ProfessionalまたはTeamプランへ[アップグレード](https://dify.ai/pricing)が必要です。 + + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[このページを編集](https://github.com/langgenius/dify-docs/edit/main/ja-jp/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx) | [問題を報告](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/ja-jp/guides/knowledge-base/knowledge-pipeline/readme.mdx b/ja-jp/guides/knowledge-base/knowledge-pipeline/readme.mdx new file mode 100644 index 00000000..c87ff82c --- /dev/null +++ b/ja-jp/guides/knowledge-base/knowledge-pipeline/readme.mdx @@ -0,0 +1,51 @@ +--- +title: ナレッジパイプラインの作成 +--- + +ナレッジパイプラインは、生データを検索可能なナレッジベースへと変換するためのドキュメント処理ワークフローです。ワークフローを組み立てるように、さまざまな処理ノードやツールを視覚的に組み合わせて設定し、データ処理の精度や関連性を最適化できます。 + +普通の場合、ナレッジパイプラインは次の4つの主要ステップで構成されます。 + +**データソース → データ抽出 → データ処理 → ナレッジストレージ** + +それぞれのステップは特定の目的を担っています。各種ソースからコンテンツを収集し、処理可能なテキストに変換、検索に適した形へ整え、高速かつ正確な検索が可能なフォーマットで保存します。 + +Difyには特定の用途に最適化されたパイプラインテンプレートが組み込まれているほか、ゼロから独自のナレッジパイプラインを作成することも可能です。本章では、作成方法、全体の流れ、管理方法について解説します。 + + + + + 組み込みのテンプレート、空のナレッジパイプラインから始めるか、既存のパイプラインをインポートします。 + + + + + ナレッジパイプラインの仕組みを理解し、異なるノードを構成して、必要なデータ処理フローを構築します。 + + + + + 設定をテストした後、パイプラインを公開し、ドキュメント処理の準備をします。 + + + + + ドキュメントをアップロードして処理することで、検索可能なナレッジベースを構築します。 + + + + + ドキュメントのメンテナンス、検索精度のテスト、設定の変更などを行います。 + + + + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[このページを編集](https://github.com/langgenius/dify-docs/edit/main/ja-jp/guides/knowledge-base/knowledge-pipeline/create-from-knowledge-pipeline.mdx) | [問題を報告](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/ja-jp/guides/knowledge-base/knowledge-pipeline/upload-files.mdx b/ja-jp/guides/knowledge-base/knowledge-pipeline/upload-files.mdx new file mode 100644 index 00000000..03538341 --- /dev/null +++ b/ja-jp/guides/knowledge-base/knowledge-pipeline/upload-files.mdx @@ -0,0 +1,56 @@ +--- +title: "ステップ4:ファイルのアップロード" +--- + +ナレッジパイプライン公開後は、以下2通りの方法でファイルをアップロードできます。 + +A. 公開成功通知内の**ドキュメントへ移動**をクリックし、ドキュメントページで**ファイル追加**からアップロードします。 +
+
+ ![方式A-1](/images/knowledge-base/create-knowledge-pipeline-14.png) +
+
+ ![方式A-2](/images/knowledge-base/create-knowledge-pipeline-15.png) +
+
+ +B. **ドキュメント追加へ移動**をクリックしてファイルをアップロードします。 +
+
+ ![方式B-1](/images/knowledge-base/create-knowledge-pipeline-16.png) +
+
+ ![方式B-2](/images/knowledge-base/create-knowledge-pipeline-17.png) +
+
+ +### アップロードの流れ + +1. **データソースの選択** + パイプラインで設定したタイプから選択します。Difyは現在、4種類のデータソース(ファイルアップロード(PDF、DOCX等)、オンラインドライブ(Google Drive、OneDrive等)、オンラインドキュメント(Notion)、ウェブクローラー(Jina Reader、Firecrawl))をサポートしています。 + 追加ソースは[Dify Marketplace](https://marketplace.dify.ai/)からインストール可能です。 + +2. **処理パラメータの入力・プレビュー** + パイプライン構築時にユーザー入力フィールドを設定していれば、ここで必要なパラメータ・変数を入力します。フォーム入力後、「プレビュー」をクリックすると分割結果を確認できます。「保存して処理」を押すとナレッジベースの作成とデータ処理が始まります。 + + **重要な注意点**:チャンキング構造はパイプライン設定で固定されており、ユーザー入力パラメータでは変更できません。 + + ![パラメータ入力](/images/knowledge-base/create-knowledge-pipeline-18.png) + +3. **ドキュメント処理** + ドキュメント処理の進捗を追跡できます。埋め込み処理が完了したら「ドキュメントへ移動」をクリックしてください。 + ![処理進捗](/images/knowledge-base/create-knowledge-pipeline-19.png) + +4. **ドキュメントリストの確認** + 「ドキュメントへ移動」をクリックするとドキュメントページが表示され、アップロードしたファイルや処理状況が確認できます。 + ![ドキュメントリスト](/images/knowledge-base/create-knowledge-pipeline-20.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[このページを編集](https://github.com/langgenius/dify-docs/edit/main/ja-jp/guides/knowledge-base/knowledge-pipeline/upload-files.mdx) | [問題を報告](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/ja-jp/guides/tools/types-of-tools.mdx b/ja-jp/guides/tools/types-of-tools.mdx index 649d3724..738bee74 100644 --- a/ja-jp/guides/tools/types-of-tools.mdx +++ b/ja-jp/guides/tools/types-of-tools.mdx @@ -4,7 +4,7 @@ description: "ツールは、ワークフローやエージェントが同様に --- - + Difyの[マーケットプレイス](https://marketplace.dify.ai/?category=tool_)で、Difyネイティブの数百ものツールを探索しましょう diff --git a/ja-jp/guides/workflow/file-upload.mdx b/ja-jp/guides/workflow/file-upload.mdx index 62ba3d69..2677be1e 100644 --- a/ja-jp/guides/workflow/file-upload.mdx +++ b/ja-jp/guides/workflow/file-upload.mdx @@ -41,7 +41,7 @@ Difyは、[チャットフロー](/ja-jp/guides/workflow/concepts) と [ワー * ワークフローアプリの場合 * [開始ノード](/ja-jp/guides/workflow/nodes/start)にファイル変数を追加する * チャットフローアプリの場合 - * [追加機能](/en/guides/workflow/additional-features)でファイルアップロードを有効にする(チャットフローのみ対応) + * [追加機能](/ja-jp/guides/workflow/additional-features)でファイルアップロードを有効にする(チャットフローのみ対応) * [開始ノード](/ja-jp/guides/workflow/nodes/start)にファイル変数を追加する * これらの機能は同時に設定可能で、お互いに独立して動作します。ファイルアップロード機能(アップロード方法や数量制限を含む)は、開始ノードのファイル変数に影響を与えません。例えば、開始ノードでのみファイル変数を作成したい場合は、ファイルアップロード機能を追加で有効にする必要はありません。 diff --git a/ja-jp/guides/workflow/node/list-operator.mdx b/ja-jp/guides/workflow/node/list-operator.mdx index d17cbcad..99906518 100644 --- a/ja-jp/guides/workflow/node/list-operator.mdx +++ b/ja-jp/guides/workflow/node/list-operator.mdx @@ -83,7 +83,7 @@ title: リスト処理 ファイルのインタラクティブな質疑応答シナリオでは、アプリのユーザーが文章や画像ファイルを同時にアップロードする可能性があります。LLMは画像ファイルを認識できる能力しか持たず、文章を読み取ることができません。その場合、[リスト操作](/ja-jp/guides/workflow/nodes/list-operator)ノードを使用して、ファイル変数の配列を事前処理し、異なるファイルタイプをそれぞれの処理ノードに送信する必要があります。手順は以下の通りです: -1. [機能](/en/guides/workflow/additional-features)を有効にし、ファイルタイプで「画像」および「文章」を選択します。 +1. [機能](/ja-jp/guides/workflow/additional-features)を有効にし、ファイルタイプで「画像」および「文章」を選択します。 2. フィルタ条件で、画像変数とドキュメント変数をそれぞれ抽出するための2つのリスト操作ノードを追加します。 3. 文章変数を抽出し、「ドキュメントエクストラクタ」ノードに渡し、画像ファイル変数を抽出してLLMノードに渡します。 4. 最後に「直接返信」ノードを追加し、LLMノードの出力変数を記入します。 diff --git a/ja-jp/learn-more/use-cases/build-ai-sales-avatar.mdx b/ja-jp/learn-more/use-cases/build-ai-sales-avatar.mdx index 1cbced2e..b49c503d 100644 --- a/ja-jp/learn-more/use-cases/build-ai-sales-avatar.mdx +++ b/ja-jp/learn-more/use-cases/build-ai-sales-avatar.mdx @@ -127,7 +127,7 @@ OpenAI の画面で **「+ Create new secret key」** をクリックし、新 ![Dify OpenAI Key](https://raw.githubusercontent.com/aleclee1005/AISalesAvatar/img/img/007DifyOpenAIKey.jpg) モデルの設定が完了すると、Dify上での実行環境の準備が整います。 -これで、AI Sales Avatar の「知識ベース(ナレッジ本体)」の構築を始めることができます。 +これで、AI Sales Avatar の「ナレッジベース(ナレッジ本体)」の構築を始めることができます。 --- @@ -240,7 +240,7 @@ AI Sales Avatar に「外見と演出能力(=デジタルヒューマンの --- 📚 Dify の詳細については、以下の公式ドキュメントも参考にしてください: -👉 [https://docs.dify.ai/en/introduction](https://docs.dify.ai/en/introduction) +👉 [https://docs.dify.ai/ja-jp/introduction](https://docs.dify.ai/ja-jp/introduction) --- diff --git a/ja-jp/learn-more/use-cases/integrate-deepseek-to-build-an-ai-app.mdx b/ja-jp/learn-more/use-cases/integrate-deepseek-to-build-an-ai-app.mdx index b8788a35..9d714934 100644 --- a/ja-jp/learn-more/use-cases/integrate-deepseek-to-build-an-ai-app.mdx +++ b/ja-jp/learn-more/use-cases/integrate-deepseek-to-build-an-ai-app.mdx @@ -7,7 +7,7 @@ title: DeepSeek & Dify連携ガイド - 多段階推論を活用したAIアプ オープンソースの生成AIアプリケーション開発プラットフォームである**Dify**は、開発者がDeepSeek LLMを活用し、より高度なAIアプリケーションを構築することを支援します。Difyプラットフォームは、以下の主要な開発体験を提供します。 * **視覚的な開発** - 直感的なビジュアルオーケストレーションにより、DeepSeek R1を搭載したAIアプリケーションをわずか3分で作成 -* **知識ベースの拡張** - 内部ドキュメントを連携させてRAG機能を有効化し、高精度なQ&Aシステムを構築 +* **ナレッジベースの拡張** - 内部ドキュメントを連携させてRAG機能を有効化し、高精度なQ&Aシステムを構築 * **ワークフローの拡張** - ドラッグアンドドロップ操作による機能ノードと、サードパーティ製ツールプラグインを介して、複雑なビジネスロジックを実装 * **データ分析** - 総会話数、ユーザーエンゲージメントなどの組み込みメトリクスに加え、専門的な監視プラットフォームとの連携をサポート ... @@ -15,7 +15,7 @@ title: DeepSeek & Dify連携ガイド - 多段階推論を活用したAIアプ このガイドでは、DeepSeek APIとDifyの連携について、以下の2つの主要な実装を達成するための詳細を説明します。 * **インテリジェントチャットボットの開発** - DeepSeek R1の連鎖的思考(chain-of-thought)推論機能を直接活用 -* **知識強化型アプリケーションの構築** - プライベートな知識ベースを利用して、正確な情報検索と生成を実現 +* **知識強化型アプリケーションの構築** - プライベートなナレッジベースを利用して、正確な情報検索と生成を実現 > 金融や法律など、コンプライアンスが重視される業界向けに、Difyは **[DeepSeek + Difyのプライベートデプロイ:独自のAIアシスタントを構築](./private-ai-ollama-deepseek-dify)** を提供しています。 > * DeepSeekモデルとDifyプラットフォームをプライベートネットワークに同期デプロイ @@ -67,19 +67,19 @@ Difyプラットフォームにアクセスし、**プロファイル → 設定 --- -### 3. 知識ベースによるテキスト分析の有効化 +### 3. ナレッジベースによるテキスト分析の有効化 [検索拡張生成(RAG)](/ja-jp/learn-more/extended-reading/retrieval-augment/README) は、関連する知識を検索することでAIの応答を強化する高度な手法です。モデルに必要なコンテキスト情報を提供することで、応答の精度と関連性が向上します。内部ドキュメントや特定の分野の資料をアップロードすると、AIはこの知識に基づいて、より情報に基づいた回答を生成できます。 -#### 3.1 知識ベースの作成 +#### 3.1 ナレッジベースの作成 -AIに分析させたい情報を含むドキュメントをアップロードします。DeepSeekがドキュメントの内容を正確に理解できるように、**親子分割**モードを使用することを推奨します。これにより、ドキュメントの階層構造とコンテキストが保持されます。詳細な手順については、[知識ベースの作成](/ja-jp/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods) を参照してください。 +AIに分析させたい情報を含むドキュメントをアップロードします。DeepSeekがドキュメントの内容を正確に理解できるように、**親子分割**モードを使用することを推奨します。これにより、ドキュメントの階層構造とコンテキストが保持されます。詳細な手順については、[ナレッジベースの作成](/ja-jp/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods) を参照してください。 ![](https://assets-docs.dify.ai/2025/01/f38af53d2b124391e2ea32f29da7d87d.png) -#### 3.2 AIアプリへの知識ベースの統合 +#### 3.2 AIアプリへのナレッジベースの統合 -AIアプリの **コンテキスト** 設定で、作成した知識ベースを追加します。ユーザーが質問すると、LLMは応答を生成する前に、まず知識ベースから関連情報を取得します。 +AIアプリの **コンテキスト** 設定で、作成したナレッジベースを追加します。ユーザーが質問すると、LLMは応答を生成する前に、まずナレッジベースから関連情報を取得します。 ![](https://assets-docs.dify.ai/2025/01/4254ec131fece172a59304414a060f4e.png) diff --git a/ja-jp/openapi-api-access-readme.mdx b/ja-jp/openapi-api-access-readme.mdx index 9b1df656..22ed1f65 100644 --- a/ja-jp/openapi-api-access-readme.mdx +++ b/ja-jp/openapi-api-access-readme.mdx @@ -98,7 +98,7 @@ Difyドキュメントへのコミュニティメンバーからの貢献を心 もし **現在ご覧になっているこの `APIアクセスとインタラクションガイド` ページ** を修正したい場合は、以下の手順で行うことができます: 1. このページの下部までスクロールします。 - 2. **「このページを編集」(Edit this page)** ボタンをクリックします。 + 2. **「このページを編集」(このページを編集)** ボタンをクリックします。 3. これにより、GitHub上のこの `api-access-readme.mdx` ファイルの編集インターフェースに直接移動します。 @@ -121,7 +121,7 @@ Difyドキュメントへのコミュニティメンバーからの貢献を心 ドキュメント(本ガイドページまたは特定のAPIエンドポイントページ)に問題を発見した場合、または改善提案がある場合: - 1. ページ下部(またはサイドバー)の **「問題を報告」(Report an issue)** リンクを使用できます。 + 1. ページ下部(またはサイドバー)の **「問題を報告」(問題を報告)** リンクを使用できます。 2. これにより、通常、このドキュメントプロジェクト (dify-docs) のGitHub Issuesページに移動します。 3. 発見した問題、問題のあるページのリンク、および改善提案を詳細に記述してください。 diff --git a/ja-jp/resources/termbase.mdx b/ja-jp/resources/termbase.mdx index a604181d..1faf6954 100644 --- a/ja-jp/resources/termbase.mdx +++ b/ja-jp/resources/termbase.mdx @@ -7,7 +7,7 @@ title: 用語集 環境情報に基づいて意思決定やタスク実行ができる自律型AIシステムです。Difyプラットフォームでは、エージェントは大規模言語モデルの理解能力と外部ツールとの対話能力を組み合わせ、情報検索、API呼び出し、コンテンツ生成など、単純なものから複雑なものまでの一連の操作を自動的に完了します。 ### エージェンティックワークフロー (Agentic Workflow) -AIシステムが複数のステップを通じて自律的に複雑な問題を解決できるタスク編成方法です。例えば、エージェンティックワークフローは、まずユーザーの質問を理解し、次に知識ベースを照会し、計算ツールを呼び出し、最後に情報を統合して完全な回答を生成します。これらはすべて人間の介入なしに行われます。 +AIシステムが複数のステップを通じて自律的に複雑な問題を解決できるタスク編成方法です。例えば、エージェンティックワークフローは、まずユーザーの質問を理解し、次にナレッジベースを照会し、計算ツールを呼び出し、最後に情報を統合して完全な回答を生成します。これらはすべて人間の介入なしに行われます。 ### 自動音声認識 (ASR, Automatic Speech Recognition) 人間の音声をテキストに変換する技術で、音声対話アプリケーションの基盤となります。この技術により、ユーザーはタイピングではなく話すことでAIシステムと対話でき、音声アシスタント、会議の文字起こし、アクセシビリティサービスなどのシナリオで広く使用されています。 @@ -21,7 +21,7 @@ AIシステムが複数のステップを通じて自律的に複雑な問題を 長いテキストを小さなコンテンツブロックに分割する処理技術で、検索システムがより正確に関連情報を見つけることを可能にします。優れたチャンキング戦略は、コンテンツの意味的整合性と言語モデルのコンテキストウィンドウの制限の両方を考慮し、検索と生成の品質を向上させます。 ### 引用と帰属 (Citation and Attribution) -AIシステムが情報源を明確に示すことができる機能で、レスポンスの信頼性と透明性を高めます。システムが知識ベースのコンテンツに基づいて回答を生成する場合、参照されたドキュメント名、ページ番号、URLを自動的に注釈し、ユーザーが情報の出所を理解できるようにします。 +AIシステムが情報源を明確に示すことができる機能で、レスポンスの信頼性と透明性を高めます。システムがナレッジベースのコンテンツに基づいて回答を生成する場合、参照されたドキュメント名、ページ番号、URLを自動的に注釈し、ユーザーが情報の出所を理解できるようにします。 ### 思考の連鎖 (CoT, Chain of Thought) 大規模言語モデルがステップバイステップの思考プロセスを表示するように導くプロンプト技術です。例えば、数学の問題を解く場合、モデルははじめに既知の条件をリストアップし、次に推論ステップに従って一つずつ解き、最後に結論に到達します。このプロセス全体が人間の思考に似ています。 @@ -60,11 +60,11 @@ AIシステムが情報源を明確に示すことができる機能で、レス ### キーワード検索 (Keyword Search) 特定の語彙を含む文書を見つける正確なマッチングに基づく検索方法です。この方法は計算効率が高く、製品モデル、固有名詞、特定のコマンドなど、ユーザーが見つけたい用語を明確に知っているシナリオに適していますが、同義語や関連する概念を使用して表現されたコンテンツを見逃す可能性があります。 -### 知識ベース (Knowledge Base) -AIアプリケーションで構造化された情報を保存し、モデルに専門知識の源を提供するデータベースです。Difyプラットフォームでは、知識ベースはさまざまな文書(PDF、Word、ウェブページなど)を含むことができ、処理されてAI検索に使用され、正確で根拠のある回答を生成するために使用されます。特にドメインエキスパートアプリケーションの構築に適しています。 +### ナレッジベース (Knowledge Base) +AIアプリケーションで構造化された情報を保存し、モデルに専門知識の源を提供するデータベースです。Difyプラットフォームでは、ナレッジベースはさまざまな文書(PDF、Word、ウェブページなど)を含むことができ、処理されてAI検索に使用され、正確で根拠のある回答を生成するために使用されます。特にドメインエキスパートアプリケーションの構築に適しています。 ### 知識検索 (Knowledge Retrieval) -ユーザーの質問に最も関連する情報を知識ベースから見つけるプロセスであり、RAGシステムの重要な構成要素です。効果的な知識検索は、関連するコンテンツを見つけるだけでなく、返される情報量を制御し、モデルを妨げる可能性のある無関係なコンテンツを避けながら、正確で完全な回答を確保するのに十分な背景を提供します。 +ユーザーの質問に最も関連する情報をナレッジベースから見つけるプロセスであり、RAGシステムの重要な構成要素です。効果的な知識検索は、関連するコンテンツを見つけるだけでなく、返される情報量を制御し、モデルを妨げる可能性のある無関係なコンテンツを避けながら、正確で完全な回答を確保するのに十分な背景を提供します。 ## L ### 大規模言語モデル (LLM, Large Language Model) @@ -114,7 +114,7 @@ AIモデルに特定の応答を生成するよう導く入力テキストです ## R ### 検索拡張生成 (RAG, Retrieval-Augmented Generation) -外部知識検索と言語生成を組み合わせた技術アーキテクチャです。システムはまず知識ベースからユーザーの質問に関連する情報を検索し、次にこの情報をコンテキストとして言語モデルに提供し、根拠のある正確な回答を生成します。RAGは言語モデルの限られた知識と幻覚問題を克服し、特に最新または専門的な知識を必要とするアプリケーションシナリオに適しています。 +外部知識検索と言語生成を組み合わせた技術アーキテクチャです。システムはまずナレッジベースからユーザーの質問に関連する情報を検索し、次にこの情報をコンテキストとして言語モデルに提供し、根拠のある正確な回答を生成します。RAGは言語モデルの限られた知識と幻覚問題を克服し、特に最新または専門的な知識を必要とするアプリケーションシナリオに適しています。 ### 推論と行動 (ReAct, Reasoning and Acting) モデルが思考と操作の実行を交互に行うことができるAIエージェントフレームワークです。問題解決のプロセスでは、モデルはまず現在の状態を分析し、計画を立て、次に適切なツール(検索エンジン、計算機など)を呼び出し、ツールの返す結果に基づいて次のステップを考え、問題が解決されるまで思考-行動-思考のサイクルを形成します。これは複数のステップと外部ツールを必要とする複雑なタスクに適しています。 @@ -132,7 +132,7 @@ AIモデルに特定の応答を生成するよう導く入力テキストです プラグインがプラットフォームと対話するための双方向メカニズムで、プラグインがプラットフォーム機能を積極的に呼び出すことを可能にします。Difyでは、これはサードパーティプラグインがAIから呼び出されるだけでなく、ワークフローのトリガーや他のプラグインの呼び出しなど、Difyのコア機能を返りに使用することもできることを意味し、システムの拡張性と柔軟性を大きく向上させます。 ### 検索テスト (Retrieval Test) -知識ベースの検索効果を検証する機能で、開発者がユーザークエリをシミュレートしシステムの返す結果を評価することを可能にします。このテストは開発者がシステムの検索能力の境界を理解し、見逃し検出、誤検出、関連性の低さなどの潜在的な問題を発見して修正するのに役立ち、RAGシステムを最適化するために不可欠なツールです。 +ナレッジベースの検索効果を検証する機能で、開発者がユーザークエリをシミュレートしシステムの返す結果を評価することを可能にします。このテストは開発者がシステムの検索能力の境界を理解し、見逃し検出、誤検出、関連性の低さなどの潜在的な問題を発見して修正するのに役立ち、RAGシステムを最適化するために不可欠なツールです。 ## S ### スコア閾値 (Score Threshold) diff --git a/ja-jp/workshop/basic/the-right-way-of-markdown.mdx b/ja-jp/workshop/basic/the-right-way-of-markdown.mdx index f191d50c..5330be4b 100644 --- a/ja-jp/workshop/basic/the-right-way-of-markdown.mdx +++ b/ja-jp/workshop/basic/the-right-way-of-markdown.mdx @@ -236,7 +236,7 @@ eB B2 eBgB|eB B2 defg|afe^c dBAF|DEFD E2:| ## ベストプラクティス -Markdown コンテンツを事前に定義しておきたい場合は、Dify の [テンプレート機能](/en/guides/workflow/node/template) を活用しましょう。これにより、下流のノードでもテンプレート内容を再利用でき、効率と一貫性を高めることができます。 +Markdown コンテンツを事前に定義しておきたい場合は、Dify の [テンプレート機能](/ja-jp/guides/workflow/node/template) を活用しましょう。これにより、下流のノードでもテンプレート内容を再利用でき、効率と一貫性を高めることができます。 {/* Contributing Section diff --git a/zh-hans/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx b/zh-hans/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx new file mode 100644 index 00000000..84af7e5c --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx @@ -0,0 +1,97 @@ +--- +title: 数据源授权 +--- + +Dify 支持多种外部数据源的连接,为了确保数据安全和访问控制,不同的数据源需要进行相应的授权配置。根据数据源的特性,Dify 提供两种主要的授权方式:**API Key** 和 **OAuth**,以确保你能够安全地访问和导入所需的数据。 + +## 数据源授权界面入口 + +在 Dify 中,你可以通过以下两种方式进入数据源授权配置界面: + +### 方式一:通过知识流水线编排界面 + +进入知识流水线编排界面,添加需要的数据源。选中数据源节点,在右侧面板中,点击**绑定**。 + +![流水线授权界面](/images/knowledge-base/authorize-data-1.PNG) + +### 方式二:设置界面 +点击右上角头像,选择**设置**,点击**数据来源**。进入数据来源页面后,选择需要授权的数据源,点击**配置**。 + +![设置授权界面](/images/knowledge-base/authorize-data-2.PNG) + +## 支持数据源及授权方式 + +| 数据源 | API Key | OAuth | +|-------------|---------|-------| +| Notion | ✅ | ✅ | +| Jina Reader | ✅ | | +| Firecrawl | ✅ | | +| Google Drive| | ✅ | +| Dropbox | ✅ | ✅ | +| OneDrive | | ✅ | + +## 授权方式和流程 + +### API Key 授权 +API Key 授权是一种基于密钥的身份验证方式,适用于企业级服务和开发者工具。用户需要在对应的服务提供商处生成 API Key,然后在 Dify 中进行配置。 + +#### 授权流程 +1. 在数据源配置界面,选择对应的数据源,点击右侧的**配置**,选择**添加 API Key**。 + + ![添加API Key](/images/knowledge-base/authorize-data-3.PNG) + +2. 在弹出的配置面板中,填写对应信息。完成后,点击**保存**完成授权。 + + ![API Key配置](/images/knowledge-base/authorize-data-4.png) + +API 密钥将被安全加密储存,配置成功后会显示 **Connected** 状态,你可以在知识流水线中使用该数据源。 + +![API Key 配置完成](/images/knowledge-base/authorize-data-6.png) + +### OAuth 授权 +OAuth 是一种开放标准的授权协议,允许用户在不暴露密码的情况下,授权第三方应用访问其在特定服务提供商上的资源。Dify 提供两种 OAuth 授权配置方式:默认配置和自定义配置。 + +#### 授权流程 +1. 在数据源配置界面,选择对应的数据源,点击右侧的**配置**,选择**添加 OAuth**。 + + ![添加OAuth](/images/knowledge-base/authorize-data-7.png) + +2. 在授权页面中查看并确认权限范围后,点击**允许访问**。 +
+
+ ![OAuth权限确认](/images/knowledge-base/authorize-data-8.png) +
+
+ ![允许访问](/images/knowledge-base/authorize-data-9.png) +
+
+ +#### OAuth 客户端设置 +Dify 提供默认和自定义两种 OAuth 客户端配置方式。 + +![OAuth客户端设置](/images/knowledge-base/authorize-data-10.png) + +- **默认客户端** + 仅 SaaS 版本支持默认客户端,你可以使用 Dify 官方预配置并维护的 OAuth 客户端参数,在 SaaS 版本一键添加 OAuth 凭据,无需进行额外的配置。 + +- **自定义客户端** + Dify 所有版本均支持自定义客户端。对于 SaaS 版本中尚未提供的默认配置数据源,你需要前往第三方平台自行注册并获取 OAuth 客户端参数。 + +**授权流程** +1. 在数据源配置界面,选择对应的数据源,点击右侧的**配置**,选择**添加 OAuth** 右侧的**设置图标**,进入 OAuth 客户端设置。 + + ![自定义OAuth设置](/images/knowledge-base/authorize-data-11.png) + +2. 点击**自定义**,输入 **Client ID** 和 **Client Secret**。点击**保存并授权**完成 OAuth 授权流程。 + + ![自定义OAuth配置](/images/knowledge-base/authorize-data-12.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/guides/knowledge-base/knowledge-pipeline/authorize-data-source.mdx) | [报告问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) diff --git a/zh-hans/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx b/zh-hans/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx new file mode 100644 index 00000000..b33cfc8d --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx @@ -0,0 +1,78 @@ +--- +title: "步骤一:创建知识流水线" +--- + +![创建知识流水线](/images/knowledge-base/create-knowledge-pipeline-1.png) + +点击顶部的**知识库**,在左侧点击**通过知识流水线创建知识库**,你可以通过以下 3 种方式来创建知识流水线。 + +### 方式一:从零开始构建 + +![从零开始](/images/knowledge-base/create-knowledge-pipeline-2.png) + +点击**空白知识流水线**即可从零开始构建自定义知识流水线。 +如果你需要根据数据特点和业务需求自定义处理策略,建议选择从空白知识流水线开始。 + +### 方式二:通过模版创建 + +Dify 提供了两种模版方案: **内置流水线**(Built-in) 和**自定义** (Customized)。两种模版的卡片信息都包含了知识库名称、简介描述和标签(包含分段模式)。 + +![通过模版创建](/images/knowledge-base/create-knowledge-pipeline-4-1.png) + +#### 内置流水线(Built-in Pipeline) + +内置流水线为预置的知识流水线模版,针对常见的文档数据结构进行优化,你可以根据不同的文档类型和使用场景选择适合的处理方式。点击**选择**即可开始使用。 + +![内置模板](/images/knowledge-base/create-knowledge-pipeline-4.png) + +**模版类型** + +| 模版名称 | 分段结构 | 索引方式 | 检索设置 | 说明 | +|---------|---------|---------|---------|------| +| 通用模式(General Mode) | 通用模式 | 经济 | 倒排索引 | 将文档内容分割成较小的段落块(通用块),直接用于匹配用户查询和检索。 | +| 父子模式(Parent-child Structure) | 父子模式 | 高质量 | 混合检索 | 采用了高级分块策略,将文档文本分成较大的"父块"和较小的"子块"。其中,"父块"包含了"子块"。这样既保证了检索的精确性,又维持了上下文的完整性。 | +| 简单问答(Simple Q&A) | 问答模式 | 高质量 | 向量搜索 | 将表格数据转化为一问一答的形式,通过问题匹配来快速找到对应的答案信息。适用于结构化表格数据。 | +| 复杂 PDF (含图片和表格)(Complex PDF with Images & Tables) | 父子模式 | 高质量 | 混合检索 - 加权评分 | 提取 PDF 文件内的图像和表格内容。 | +| LLM 上下文增强(Contextual Enriching Using LLM) | 父子模式 | 高质量 | 混合检索 - 加权评分 | 将文档内的图片和表格提取出来,使用大型语言模型自动生成描述性注释,实现上下文的智能增强。 | +| Markdown 转换(Convert to Markdown) | 父子模式 | 高质量 | 混合检索 - 加权评分 | 专为 DOCX、XLSX 和 PPTX 等 Office 原生文件格式设计,将其转换为 Markdown 格式以便更好地进行信息处理。⚠️ 注意:不推荐使用 PDF 文件。 | +| LLM 生成问答(LLM Generated Q&A) | 问答模式 | 高质量 | 向量搜索 - 加权评分 | 使用大型语言模型自动生成结构化的问答对,通过问题匹配机制找到相关的答案信息。 | + +点击模版卡片上的详情按钮,即可在弹窗中预览选中的流水线的编排结构、流水线简介和分段模式。点击使用此知识流水线模版进行编排。 + +![模板详情](/images/knowledge-base/create-knowledge-pipeline-5.png) + +#### 自定义(Customized) + +![自定义模板](/images/knowledge-base/create-knowledge-pipeline-6.png) + +自定义模版为用户创建和发布为知识流水线的方案,你可以选择使用该模版、导出 DSL,或点击详情进行快速预览。 + +![模板操作](/images/knowledge-base/create-knowledge-pipeline-7.png) + +点击模版卡片上的选择按钮,即可从该自定义模版开始创建知识库。你也可以在预览该流水线模版时,点击右侧的使用此知识流水线按钮开始创建。点击 ... 可以编辑流水线信息、导出知识流水线或者删除模版。 + +### 方式三:导入知识流水线 + +![导入DSL](/images/knowledge-base/create-knowledge-pipeline-3.png) + +在完成知识流水线的编排后,你可以保存和导出知识流水线,并分享给其他人。知识库使用者可以导入知识流水线,快速复用已构建的知识流水线,并在此基础上针对不同情景或需求进行修改。与工作流 DSL 类似,知识流水线基于相同的 YAML 格式标准,用于定义知识库内的处理流程和配置。 + +知识流水线包含以下内容: + +| 名称 | 包含 | +|--------------|------------------------------| +| 数据源 | 文件上传、网站、在线文档和在线网盘 | +| 数据处理流程 | 文档提取、内容分块和清洗策略 | +| 知识库储存配置 | 索引方式、检索设置和存储参数 | +| 节点连接 | 节点间的连接和处理顺序 | +| 用户输入表单 | 自定义的参数输入字段(如有配置) | + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/guides/knowledge-base/knowledge-pipeline/create-knowledge-pipeline.mdx) | [报告问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) diff --git a/zh-hans/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx b/zh-hans/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx new file mode 100644 index 00000000..ddbc4057 --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx @@ -0,0 +1,494 @@ +--- +title: "步骤二:知识流水线编排" +--- + +想象一下你正在搭建一条生产流水线,每个站点执行特定任务,你将不同它们连接起来将每个零部件组装最终成品。知识流水线编排与此类似,你组合不同节点,将原始文档数据通过每个节点逐步转化为可搜索的知识库。在 Dify 里,你通过可视化的方式,拖放和连接不同节点,对文档数据进行提取和分块处理,并配置索引方式和检索策略。 + +在这个章节,你将了解知识流水线的过程,理解不同节点的含义和配置,如何自定义构建数据处理流程,从而高效地管理和优化知识库。 + +### 界面状态 +进入知识流水线编排界面时,你会看到: +- **标签页状态**:Documents(文档)、Retrieval Test(召回测试)和 Settings(设置)标签页将显示为置灰且不可用状态 +- **必要步骤**:您必须完成知识流水线的配置、调试和发布后,才能上传文件或使用其他功能 + +如果你选择了**空白知识流水线**,你将看到仅包含知识库节点的画布。你可以跟随该节点旁的指引,逐步完成流水线创建。 + +![空白流水线](/images/knowledge-base/create-knowledge-pipeline-8.png) + +如果选择**特定的流水线模版**,编排界面将直接显示该流水线模版。 + +![模板流水线](/images/knowledge-base/create-knowledge-pipeline-9.png) + +## 知识流水线处理流程 + +在开始之前,我们先拆解知识流水线的处理流程,你可以更好地理解数据是如何一步步转化为可用的知识库。 + + +**数据源配置 → 数据处理节点(文档提取器 + 分块器)→ 知识库节点(分块结构+索引配置) → 配置用户输入表单 → 测试发布** + + +1. **数据源配置**:来自各种数据源的原始内容(本地文件、Notion、网页等) +2. **数据处理节点配置**:处理和转换数据内容 + - 提取器 (Extractor) → 解析和结构化原始文档内容 + - 分块器 (Chunker) → 将结构化内容分割为适合处理的片段 +3. **知识库节点配置**:设置知识库的分段结构和检索策略 +4. **用户输入表单配置**:定义流水线使用者需要输入的参数 +5. **测试与发布**:验证并正式启用知识库 + +## 步骤一:数据源配置 + +在一个知识库里,你可以选择单一或多个数据源。每个数据源可以被多次选中,并包含不同配置。目前,Dify 支持 5 种数据源:文件上传、在线网盘、在线数据和 Web Crawler。 + +你也可以前往 [Dify Marketplace](https://marketplace.dify.ai),获得更多数据源。 + +### 文件上传 + +用户可以直接选择本地文件进行上传,以下是配置选项和限制。 + +
+
+ ![](/images/knowledge-base/knowledge-pipeline-orchestration-1.PNG) +
+
+ **配置选择** + + | 配置项 | 说明 | + |--------|------| + | 文件格式 | 支持 pdf, xlxs, docs 等,用户可自定义选择 | + | 上传方式 | 通过拖拽或选择文件或文件夹上传本地文件,支持批量上传 | + + **限制** + + | 限制项 | 说明 | + |--------|------| + | 文件数量 | 每次最多上传 50 个文件 | + | 文件大小 | 每个文件大小不超过 15MB | + | 储存限制 | 不同 SaaS 版本的订阅计划对文档上传总数和向量存储空间有所限制 | + + **输出变量** + + | 输出变量 | 变量格式 | + |----------|----------| + | `{x} Document` | 单个文档 | +
+
+--- + +### 在线数据 + +#### Notion + +将知识库连接 Notion 工作区,可直接导入 Notion 页面和数据库内容,支持后续的数据自动同步。 + +
+
+ ![Notion](/images/knowledge-base/knowledge-pipeline-orchestration-2.PNG) +
+
+ **配置选项说明** + + | 配置项 | 选项 | 输出变量 | 说明 | + |--------|------|----------|------| + | Extractor | 开启 | `{x} Content` | 输出结构化处理的页面信息 | + | | 关闭 | `{x} Document` | 输出页面的原始文本信息 | +
+
+ +### 网页爬虫 + +将网页内容转化为大型语言模型容易识别的格式,知识库支持 Jina Reader 和 Firecrawl,提供灵活的网页解析能力。 + +#### Jina Reader + +开源网页解析工具,提供简洁易用的 API 服务,适合快速抓取和处理网页内容。 + +
+
+ ![Jina Reader](/images/knowledge-base/knowledge-pipeline-orchestration-3.png) +
+
+ **参数配置和说明** + + | 参数 | 类型 | 说明 | + |------|------|------| + | URL | 必填 | 目标网页地址 | + | 爬取子页面 (Crawl sub-page) | 可选 | 是否抓取链接页面 | + | 使用站点地图 (Use sitemap) | 可选 | 利用网站地图进行爬取 | + | 爬取页数限制 (Limit) | 必填 | 设置最大抓取页面数量 | + | 启用内容提取器 (Enable Extractor) | 可选 | 选择数据提取方式 | +
+
+ +#### Firecrawl + +开源网页解析工具,提供更精细的爬取控制选项和 API 服务,支持复杂网站结构的深度爬取,适合需要批量处理和精确控制的场景。 + +
+
+ ![Firecrawl](/images/knowledge-base/knowledge-pipeline-orchestration-4.png) +
+
+ **参数配置和说明** + + | 参数 | 类型 | 说明 | + |------|------|------| + | URL | 必填 | 目标网页地址 | + | 爬取页数限制 (Limit) | 必填 | 设置最大抓取页面数量 | + | 爬取子页面 (Crawl sub-page) | 可选 | 是否抓取链接页面 | + | 最大爬取深度 (Max depth) | 可选 | 控制爬取层级深度 | + | 排除路径 (Exclude paths) | 可选 | 设置不爬取的页面路径 | + | 仅包含路径 (Include only paths) | 可选 | 限制只爬取指定路径 | + | 启用内容提取器 (Enable Extractor) | 可选 | 选择数据处理方式 | + | 只提取主要内容 | 可选 | 过滤页面辅助信息 | +
+
+ +### 在线网盘 (Online Drive) + +连接你的在线云储存服务(例如 Google Drive、Dropbox、OneDrive),Dify 将自动检索云储存中的文件,你可以勾选并导入相应文档进行下一步处理,无需手动下载文件再进行上传。 + + +关于第三方数据源授权,请前往[数据源授权](/zh-hans/guides/knowledge-base/knowledge-pipeline/authorize-data-source)。 + + +--- + +## 步骤二:配置数据处理节点 + +该阶段是内容的预处理与数据结构化过程,这一部分将会把数据源进行提取、分段并转换为适合知识库存储和检索的格式。你可以将这一步想象成备餐过程——处理原材料、进行清理、切分成小块,并整理好一切,以便在有人需要时能迅速"烹制"出这道"菜肴"。 + +### 文档处理 + +由于知识库无法直接理解 PDF、Word 等各种文档格式,提取器负责将这些文档"解读"成系统可以处理的文本内容。它支持多种常见文件格式,确保你的文档内容能够被正确提取和处理,并转换为大型语言模型可以有效使用的格式。 你可以选择 Dify 文档提取器来处理文件,也可以根据你的需求从 Dify Marketplace 中选择更多工具。Marketplace 提供了如 Dify Extractor 以及 MinerU、Unstructured 等第三方工具。 + +#### 文档提取器 (Doc Extractor) + +![文档提取器](/images/knowledge-base/knowledge-pipeline-orchestration-4-1.png) + +文档提取器节点可以理解为一个信息处理中心,通过识别并读取输入变量中的文件,提取信息后转化为下一个节点可使用的格式。 + + +关于文档提取器的详细功能和配置方法,请参考[文档提取器](/zh-hans/guides/workflow/node/doc-extractor)。 + + +#### Dify 提取器 (Dify Extractor) + +Dify Extractor 是 Dify 开发的一款内置文档解析器。它支持多种常见文件格式,并针对 Doc 文件进行了专门优化。它能够从文档中提取图片,进行存储并返回图片的 URL。 + +![Dify Extractor](/images/knowledge-base/knowledge-pipeline-orchestration-5.png) + +#### MinerU + +
+
+ ![MinerU](/images/knowledge-base/knowledge-pipeline-orchestration-6.png) +
+
+ MinerU 是一款高质量文档解析器,可将文档转换为机器可读格式(Markdown、JSON),专注于保留复杂结构和数学符号。 + + 与基础 PDF 提取器相比,MinerU 会移除页眉、页脚和页码,同时保持语义连贯性。它还能自动检测扫描 PDF 和乱码文档,支持 84 种语言的 OCR 功能。建议使用 MinerU 处理包含复杂公式的科学论文(自动转换为 LaTex)、多栏布局、包含混合内容(文本+图片+表格)的学术出版物文档。 +
+
+ +#### Unstructured + +
+
+ ![Unstructured](/images/knowledge-base/knowledge-pipeline-orchestration-7.png) +
+
+ Unstructured 将文档转换为结构化的机器可读格式,具有高度可定制的处理策略。它提供多种提取策略(auto、hi_res、fast、OCR-only)和分块方法(by_title、by_page、by_similarity)来处理各种文档类型,提供详细的元素级元数据,包括坐标、置信度分数和布局信息。推荐用于企业文档工作流、混合文件类型处理以及需要精确控制文档处理参数的场景。 +
+
+ +你可前往 [Dify Marketplace](https://marketplace.dify.ai) 探索更多工具。 + +### 分块器 (Chunker) + +在构建 AI 应用时,我们需要处理大量和不同种类的文档内容,比如产品手册、技术文档或论文等。和人类有限的注意力相似,大型语言模型无法同时处理过多的信息。因此,在信息提取后,分块器将大段的文档内容拆分成更小、更易于管理的片段(称为"块")。这就好比一本很厚的书,被分成了许多章节,你可以通过阅读目录快速定位到相关内容所在章节。 + +当 AI 应用需要回答问题时,良好的分块策略能够提供足够的上下文信息,并包含完整的语义。这样,当检索到对应的片段时,大型语言模型能够基于这个片段中的信息生成较为准确的答案。 + +不同类型的文档需要不同的分块策略,比如产品手册可能需要按照产品型号进行分块,确保产品功能介绍的完整性;论文则需要根据逻辑结构进行分块,确保论点叙述的流畅性。基于这样的多样性,Dify 提供了 3 种分块器,帮助你根据不同文档类型和使用场景进行选择和使用。 + +#### 分块器类型概述 + +| 类型 | 特点 | 使用场景 | +|------|------|----------| +| 通用分块器 | 固定大小分块,支持自定义分隔符 | 结构简单的基础文档 | +| 父子分块器 | 双层分段结构,平衡匹配精准度和上下文 | 需要较多上下文信息的复杂文档结构 | +| 问答处理器 | 处理表格中的问答组合 | CSV 和 Excel 的结构化问答数据 | + +#### 通用文本预处理规则 + +| 处理选项 | 说明 | +|----------|------| +| 替换连续空格、换行符和制表符 | 将文档中的连续空格、换行符和制表符替换为单个空格 | +| 移除所有 URL 和邮箱地址 | 自动识别并移除文本中的网址链接和邮箱地址 | + +#### 通用分块器 (General Chunker) + +基础文档分块处理,适用于结构相对简单的文档,你可以参考下面的配置对文本的分块、文本预处理规则进行配置。 + +**输入输出变量** + +| 类型 | 变量 | 说明 | +|------|------|------| +| 输入变量 | `{x} Content` | 完整的文档内容块,通用分块器将其拆分为若干小段 | +| 输出变量 | `{x} Array[Chunk]` | 分块后的内容数组,每个片段适合进行检索和分析 | + +**分块设置 (Chunk Settings)** + +| 配置项 | 说明 | +|--------|------| +| 分段标识符 (Delimiter) | 默认值为 `\n`,即按照文本段落分段。你可以遵循正则表达式语法自定义分块规则,系统将在文本出现分段标识符时自动执行分段。 | +| 分段最大长度 (Maximum Chunk Length) | 指定分段内的文本字符数最大上限,超出该长度时将强制分段。 | +| 分段重叠长度 (Chunk Overlap) | 对数据进行分段时,段与段之间存在一定的重叠部分。这种重叠可以帮助提高信息的保留和分析的准确性,提升召回效果。 | + +#### 父子分块器 (Parent-child Chunker) + +父子分块器采用双层分段结构解决了上下文与准确度之间的矛盾,在检索增强生成(RAG)系统中实现了准确匹配与全面的上下文信息的平衡。 + +**父子检索的工作机制** + +- **使用子分块匹配查询**:使用小而精准的信息片段(通常简洁到段落中的单个句子)来匹配用户查询。这些子分块能够实现精确且相关的初始检索。 +- **父分块提供丰富的上下文**:检索包含匹配子分块的更大范围内容(如段落、章节甚至整个文档)。这些父分块为大语言模型(LLM)提供全面的上下文信息。 + +**输入输出变量** + +| 类型 | 变量 | 说明 | +|------|------|------| +| 输入变量 | `{x} Content` | 完整的文档内容块,通用分块器将其拆分为若干小段 | +| 输出变量 | `{x} Array[ParentChunk]` | 父分块数组 | + +**分块设置 (Chunk Settings)** + +| 配置项 | 说明 | +|--------|------| +| 父分块分隔符 (Parent Delimiter) | 设置父分块的分割标识符 | +| 父分块最大长度 (Parent Maximum Chunk Length) | 控制父分块的最大字符数 | +| 子分块分隔符 (Child Delimiter) | 设置子分块的分割标识符 | +| 子分块最大长度 (Child Maximum Chunk Length) | 控制子分块的最大字符数 | +| 父块模式 (Parent Mode) | 选择"段落"(将文本分割为段落)或"完整文档"(使用整个文档作为父分块)进行直接检索 | + +#### 问答处理器 Q&A Processor (Extractor+Chunker) + +问答处理器结合了提取和分块功能,专门用于处理 CSV 和 Excel 文件的结构化问答数据集,比如常见问题(FAQ)列表、排班表等。 + +**输入输出变量** + +| 类型 | 变量 | 说明 | +|------|------|------| +| 输入变量 | `{x} Document` | 单个文档 | +| 输出变量 | `{x} Array[QAChunk]` | 问答分块数组 | + +**变量配置** + +| 名称 | 说明 | +|------|------| +| 问题所在的列 | 将内容所在的列设置为问题 | +| 答案所在的列 | 将内容所在的列设置为答案 | + +## 步骤三:配置知识库节点 + +在完成数据处理后,我们将进入知识流水线的最后一个环节 — 知识库节点。你可以根据实际需求,在这个节点选择不同的索引方法和检索策略,以获得最适合的检索效果和成本控制。 + +知识库节点配置分为以下部分:输入变量、分段结构、索引方式以及检索设置。 + +### 分段结构 (Chunk Structure) + +![分段结构](/images/knowledge-base/knowledge-pipeline-orchestration-8.png) + +分段结构决定了知识库如何组织和索引你的文档内容。你可以根据文档类型、使用场景和成本考虑来选择最适合的结构模式。 + +知识库支持两种分段模式:通用模式与父子模式。如果你是首次创建知识库,建议选择父子模式。 + + + **重要提醒**:分段结构一旦保存发布后无法修改,请根据实际需求进行选择。 + + +#### 通用模式 + +适用于大多数标准文档处理场景。 +通用模式提供灵活的索引选项,你可以根据对质量和成本的不同要求选择合适的索引方法。通用模式支持高质量和经济的索引方式,以及多种检索设置。 + +#### 父子模式 + +父子模式能够在检索时,提供精确匹配和对应的上下文信息,适用于需要保持完整上下文的专业文档。父子模式仅支持 HQ (高质量)模式,检索时提供子分块匹配和父分块上下文。 + +#### 问答模式 (Question-Answer) + +在使用结构化问答数据时,你可以创建问题与答案配对的文档。这些文档会根据问题部分进行索引,从而使系统能够根据查询相似性检索到相关的答案。问答模式仅支持 HQ(高质量)模式。 + +### 输入变量 (Input Variable) + +输入变量用于接收来自数据处理节点的处理结果,用作知识库构建的数据源。你需要将前面配置的分块器节点的输出,连接到知识库节点并作为输入。 + +该节点根据所选的分段结构,支持不同类型的标准输入: +- **通用模式**:`{x} Array[Chunk]` - 通用分块数组 +- **父子模式**:`{x} Array[ParentChunk]` - 父分块数组 +- **问答模式**:`{x} Array[QAChunk]` - 问答分块数组 + +### 索引方式 (Index Method) 与检索设置 (Retrieval Setting) + +索引方式决定了知识库如何建立内容索引,检索设置则基于所选的索引方式提供相应的检索策略。你可以这么理解,索引方式决定了整理文档的方式,而检索设置告知使用者可以用什么方法来查找文档。 + +知识库提供了两种索引方式:高质量和经济,分别提供不同的检索设置选项。 +在高质量模式下,使用 Embedding 嵌入模型将已分段的文本块转换为数字向量,帮助更加有效地压缩与存储大量文本信息。这使得即使用户的问题用词与文档不完全相同,系统也能找到语义相关的准确答案。 + + +请查看[设定索引方法与检索设置](/zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents/setting-indexing-methods),了解更多详情。 + + +#### 索引方式和检索设置 + +| 索引方式 | 可用检索设置 | 说明 | +|----------|--------------|------| +| 高质量 | 向量搜索 | 基于语义相似度,理解查询深层含义。 | +| | 全文检索 | 基于关键词匹配的检索方式,提供全面的检索能力。 | +| | 混合检索 | 结合语义和关键词 | +| 经济 | 倒排索引 | 搜索引擎常用的检索方法,匹配问题与关键内容。 | + +关于配置分段结构、索引方法、配置参数和检索设置,你也可以参考下方表格。 + +| 分段结构 | 可选索引方式 | 可配置参数 | 可用检索设置 | +|----------|--------------|------------|--------------| +| 通用模式 | 高质量


经济 | Embedding 嵌入模型


关键词数量 | 向量检索
全文检索
混合检索
倒排索引 | +| 父子模式 | 高质量(仅支持) | Embedding Model 嵌入模型 | 向量检索
全文检索
混合检索 | +| 问答模式 | 高质量(仅支持) | Embedding Model 嵌入模型 | 向量检索
全文检索
混合检索 | + +## 步骤四:配置用户输入表单 + +用户输入表单对于收集流水线运行所需的有效初始信息非常重要。类似于工作流中的[开始节点](/zh-hans/guides/workflow/node/start),这个表单从用户那里收集必要的相信信息,比如:需要上传的文件、文档处理的特定参数等,确保流水线拥有提供准确结果所需要的所有信息。 + +通过这种方式,你可以为不同的使用场景创建特定的的输入表单,提高流水线对于不同数据源和文档处理流程的灵活性和易用性。 + +### 创建用户输入表单 + +你可以通过下面两种方式,创建用户输入表单。 + +1. **知识流水线编排界面** + 点击输入字段(Input Field)开始创建和配置输入表单。 + + ![输入表单](/images/knowledge-base/knowledge-pipeline-orchestration-9.png) + +2. **节点参数面板** + 选中节点,在右侧的面板需要填写的参数内,点击最下方的`+ 创建用户输入字段`(+ Create user input)来创建新的输入项。新增的输入项将会汇总到输入字段(Input Field)的表单内。 + + ![节点参数](/images/knowledge-base/knowledge-pipeline-orchestration-10.png) + +### 输入类型 + +#### 非共享输入 (Unique Inputs for Each Entrance) + +![非共享输入](/images/knowledge-base/knowledge-pipeline-orchestration-11.png) + +这类输入适用于每个数据源及其下游节点,用户只需在选择对应数据源时填写这些字段,比如不同数据源的URL。 + +在数据源右侧点击"+"按钮,为该数据源添加字段。这个字段只能被该数据源及其后续连接的节点引用。 + +![数据源字段](/images/knowledge-base/knowledge-pipeline-orchestration-12.png) + +#### 全局共享输入 (Global Inputs for All Entrance) + +![全局共享输入](/images/knowledge-base/knowledge-pipeline-orchestration-13.png) + +全局共享输入可以被所有节点引用。这类输入适用于通用处理参数,比如分隔符、最大分块长度、文档处理配置等。无论用户选择哪个数据源,都需要填写这些字段。 + +在全局共享输入右侧点击"+"按钮,添加的字段将被任意节点引用。 + +### 支持字段类型和填写说明 + +知识流水线支持以下七种类型的输入变量。 +
+
+ ![字段类型](/images/knowledge-base/knowledge-pipeline-orchestration-14.png) +
+
+ | 字段类型 | 说明 | + |----------|------| + | 文本 | 短文本,由知识库使用者自行填写,最大长度为 256 字符 | + | 段落 | 长文本,知识库使用者可以输入较长字符 | + | 下拉选项 | 由编排者预设的固定选项供使用者选择,使用者无法自行填写内容 | + | 布尔值 | 只有真/假两个取值 | + | 数字 | 只能输入数字 | + | 单文件 | 上传单个文件,支持多种文件类型(文档、图片、音频、视频和其他文件类型) | + | 文件列表 | 批量上传文件,支持多种文件类型(文档、图片、音频、视频和其他文件类型) | +
+
+ + + 请前往[输入字段](/zh-hans/guides/workflow/node/start#%E8%BE%93%E5%85%A5%E5%AD%97%E6%AE%B5),了解关于支持字段的更多说明。 + + +所有类型的输入项包含:必填项、非必填项和更多设置,可以通过勾选设置为是否为必填。 + +| 名称 | 说明 | 示例 | +|------|------|------| +| **必填项** | | | +| 变量名称 Variable Name | 系统内部标识名称,通常使用英文和下划线进行命名 | `user_email` | +| 显示名称 Display Name | 界面展示的名称,通常是简洁易读的文字 | 用户邮箱 | +| **类型特定设置** | 不同字段类型的特殊要求 | 文本的最大长度为 100 字符 | +| **更多设置** | | | +| 默认值 Default Value | 用户未输入时的默认值 | 数字字段默认为0, 文本字段默认为空 | +| 占位符 Placeholder | 输入框空白时的提示文字 | 请输入您的邮箱 | +| 提示 Tooltip | 解释或指引用户进行填写的文字,通常在用户鼠标悬停时显示 | 请输入有效的邮箱地址 | +| **特殊非必填信息** | 根据不同字段类型的额外设置选项 | 邮箱格式验证 | + +配置完成后,点击右上角的预览按钮,你可以在弹出的表单预览界面中浏览。你可以拖拽调整字段的分组,如果出现感叹号,则表明移动后引用失效。 + +![表单预览](/images/knowledge-base/knowledge-pipeline-orchestration-15.png) + +## 步骤五:为知识库命名 + +![命名知识库](/images/knowledge-base/create-knowledge-pipeline-11.png) + +默认情况下,知识库名称为"Untitled + 序号”,权限设置为"仅自己可见”,图表为橙色书本。如果你使用 DSL文件导入,则将使用其保存的图标。 + +点击左侧面板中的设置并填写以下信息: +- **名称和图标** +为你的知识库命名。你还可以选择一个 emoji、上传图片或粘贴图片 URL 作为知识库的图标。 +- **知识库描述** + 简要描述您的知识库。这有助于 AI 更好地理解和检索您的数据。如果留空,Dify 将应用默认的检索策略。 +- **权限** + 从下拉菜单中选择适当的访问权限。 + +## 步骤六:测试 + +在完成编排后,你需要先验证配置的完整性,然后测试流水线运行效果,确认各项设置正确无误,最后发布知识库。 + +### 检查配置完成度 + +在进行测试前,建议先检查配置的完整性,避免因遗漏配置而导致测试失败。 + +点击右上角的检查清单按钮,系统会显示遗漏部分。 + +![检查清单](/images/knowledge-base/knowledge-pipeline-orchestration-16.png) + +完成所有的配置后,可以通过测试运行来预览知识流水线的运行效果,确认各项设置准确无误,再进行发布。 + +### 测试运行 (Test Run) + +![测试运行](/images/knowledge-base/knowledge-pipeline-orchestration-17.png) + +1. **开始测试**:点击右上角的测试运行(Test Run)按钮。 +2. **导入测试文件**:在右侧弹出的数据源窗口中,导入文件。 + + **重要提醒**:为了便于调试和观测,在测试运行状态下,每次仅允许上传一个文件。 + +3. **填写参数**:导入成功后,根据你之前配置的用户输入表单填写对应参数 +4. **开始试运行**:点击下一步,开始测试整个流水线。 + +在测试期间,你可以访问[运行历史](/zh-hans/guides/workflow/debug-and-preview/history-and-logs#%E5%BA%94%E7%94%A8%E8%B0%83%E8%AF%95%E5%8E%86%E5%8F%B2)(记录所有运行记录,包括运行时间、执行状态和输入/输出参数概要)和[变量检查](/zh-hans/guides/workflow/debug-and-preview/variable-inspect)(位于底部面板,它显示每个节点的输入/输出数据,帮助你识别问题和验证数据流),以实现高效的故障排除和错误修复。 + +![测试工具](/images/knowledge-base/knowledge-pipeline-orchestration-18.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/guides/knowledge-base/knowledge-pipeline/knowledge-pipeline-orchestration.mdx) | [报告问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/zh-hans/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx b/zh-hans/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx new file mode 100644 index 00000000..b64b7f1c --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx @@ -0,0 +1,25 @@ +--- +title: "步骤五:管理和使用知识库" +--- + +创建知识库后,你可以继续对其进行管理和优化,以确保它能为你的应用程序提供准确的的上下文信息。通过以下方式,你可以对知识库文件的进行更新、进行召回测试、修改流水线和修改知识库的属性等: + +### 流水线 + +浏览编排的流水线,并对节点和配置进行修改。 + + + 你可前往[管理知识库文档](/zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance/introduction),了解更多内容。 + + +![知识管理](/images/knowledge-base/create-knowledge-pipeline-21.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/guides/knowledge-base/knowledge-pipeline/manage-knowledge-base.mdx) | [报告问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/zh-hans/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx b/zh-hans/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx new file mode 100644 index 00000000..c3ed633e --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx @@ -0,0 +1,51 @@ +--- +title: "步骤三:发布知识流水线" +--- + +完成知识流水线的编排和调试后,点击**发布**并在弹窗中点击**确认**,即成功发布知识流水线。 + +
+
+ ![发布确认](/images/knowledge-base/create-knowledge-pipeline-12-1.png) +
+
+ ![发布成功](/images/knowledge-base/create-knowledge-pipeline-12.png) +
+
+ + + **注意:知识流水线发布后,分段结构无法进行修改。** + 由于分段结构会影响知识库的存储方式和检索召回策略,为确保数据一致性和用户体验,当前每个知识库仅支持**一种分段结构**。 + + +
+
+ ![发布完成](/images/knowledge-base/create-knowledge-pipeline-13.png) +
+
+ 成功发布后,你可以进行如下操作:

+ + **添加文档(Go to add documents)** + 点击此选项可以跳转到知识库选择数据源界面,你可以直接上传文档。

+ + **访问 API(Access API Reference)** + 前往 API 文档页面,你可以获取知识库的 API 调用方法和说明。

+ + **发布为流水线(Publish as a Knowledge Pipeline)** + 你可以点击发布为知识流水线将该流水线保存为可复用的模版,该模版将出现在自定义模版中。 +
+
+ + + 限制说明:Sandbox 不支持发布为知识流水线功能。如需保存并发布为知识流水线,请[升级](https://dify.ai/pricing)至 Professional 或者 Team 方案。 + + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/guides/knowledge-base/knowledge-pipeline/publish-knowledge-pipeline.mdx) | [报告问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/zh-hans/guides/knowledge-base/knowledge-pipeline/readme.mdx b/zh-hans/guides/knowledge-base/knowledge-pipeline/readme.mdx new file mode 100644 index 00000000..80d67311 --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-pipeline/readme.mdx @@ -0,0 +1,51 @@ +--- +title: 通过知识流水线创建知识库 +--- + +知识流水线是构建处理文档流程的一种解决方案,你能够像编排工作流一样对不同节点进行可视化地组合和配置,并选择使用不同工具来优化数据处理过程。 + +它主要包含四个环节,每个环节由不同的节点和工具组成,形成完整的数据处理链路: + +**数据源 → 数据提取 → 数据处理 → 知识库存储** + +每个步骤都有特定的用途:从各种来源收集内容,将其转换为可处理的文本,优化以便搜索,并以能够快速、准确检索的格式进行存储。 + +此外,Dify 还提供不同使用场景的知识流水线模板,帮助提升数据索引和检索结果的准确度。本章节将帮助你了解知识流水线的创建方式、流程以及相应节点,让你能快速搭建和优化自己的知识库。 + + + + + 从内置模板、空白知识库流水线开始创建,或导入现有流水线。 + + + + + 了解知识库流水线的工作原理,编排不同节点,构建你需要的的数据处理流程。 + + + + + 测试配置无误后,发布流水线,准备进行文档处理。 + + + + + 添加文档,经过处理后构建成可搜索的知识库。 + + + + + 日常维护文档、测试检索效果、修改设置等。 + + + + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/guides/knowledge-base/knowledge-pipeline/create-from-knowledge-pipeline.mdx) | [报告问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file diff --git a/zh-hans/guides/knowledge-base/knowledge-pipeline/upload-files.mdx b/zh-hans/guides/knowledge-base/knowledge-pipeline/upload-files.mdx new file mode 100644 index 00000000..492112e7 --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-pipeline/upload-files.mdx @@ -0,0 +1,57 @@ +--- +title: "步骤四:上传文件" +--- + +完成知识流水线的编排、调试并发布成功后,你能通过以下两种方式上传文件: + + A. 在发布成功的弹窗哪点击前往文档。进入文档页面后,点击添加文件进行上传。 +
+
+ ![方式A-1](/images/knowledge-base/create-knowledge-pipeline-14.png) +
+
+ ![方式A-2](/images/knowledge-base/create-knowledge-pipeline-15.png) +
+
+ B. 在发布的下拉菜单中,点击去添加文档。进入选择数据源页面,选择对应数据源开始上传文件。 +
+
+ ![方式B-1](/images/knowledge-base/create-knowledge-pipeline-16.png) +
+
+ ![方式B-2](/images/knowledge-base/create-knowledge-pipeline-17.png) +
+
+ +### 上传流程 + +1. **选择数据源** + 从流水线配置的数据源类型中进行选择。目前,Dify 支持 4 种数据源 + **文件上传(pdf, docx 等)、在线网盘(Google Drive, OneDrive 等)、在线文档(Notion)和 网页爬虫(Jina Reader 和 Firecrawl)。** + 请前往 [Dify Marketplace](https://marketplace.dify.ai/) 获取更多数据源支持。 + +2. **填写文件处理相关参数和变量** + 如果你在知识流水线的编排过程中配置了用户输入字段,需要在这一步填写所需的参数和变量。完成填写后,点击**预览分段**可进行预览。 + 点击保存并处理完成知识库创建,进入数据处理阶段。 + + 注意:分段结构与知识流水线内保持一致,不会因用户输入的文件处理参数和变量而改变。 + + ![参数填写](/images/knowledge-base/create-knowledge-pipeline-18.png) + +3. **文档处理** + 跟踪文档处理的进度。嵌入完成后,点击**前往文档**。 + ![处理进度](/images/knowledge-base/create-knowledge-pipeline-19.png) + +4. **查看文件列表** + 点击**前往文档**,前往知识库文档界面。在这里,你可以浏览上传文件数量、处理进程和状态等。 + ![文档列表](/images/knowledge-base/create-knowledge-pipeline-20.png) + +{/* +Contributing Section +DO NOT edit this section! +It will be automatically generated by the script. +*/} + +--- + +[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/zh-hans/guides/knowledge-base/knowledge-pipeline/upload-files.mdx) | [报告问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml) \ No newline at end of file