tool.py 359 B

123456789101112
  1. from collections.abc import Generator
  2. from typing import Any
  3. from dify_plugin import Tool
  4. from dify_plugin.entities.tool import ToolInvokeMessage
  5. class {{plugin_name}}Tool(Tool):
  6. def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessage]:
  7. yield self.create_json_message({
  8. "result": "Hello, world!"
  9. })