Authors Yeuoly, Allen. This document details the structure and implementation of Endpoints in Dify plugins, using the Neko Cat project as an example. It covers defining Endpoint groups, configuring interfaces, implementing the _invoke method, and handling requests and responses. The document explains the meaning and usage of various YAML configuration fields.
Endpoint
group is a collection of multiple Endpoints
. When creating a new Endpoint
within a Dify plugin, you might need to fill in the following configuration.
Endpoint Name
, you can add new form items by writing the group’s configuration information. After clicking save, you can see the multiple interfaces it contains, which will use the same configuration information.
settings
(map[string] ProviderConfig): Endpoint configuration definition. (Note: Assuming the anchor #providerconfig
exists in the target file).endpoints
(list[string], required): Points to the specific endpoint
interface definitions.path
(string): Follows the Werkzeug interface standard.method
(string): Interface method, only supports HEAD
, GET
, POST
, PUT
, DELETE
, OPTIONS
.extra
(object): Configuration information beyond the basic details.
python
(object)
source
(string): The source code that implements this interface.dify_plugin.Endpoint
and implement the _invoke
method.
r
(Request): The Request
object from werkzeug
.values
(Mapping): Path parameters parsed from the path.settings
(Mapping): Configuration information for this Endpoint
.Response
object from werkzeug
, supports streaming responses.