--- dimensions: type: primary: implementation detail: advanced level: advanced standard_title: Reverse Invocation Node language: ja title: ノード description: このドキュメントでは、プラグインがDifyプラットフォーム内のChatflow/ワークフローアプリケーションノードの機能を逆呼び出しする方法について説明します。主に、ParameterExtractorとQuestionClassifierという2つの特定のノードの呼び出し方法について説明します。このドキュメントでは、これら2つのノードを呼び出すためのエントリーポイント、インターフェースパラメータ、およびサンプルコードについて詳しく説明します。 --- ⚠️ このドキュメントはAIによって自動翻訳されています。不正確な部分がある場合は、[英語版](/en/develop-plugin/features-and-specs/advanced-development/reverse-invocation-node)を参照してください。 ノードの逆呼び出しとは、プラグインがDify Chatflow/ワークフローアプリケーション内の特定のノードの機能にアクセスできることを意味します。 `ワークフロー`内の`ParameterExtractor`および`QuestionClassifier`ノードは、複雑なプロンプトとコードロジックをカプセル化しており、LLMを通じてハードコーディングでは解決が難しいタスクを実現できます。プラグインはこれら2つのノードを呼び出すことができます。 ### パラメータ抽出ノードの呼び出し #### **エントリーポイント** ```python self.session.workflow_node.parameter_extractor ``` #### **インターフェース** ```python def invoke( self, parameters: list[ParameterConfig], model: ModelConfig, query: str, instruction: str = "", ) -> NodeResponse pass ``` ここで、`parameters`は抽出するパラメータのリスト、`model`は`LLMModelConfig`仕様に準拠、`query`はパラメータ抽出のソーステキスト、`instruction`はLLMに必要な追加の指示を提供します。`NodeResponse`の構造については、この[ドキュメント](/ja/develop-plugin/features-and-specs/plugin-types/general-specifications.mdx#noderesponse)を参照してください。 #### **ユースケース** 会話から人の名前を抽出するには、以下のコードを参照できます: ```python from collections.abc import Generator from dify_plugin.entities.tool import ToolInvokeMessage from dify_plugin import Tool from dify_plugin.entities.workflow_node import ModelConfig, ParameterConfig, NodeResponse # Assuming NodeResponse is importable class ParameterExtractorTool(Tool): def _invoke( self, tool_parameters: dict ) -> Generator[ToolInvokeMessage, None, None]: response: NodeResponse = self.session.workflow_node.parameter_extractor.invoke( parameters=[ ParameterConfig( name="name", description="name of the person", required=True, type="string", ) ], model=ModelConfig( provider="langgenius/openai/openai", name="gpt-4o-mini", completion_params={}, ), query="My name is John Doe", instruction="Extract the name of the person", ) # Assuming NodeResponse has an 'outputs' attribute which is a dictionary extracted_name = response.outputs.get("name", "Name not found") yield self.create_text_message(extracted_name) ``` ### 質問分類ノードの呼び出し #### **エントリーポイント** ```python self.session.workflow_node.question_classifier ``` #### **インターフェース** ```python def invoke( self, classes: list[ClassConfig], # Assuming ClassConfig is defined/imported model: ModelConfig, query: str, instruction: str = "", ) -> NodeResponse: pass ``` インターフェースのパラメータは`ParameterExtractor`と一致しています。最終結果は`NodeResponse.outputs['class_name']`に格納されます。 {/* Contributing Section DO NOT edit this section! It will be automatically generated by the script. */} --- [Edit this page](https://github.com/langgenius/dify-docs/edit/main/en/develop-plugin/features-and-specs/advanced-development/reverse-invocation-node.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)