mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
279 lines
8.1 KiB
Plaintext
279 lines
8.1 KiB
Plaintext
---
|
|
dimensions:
|
|
type:
|
|
primary: reference
|
|
detail: core
|
|
level: beginner
|
|
standard_title: General Specs
|
|
language: en
|
|
title: General Specs
|
|
description: This article will briefly introduce common structures in plugin development. During development, it is strongly recommended to read this alongside [Basic Concepts of Plugin Development](/plugin-dev-en/0111-getting-started-dify-plugin) and the [Developer Cheatsheet](/plugin-dev-en/0111-cli) for a better understanding of the overall architecture.
|
|
---
|
|
|
|
### Path Specifications
|
|
|
|
When filling in file paths in Manifest or any yaml files, follow these two specifications depending on the type of file:
|
|
|
|
* If the target file is a multimedia file such as an image or video, for example when filling in the plugin's `icon`, you should place these files in the `_assets` folder under the plugin's root directory.
|
|
* If the target file is a regular text file, such as `.py` or `.yaml` code files, you should fill in the absolute path of the file within the plugin project.
|
|
|
|
### Common Structures
|
|
|
|
When defining plugins, there are some data structures that can be shared between tools, models, and Endpoints. These shared structures are defined here.
|
|
|
|
#### I18nObject
|
|
|
|
`I18nObject` is an internationalization structure that conforms to the [IETF BCP 47](https://tools.ietf.org/html/bcp47) standard. Currently, four languages are supported:
|
|
|
|
<ParamField path="en_US" type="string">
|
|
English (United States)
|
|
</ParamField>
|
|
|
|
<ParamField path="zh_Hans" type="string">
|
|
Simplified Chinese
|
|
</ParamField>
|
|
|
|
<ParamField path="ja_JP" type="string">
|
|
Japanese
|
|
</ParamField>
|
|
|
|
<ParamField path="pt_BR" type="string">
|
|
Portuguese (Brazil)
|
|
</ParamField>
|
|
|
|
#### ProviderConfig
|
|
|
|
`ProviderConfig` is a common provider form structure, applicable to both `Tool` and `Endpoint`
|
|
|
|
<ParamField path="name" type="string">
|
|
Form item name
|
|
</ParamField>
|
|
|
|
<ParamField path="label" type="I18nObject" required>
|
|
Display labels following [IETF BCP 47](https://tools.ietf.org/html/bcp47) standard
|
|
</ParamField>
|
|
|
|
<ParamField path="type" type="provider_config_type" required>
|
|
Form field type - determines how the field will be rendered in the UI
|
|
</ParamField>
|
|
|
|
<ParamField path="scope" type="provider_config_scope">
|
|
Optional range specification, varies based on the value of `type`
|
|
</ParamField>
|
|
|
|
<ParamField path="required" type="boolean">
|
|
Whether the field cannot be empty
|
|
</ParamField>
|
|
|
|
<ParamField path="default" type="any">
|
|
Default value, only supports basic types: `float`, `int`, `string`
|
|
</ParamField>
|
|
|
|
<ParamField path="options" type="array[provider_config_option]">
|
|
Available options, only used when type is `select`
|
|
</ParamField>
|
|
|
|
<ParamField path="helper" type="object">
|
|
Help document link label, following [IETF BCP 47](https://tools.ietf.org/html/bcp47)
|
|
</ParamField>
|
|
|
|
<ParamField path="url" type="string">
|
|
Help document link
|
|
</ParamField>
|
|
|
|
<ParamField path="placeholder" type="object">
|
|
Placeholder text in multiple languages, following [IETF BCP 47](https://tools.ietf.org/html/bcp47)
|
|
</ParamField>
|
|
|
|
#### ProviderConfigOption(object)
|
|
|
|
<ParamField path="value" type="string" required>
|
|
The value of the option
|
|
</ParamField>
|
|
|
|
<ParamField path="label" type="object" required>
|
|
Display label for the option, following [IETF BCP 47](https://tools.ietf.org/html/bcp47)
|
|
</ParamField>
|
|
|
|
#### ProviderConfigType(string)
|
|
|
|
<ParamField path="secret-input" type="string">
|
|
Configuration information that will be encrypted
|
|
</ParamField>
|
|
|
|
<ParamField path="text-input" type="string">
|
|
Plain text input field
|
|
</ParamField>
|
|
|
|
<ParamField path="select" type="string">
|
|
Dropdown selection field
|
|
</ParamField>
|
|
|
|
<ParamField path="boolean" type="boolean">
|
|
Switch/toggle control
|
|
</ParamField>
|
|
|
|
<ParamField path="model-selector" type="object">
|
|
Model configuration selector, including provider name, model name, model parameters, etc.
|
|
</ParamField>
|
|
|
|
<ParamField path="app-selector" type="object">
|
|
Application ID selector
|
|
</ParamField>
|
|
|
|
<ParamField path="tool-selector" type="object">
|
|
Tool configuration selector, including tool provider, name, parameters, etc.
|
|
</ParamField>
|
|
|
|
<ParamField path="dataset-selector" type="string">
|
|
Dataset selector (TBD)
|
|
</ParamField>
|
|
|
|
#### ProviderConfigScope(string)
|
|
|
|
When `type` is `model-selector`:
|
|
<ParamField path="all" type="string">
|
|
All model types
|
|
</ParamField>
|
|
<ParamField path="llm" type="string">
|
|
Large Language Models only
|
|
</ParamField>
|
|
<ParamField path="text-embedding" type="string">
|
|
Text embedding models only
|
|
</ParamField>
|
|
<ParamField path="rerank" type="string">
|
|
Reranking models only
|
|
</ParamField>
|
|
<ParamField path="tts" type="string">
|
|
Text-to-speech models only
|
|
</ParamField>
|
|
<ParamField path="speech2text" type="string">
|
|
Speech-to-text models only
|
|
</ParamField>
|
|
<ParamField path="moderation" type="string">
|
|
Content moderation models only
|
|
</ParamField>
|
|
<ParamField path="vision" type="string">
|
|
Vision models only
|
|
</ParamField>
|
|
|
|
When `type` is `app-selector`:
|
|
<ParamField path="all" type="string">
|
|
All application types
|
|
</ParamField>
|
|
<ParamField path="chat" type="string">
|
|
Chat applications only
|
|
</ParamField>
|
|
<ParamField path="workflow" type="string">
|
|
Workflow applications only
|
|
</ParamField>
|
|
<ParamField path="completion" type="string">
|
|
Completion applications only
|
|
</ParamField>
|
|
|
|
When `type` is `tool-selector`:
|
|
<ParamField path="all" type="string">
|
|
All tool types
|
|
</ParamField>
|
|
<ParamField path="plugin" type="string">
|
|
Plugin tools only
|
|
</ParamField>
|
|
<ParamField path="api" type="string">
|
|
API tools only
|
|
</ParamField>
|
|
<ParamField path="workflow" type="string">
|
|
Workflow tools only
|
|
</ParamField>
|
|
|
|
#### ModelConfig
|
|
|
|
<ParamField path="provider" type="string">
|
|
Model provider name containing plugin_id, in the form of `langgenius/openai/openai`
|
|
</ParamField>
|
|
|
|
<ParamField path="model" type="string">
|
|
Specific model name
|
|
</ParamField>
|
|
|
|
<ParamField path="model_type" type="enum">
|
|
Enumeration of model types, refer to the [Model Design Rules](/plugin-dev-en/0411-model-designing-rules#modeltype) document
|
|
</ParamField>
|
|
|
|
#### NodeResponse
|
|
|
|
<ParamField path="inputs" type="dict">
|
|
Variables that are finally input to the node
|
|
</ParamField>
|
|
|
|
<ParamField path="outputs" type="dict">
|
|
Output results of the node
|
|
</ParamField>
|
|
|
|
<ParamField path="process_data" type="dict">
|
|
Data generated during node execution
|
|
</ParamField>
|
|
|
|
#### ToolSelector
|
|
|
|
<ParamField path="provider_id" type="string">
|
|
Tool provider name
|
|
</ParamField>
|
|
|
|
<ParamField path="tool_name" type="string">
|
|
Tool name
|
|
</ParamField>
|
|
|
|
<ParamField path="tool_description" type="string">
|
|
Tool description
|
|
</ParamField>
|
|
|
|
<ParamField path="tool_configuration" type="dict[string, any]">
|
|
Tool configuration information
|
|
</ParamField>
|
|
|
|
<ParamField path="tool_parameters" type="dict[string, dict]">
|
|
Parameters that need LLM reasoning
|
|
|
|
<ParamField path="name" type="string">
|
|
Parameter name
|
|
</ParamField>
|
|
|
|
<ParamField path="type" type="string">
|
|
Parameter type
|
|
</ParamField>
|
|
|
|
<ParamField path="required" type="boolean">
|
|
Whether the parameter is required
|
|
</ParamField>
|
|
|
|
<ParamField path="description" type="string">
|
|
Parameter description
|
|
</ParamField>
|
|
|
|
<ParamField path="default" type="any">
|
|
Default value
|
|
</ParamField>
|
|
|
|
<ParamField path="options" type="array[string]">
|
|
Available options for the parameter
|
|
</ParamField>
|
|
</ParamField>
|
|
|
|
## Related Resources
|
|
|
|
- [Basic Concepts of Plugin Development](/plugin-dev-en/0111-getting-started-dify-plugin) - Comprehensive understanding of Dify plugin development
|
|
- [Developer Cheatsheet](/plugin-dev-en/0131-cheatsheet) - Quick reference for common commands and concepts in plugin development
|
|
- [Tool Plugin Development Details](/plugin-dev-en/0222-tool-plugin) - Understanding how to define plugin information and the tool plugin development process
|
|
- [Model Design Rules](/plugin-dev-en/0411-model-designing-rules) - Understanding the standards for model configuration
|
|
|
|
{/*
|
|
Contributing Section
|
|
DO NOT edit this section!
|
|
It will be automatically generated by the script.
|
|
*/}
|
|
|
|
---
|
|
|
|
[Edit this page](https://github.com/langgenius/dify-docs/edit/main/plugin-dev-en/0411-general-specifications.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)
|
|
|