Actions30
- Dataset Actions
- Document Actions
- Segment Actions
- Metadata Actions
Metadata → Create Tag
AI-generatedOverview
The node "Dify Knowledge Base" allows managing AI knowledge base datasets, documents, segments, and metadata through various CRUD operations. Specifically, the Metadata - Create Tag operation enables users to create a new tag within a specified dataset in the knowledge base. This is useful for organizing and categorizing data by tagging datasets with meaningful labels.
Common scenarios include:
- Adding descriptive tags to datasets for easier filtering and searching.
- Color-coding tags to visually distinguish categories or priorities.
- Automating metadata management workflows by programmatically creating tags based on external triggers or data.
Example: Automatically create a tag named "Important" with a red color for a dataset identified by its ID, helping team members quickly identify critical datasets.
Properties
| Name | Meaning |
|---|---|
| Dataset ID | The unique identifier of the dataset where the tag will be created. |
| Name | The name of the tag to create. |
| Additional Fields | Optional extra fields for the tag: - Name (only when updating a tag) - Color: Hex code representing the tag's color (e.g., #1890ff). |
Output
The node outputs JSON data representing the newly created tag object. This typically includes details such as the tag's ID, name, color, and associated dataset ID. The output can be used downstream in workflows to reference the created tag or confirm successful creation.
No binary data output is involved in this operation.
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 from the configured credentials.
- No additional external dependencies are required beyond the API access.
Troubleshooting
Common issues:
- Missing or invalid Dataset ID: Ensure the dataset ID provided exists and is correctly formatted.
- Duplicate tag names: The API might reject creating a tag with a name that already exists in the dataset.
- Invalid color code: The color field must be a valid hex color string (e.g.,
#FF0000).
Error messages:
"The operation "createTag" is not supported for resource "metadata": Indicates a misconfiguration or typo in the operation or resource selection.- API authentication errors: Check that the API key credential is correctly set up and has necessary permissions.
- Validation errors from the API: Review input values for correctness, especially required fields like Dataset ID and Name.
Resolving these usually involves verifying input parameters, ensuring correct credentials, and confirming the dataset exists.
Links and References
- Dify AI Knowledge Base API Documentation (hypothetical link, replace with actual if available)
- n8n Documentation on Creating Custom Nodes
- General info on Hex Color Codes