Dify Knowledge Base icon

Dify Knowledge Base

Manage Dify AI knowledge base datasets, documents, segments, and metadata with comprehensive CRUD operations

Segment → Get Children

AI-generated

Overview

The node interacts with a knowledge base system to manage datasets, documents, segments, and metadata. Specifically, the "Segment" resource with the "Get Children" operation retrieves child segments of a given segment within a dataset. This is useful for hierarchical data structures where segments can have nested sub-segments, allowing users to explore or manipulate segment trees.

Practical examples include:

  • Retrieving all subsections (child segments) of a document segment to analyze or process them individually.
  • Navigating through nested content in a knowledge base for detailed querying or updates.

Properties

Name Meaning
Dataset ID The unique identifier of the dataset containing the segment.
Segment ID The unique identifier of the parent segment whose children are to be retrieved.

Output

The output JSON contains the list of child segments related to the specified parent segment within the dataset. Each child segment typically includes its own metadata and content details as defined by the knowledge base API.

If the node supports binary data output, it would represent any associated files or attachments linked to the segments, but this operation primarily returns structured JSON data about segment children.

Dependencies

  • Requires an API key credential for authenticating requests to the external knowledge base service.
  • Needs the base URL of the knowledge base API configured in the node credentials.
  • Relies on the external knowledge base API endpoints to fetch segment children.

Troubleshooting

  • Common issues:

    • Invalid or missing Dataset ID or Segment ID will cause errors; ensure these IDs are correct and exist.
    • Network or authentication failures due to incorrect API key or base URL configuration.
    • Attempting to get children of a segment that has none may return empty results or specific error messages.
  • Error messages:

    • "The operation "getChildren" is not supported for resource "segment": Indicates a misconfiguration or unsupported operation; verify the operation name.
    • Authentication errors usually mention invalid token or unauthorized access; check API key validity.
    • "The resource "segment" is not supported": Means the resource parameter is incorrect or not recognized.

Resolving these involves verifying input parameters, ensuring proper credential setup, and confirming the segment exists in the dataset.

Links and References

  • Refer to the official knowledge base API documentation for details on segment and child segment management.
  • n8n documentation on creating and using custom nodes for API integrations.

Discussion