def create_image_message(self, image: str) -> ToolInvokeMessage: """ Return an image URL message Dify will automatically download the image from the provided URL and display it to the user. Args: image: URL to an image file Returns: ToolInvokeMessage: Message object for the tool response """ pass
from typing import Anydef create_variable_message(self, variable_name: str, variable_value: Any) -> ToolInvokeMessage: """ Create a named variable for workflow integration For non-streaming output variables. If multiple instances with the same name are created, the latest one overrides previous values. Args: variable_name: Name of the variable to create variable_value: Value of the variable (any Python data type) Returns: ToolInvokeMessage: Message object for the tool response """ pass
identity: author: example_author name: example_tool label: en_US: Example Tool zh_Hans: 示例工具 ja_JP: ツール例 pt_BR: Ferramenta de exemplodescription: human: en_US: A simple tool that returns a name zh_Hans: 返回名称的简单工具 ja_JP: 名前を返す簡単なツール pt_BR: Uma ferramenta simples que retorna um nome llm: A simple tool that returns a name variableoutput_schema: type: object properties: name: type: string description: "The name returned by the tool" age: type: integer description: "The age returned by the tool" profile: type: object properties: interests: type: array items: type: string location: type: string
def run(self, inputs): # Process inputs and generate a name generated_name = "Alice" # Return the name as a variable that matches the output_schema return self.create_variable_message("name", generated_name)