Actions30
- Dataset Actions
- Document Actions
- Segment Actions
- Metadata Actions
Dataset → Get Chunks
AI-generatedOverview
The node interacts with a Dify AI knowledge base, specifically managing datasets and their content. The Get Chunks operation for the Dataset resource retrieves relevant text chunks (segments) from a specified dataset based on a query string. This is useful for searching within large datasets to find the most pertinent pieces of information.
Typical use cases include:
- Extracting relevant document segments matching a search query.
- Implementing semantic or full-text search over knowledge base datasets.
- Filtering results by relevance score thresholds to improve result quality.
For example, you might use this node to query a customer support knowledge base dataset to retrieve the top 4 most relevant answer snippets related to a user's question.
Properties
| Name | Meaning |
|---|---|
| Dataset ID | The unique identifier of the dataset to search within. |
| Query | The text query used to perform hit testing against the dataset's content. |
| Additional Fields | A collection of optional parameters: |
| - Search Method | The method used for searching: "Semantic Search", "Full Text Search", or "Hybrid Search". |
| - Top K | Number of top matching chunks to return (default is 4). |
| - Score Threshold Enabled | Whether to filter results by a minimum score threshold (true/false). |
| - Score Threshold | The minimum score a chunk must have to be included in results (only active if filtering is enabled). |
Output
The output contains JSON data representing the retrieved chunks from the dataset that match the query. Each item typically includes details about the chunk such as its content, metadata, and relevance score.
If binary data were involved (e.g., files), it would be summarized accordingly, but this operation focuses on textual chunk retrieval.
Dependencies
- Requires an API key credential for authenticating with the Dify AI knowledge base service.
- Needs the base URL of the Dify API configured in credentials.
- Relies on the external Dify Knowledge Base API endpoints to perform dataset chunk retrieval.
Troubleshooting
Common issues:
- Invalid or missing Dataset ID will cause the operation to fail.
- Incorrect or expired API key will result in authentication errors.
- Query string left empty or too generic may return no or irrelevant chunks.
- Enabling score threshold filtering without appropriate values may filter out all results.
Error messages:
"The operation "getChunks" is not supported for resource "dataset": Indicates a misconfiguration or unsupported operation call.- Authentication errors usually mention invalid token or unauthorized access; verify API key and permissions.
- Network or timeout errors suggest connectivity issues with the Dify API endpoint.
To resolve errors, ensure all required properties are correctly set, credentials are valid, and the dataset exists and is accessible.
Links and References
- Dify AI Knowledge Base Documentation (general reference for API and dataset management)
- n8n documentation on Creating Custom Nodes