Dify Knowledge Base icon

Dify Knowledge Base

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

Segment → Delete

AI-generated

Overview

This node manages segments within a knowledge base dataset in the Dify AI platform. Specifically, the Delete Segment operation removes a segment identified by its ID from a specified dataset. This is useful for maintaining and cleaning up datasets by removing outdated or irrelevant segments.

Practical examples include:

  • Deleting obsolete content segments from a dataset to keep the knowledge base current.
  • Removing incorrect or duplicate segments after data import.
  • Automating cleanup workflows where segments no longer needed are programmatically deleted.

Properties

Name Meaning
Dataset ID The unique identifier of the dataset containing the segment to delete.
Segment ID The unique identifier of the segment that you want to delete from the dataset.

Output

The node outputs a JSON object representing the result of the delete operation. Typically, this will confirm whether the segment was successfully deleted or provide details about the deletion status. The exact structure depends on the API response but generally includes confirmation fields or metadata related to the deleted segment.

No binary data output is involved in this operation.

Dependencies

  • Requires an API key credential for authenticating with the Dify AI platform.
  • The node uses the base URL and authorization token configured in the credentials to make HTTP requests to the Dify API.
  • Proper permissions on the API key are necessary to perform delete operations on segments.

Troubleshooting

  • Common issues:

    • Invalid or missing Dataset ID or Segment ID will cause the operation to fail.
    • Insufficient permissions on the API key may result in authorization errors.
    • Attempting to delete a non-existent segment will likely return an error from the API.
  • Error messages:

    • "The operation "delete" is not supported for resource "segment": Indicates a misconfiguration or unsupported operation; ensure the correct resource and operation are selected.
    • API errors related to authentication or authorization suggest checking the API key validity and permissions.
    • Errors mentioning missing parameters indicate that required inputs like Dataset ID or Segment ID were not provided.

To resolve these issues, verify input values, check API credentials, and ensure the segment exists before attempting deletion.

Links and References

Discussion