Actions30
- Dataset Actions
- Document Actions
- Segment Actions
- Metadata Actions
Segment → List
AI-generatedOverview
This node interacts with the "Segment" resource of a knowledge base system, specifically supporting the "List" operation. It retrieves a list of segments associated with a particular document within a dataset. This is useful for scenarios where you want to fetch and process smaller parts or sections (segments) of a document stored in a knowledge base, such as for content analysis, search indexing, or data extraction.
Practical examples include:
- Retrieving all text segments from a document to perform sentiment analysis.
- Listing segments to display them in a user interface for review or editing.
- Fetching segments filtered by keywords or sorted by creation date or position.
Properties
| Name | Meaning |
|---|---|
| Dataset ID | The unique identifier of the dataset containing the document. |
| Document ID | The unique identifier of the document whose segments are to be listed. |
| Additional Fields | Optional parameters to refine the listing: |
| - Page | Page number for pagination (default is 1). |
| - Limit | Maximum number of results to return per page (minimum 1, default 50). |
| - Sort | Sorting order of the results. Options: |
| • Created At (Ascending) | |
| • Created At (Descending) | |
| • Position (Ascending) | |
| • Position (Descending) | |
| - Keyword | Filter segments by a keyword string to narrow down results. |
Output
The output is an array of segment objects in JSON format. Each object represents a segment belonging to the specified document and dataset. The exact structure of each segment object depends on the API response but typically includes fields like segment content, position, creation timestamp, and possibly metadata.
If binary data were involved (not indicated here), it would represent file contents or attachments related to segments, but this operation focuses on JSON data only.
Dependencies
- Requires an API key credential for authenticating requests to the Dify AI knowledge base service.
- The node uses the base URL and authorization token configured in the credentials.
- No other external dependencies are indicated.
Troubleshooting
Common issues:
- Missing or incorrect Dataset ID or Document ID will cause errors or empty results.
- Pagination parameters out of range may result in no data returned.
- Invalid sort option values can cause request failures.
- Network or authentication errors if API key or base URL is misconfigured.
Error messages:
"The operation "list" is not supported for resource "segment": Indicates a mismatch in operation-resource selection; ensure correct configuration.- API errors related to authorization usually mean the API key is invalid or expired.
- Errors mentioning missing required parameters suggest Dataset ID or Document ID was not provided.
To resolve these, verify input parameters, check API credentials, and confirm network connectivity.
Links and References
- Dify AI Knowledge Base API Documentation (hypothetical link)
- n8n documentation on Creating Custom Nodes