In knowledge pipelines, the Knowledge Base node supports input in two multimodal data formats: multimodal-Parent-Child and multimodal-General.
For the Knowledge Base node to recognize and embed a tool plugin’s multimodal output (such as text, images, audio, or video), complete two configurations:
- In the tool code file: Call the tool session interface to upload files and construct the
filesobject. - In the tool provider YAML file: Declare the
output_schemaas eithermultimodal-Parent-Childormultimodal-General.
Upload Files and Construct File Objects#
When processing multimodal data such as images, first upload the file through Dify’s tool session to obtain the file metadata.
The following example, taken from the official Dify Extractor plugin, shows how to upload a file and construct a files object.
The upload interface returns an UploadFileResponse object containing the file information:
Map the file information (name, size, extension, mime_type, and so on) to the files field in the multimodal output structure.
Declare Multimodal Output Structure#
Dify’s official JSON schemas define the structure of multimodal data.
To let the Knowledge Base node recognize the plugin’s multimodal output type, point the result field under output_schema in the plugin’s provider YAML file to the corresponding official schema URL.
For example, a complete YAML configuration using multimodal-Parent-Child looks like this: