This page is being phased out as part of our documentation reorganization.
Click this card to be redirected to the updated version with the most current information.
If you notice any discrepancies or areas needing improvement in the new documentation, please use the “Report an issue” button at the bottom of the page.
GoogleSearch
as an example of how to quickly develop a tool type of plugin.
dify
and copied it to the /usr/local/bin
path, you can run the following command to create a new plugin project:
In the following, the command-line tooldify
is used. If issues occur, please replace thedify
command with the appropriate path to your command-line tool.
If you are already familiar in plugin development, please refer to the Schema Definition to implement various types of plugins.
Use the arrow keys to select permissions within the terminal and the “Tab” button to grant permissions.After checking all the permission items, tap Enter to complete the creation of the plug-in. The system will automatically generate the plug-in project code.
/provider
path and rename the yaml file in it to google.yaml
. The yaml
file will contain information about the tool vendor, including the provider name, icon, author, and other details. This information will be displayed when the plugin is installed.
Example:
identity
contains basic information about the tool provider, including author, name, label, description, icon, and more.
_assets
folder in the project root directory./tools
directory, the full path is below:
google.yaml
file needs to use its absolute path in the plugin project.
credentials_for_provider
field to the yaml
file.
The full code is below:
credentials_for_provider
sub-level structure needs to satisfy the ProviderConfig specification.tools/google_search.yaml
file.google.py
, but instead of implementing it for the time being, you write the code for google_search
first.yaml
file, which contains basic information about the tool, its parameters, its output, and so on.
Still using the GoogleSearch
tool as an example, you can create a new google_search.yaml
file in the /tools
folder.
identity
contains the tool’s basic information, including name, author, labels, description, etc.parameters
parameter list
name
(required) parameter name, must be unique, cannot duplicate other parameter namestype
(required) parameter type, currently supports nine types: string
, number
, boolean
, select
, secret-input
, file
, files
, model-selector
, app-selector
, corresponding to string, number, boolean, dropdown menu, encrypted input field, file, file set, model selection, and application selection. For sensitive information, please use secret-input
typelabel
(required) parameter label, used for frontend displayform
(required) form type, currently supports two types: llm
and form
llm
means the parameter is inferred by LLM, form
means parameters that can be preset to use the toolllm
and form
need to be filled in the frontend, but llm
parameters will serve as input variables for tool nodesrequired
whether the field is required
llm
mode, if a parameter is required, the Agent must infer this parameterform
mode, if a parameter is required, users must fill in this parameter in the frontend before starting the conversationoptions
parameter options
llm
mode, Dify will pass all options to LLM, which can make inferences based on these optionsform
mode, when type
is select
, the frontend will display these optionsdefault
default valuemin
minimum value, can be set when parameter type is number
max
maximum value, can be set when parameter type is number
human_description
introduction displayed in frontend, supports multiple languagesplaceholder
prompt text for input fields, can be set when form type is form
and parameter type is string
, number
, or secret-input
, supports multiple languagesllm_description
introduction passed to LLM. To help LLM better understand this parameter, please write as detailed information as possible about this parameter here so that LLM can understand itgoogle_search.py
in the /tools
directory with the following contents.
serpapi
and use self.create_json_message
to return a string of json
formatted data. For more information on the types of data returned, you can refer to the tool documentation.
ToolProviderCredentialValidationError
exception will be thrown. After successful validation, the google_search
tool service will be requested correctly.
Create a google.py
file in the /provider
directory with the following code:
.env.example
file and rename it to .env. Fill it with the remote server address and debugging key.
The .env
file:
python -m main
command to launch the plugin. You can see on the plugin page that the plugin has been installed into Workspace. Other team members can also access the plugin.
google.difypkg
file in the current folder, which is the final plugin package.