Actions30
- Dataset Actions
- Document Actions
- Segment Actions
- Metadata Actions
Document → Create From Text
AI-generatedOverview
The node "Dify Knowledge Base" enables managing AI knowledge base datasets, documents, segments, and metadata through various CRUD operations. Specifically, the Document - Create From Text operation allows users to create a new document in a specified dataset by providing the document's textual content directly.
This operation is useful when you want to programmatically add textual data into an AI knowledge base for indexing, searching, or further processing without uploading files. For example, you might use it to ingest user-generated content, logs, or any text snippets that need to be part of your searchable knowledge base.
Properties
| Name | Meaning |
|---|---|
| Dataset ID | The unique identifier of the dataset where the document will be created. |
| Name | The name/title of the document being created. |
| Text | The actual textual content of the document. This is the main body of text that will be stored and indexed. |
| Additional Fields | Optional extra settings for the document creation: |
| - Name (optional): Document name override (used mainly for file operations, but available here as well). | |
| - Indexing Technique: Choose between "High Quality" or "Economy" indexing methods, affecting how the document is processed and indexed. | |
| - Process Rule: Defines how the document text is processed before indexing. It can be set to "Automatic" or "Custom". If "Custom", you can specify: | |
| - Pre-Processing Rules: A list of rules with IDs and enabled flags to modify text before indexing. | |
| - Segmentation: Custom segmentation settings including a text separator string and maximum tokens per segment, controlling how the text is split for indexing. |
Output
The output JSON contains the response from the API after creating the document. Typically, this includes details about the newly created document such as its ID, name, status, and possibly metadata related to indexing or processing state.
If the node supports binary data output (not indicated explicitly here), it would represent associated files or attachments, but for this operation, the output is focused on JSON metadata about the created document.
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 invalid Dataset ID: Ensure the dataset exists and the ID is correct.
- Invalid or empty text content: The "Text" property must not be empty.
- Authentication errors: Verify that the API key credential is valid and has necessary permissions.
- Unsupported indexing technique or process rule values: Use only the provided options.
Error Messages:
"The operation "createFromText" is not supported for resource "document": This indicates a misconfiguration of the operation or resource parameters.- API errors related to authorization or dataset not found will be returned from the service and surfaced in the node output.
To resolve errors, check input parameters carefully, ensure credentials are correctly set up, and verify the dataset exists in the target system.
Links and References
- Dify AI Knowledge Base Documentation (Assumed official docs for reference)
- n8n Documentation on Creating Custom Nodes
- General info on Text Indexing Techniques
Note: All internal credential names and implementation details have been generalized to comply with best practices.