Last updated
Last updated
Reverse Model Request refers to the plugin's ability to make reverse requests to LLM capabilities within Dify, including all model types and features on the platform, such as TTS, Rerank, etc.
Note that requesting models requires passing a ModelConfig type parameter. Its structure can be referenced in Common Specification Definitions, and this structure will have slight differences for different types of models.
For example, for LLM type models, it needs to include completion_params
and mode
parameters. You can manually build this structure or use model-selector
type parameters or configuration.
Note: If the model you're requesting doesn't have tool_call capability, the tools passed here won't take effect.
If you want to request OpenAI's gpt-4o-mini model in a Tool, refer to the following example code:
Notice that the query
parameter from tool_parameters
is passed in the code.
It's not recommended to manually build LLMModelConfig
. Instead, allow users to select their desired model in the UI. In this case, you can modify the tool's parameter list by adding a model
parameter according to the following configuration:
Note that in this example, the model's scope is specified as llm, so users can only select llm
type parameters. This allows you to modify the above example code as follows:
You can request this endpoint to summarize a text. It will use the system model in your current workspace to summarize the text.
Entry:
Endpoint:
text
: The text to be summarized
instruction
: Additional instructions you want to add, allowing you to stylize the summary
Request TextEmbedding
Entry
Endpoint
Note: The bytes stream returned by the TTS endpoint is an mp3 audio byte stream, with each iteration returning a complete audio. If you want to perform more in-depth processing tasks, please select an appropriate library.
Entry:
Endpoint:
Where file is an mp3-encoded audio file.
Entry:
Endpoint:
If this endpoint returns true
, it indicates that the text
contains sensitive content.