Files
dify-docs/plugin-dev-ja/0411-general-specifications.mdx
2025-07-16 16:42:34 +08:00

132 lines
6.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
dimensions:
type:
primary: reference
detail: core
level: beginner
standard_title: General Specifications
language: ja
title: 一般的な仕様定義
description: このドキュメントでは、Difyプラグイン開発における一般的な構造と仕様、パスの仕様、国際化オブジェクト(I18nObject)、プロバイダー設定フォーム構造(ProviderConfig)、モデル設定(ModelConfig)、ノードレスポンス(NodeResponse)、ツールセレクター(ToolSelector)などの重要なデータ構造の定義と用途について詳しく説明します。
---
本稿では、プラグイン開発で一般的に使用される構造について簡単に説明します。開発プロセス中は、全体のアーキテクチャをよりよく理解するために、[プラグイン開発の基本概念](/plugin-dev-ja/0111-getting-started-dify-plugin)および[開発者向けチートシート](/plugin-dev-ja/0131-cheatsheet)と合わせてお読みになることを強くお勧めします。
### パスの仕様
Manifestファイルまたは任意のYAMLファイルにファイルパスを記入する際、ファイルの種類に応じて以下の2つの仕様に従ってください
* 対象ファイルが画像や動画などのマルチメディアファイルである場合(例:プラグインの `icon` を記入する場合)、これらのファイルをプラグインのルートディレクトリにある `_assets` フォルダに配置する必要があります。
* 対象ファイルが `.py` や `.yaml` などの通常のテキストファイル(コードファイル)である場合、プラグインプロジェクト内でのそのファイルの絶対パスを記入する必要があります。
### 一般的な構造
プラグインを定義する際、ツール、モデル、Endpoint間で共有できるいくつかのデータ構造があります。ここでは、これらの共通構造を定義します。
#### I18nObject
`I18nObject`は、[IETF BCP 47](https://tools.ietf.org/html/bcp47)標準に準拠した国際化構造であり、現在サポートされている4つの言語は次のとおりです。
* en_US
* zh_Hans
* ja_Jp
* pt_BR
#### ProviderConfig
`ProviderConfig`は、`Tool`および`Endpoint`に適用可能な汎用的なプロバイダー設定フォーム構造です。
* `name`(string):フォーム項目の名前
* `label`([I18nObject](#i18nobject), 必須)[IETF BCP 47](https://tools.ietf.org/html/bcp47)に準拠
* `type`([provider_config_type](#providerconfigtype-string), 必須):フォームタイプ
* `scope`([provider_config_scope](#providerconfigscope-string)):オプションの範囲、`type`によって変動
* `required`(bool):必須(空にできません)
* `default`(any):デフォルト値、基本型 `float` `int` `string` のみをサポート
* `options`(list\[[provider_config_option](#providerconfigoption-object)])オプション項目、typeが `select` の場合のみ使用
* `helper`(object):ヘルプドキュメントリンクのラベル、[IETF BCP 47](https://tools.ietf.org/html/bcp47)に準拠
* `url` (string):ヘルプドキュメントリンク
* `placeholder`(object)[IETF BCP 47](https://tools.ietf.org/html/bcp47)に準拠
#### ProviderConfigOption(object)
* `value`(string, 必須):値
* `label`(object, 必須)[IETF BCP 47](https://tools.ietf.org/html/bcp47)に準拠
#### ProviderConfigType(string)
* `secret-input` (string):設定情報は暗号化されます
* `text-input`(string):通常のテキスト
* `select`(string):ドロップダウンリスト
* `boolean`(bool):スイッチ
* `model-selector`(object):モデル設定情報、プロバイダー名、モデル名、モデルパラメータなどを含む
* `app-selector`(object)アプリID
* `tool-selector`(object):ツール設定情報、ツールプロバイダー、名前、パラメータなどを含む
* `dataset-selector`(string):未定
#### ProviderConfigScope(string)
* `type`が `model-selector` の場合
* `all`
* `llm`
* `text-embedding`
* `rerank`
* `tts`
* `speech2text`
* `moderation`
* `vision`
* `type`が `app-selector` の場合
* `all`
* `chat`
* `workflow`
* `completion`
* `type`が `tool-selector` の場合
* `all`
* `plugin`
* `api`
* `workflow`
#### ModelConfig
* `provider` (string): `plugin_id`を含むモデルプロバイダー名。形式は`langgenius/openai/openai`のようになります。
* `model` (string): 具体的なモデル名。
* `model_type` (enum): モデルタイプの列挙型。[モデル設計規則](/plugin-dev-ja/0411-model-designing-rules#modeltype.ja)ドキュメントを参照できます。
#### NodeResponse
* `inputs` (dict): 最終的にノードに入力される変数。
* `outputs` (dict): ノードの出力結果。
* `process_data` (dict): ノード実行中に生成されるデータ。
#### ToolSelector
* `provider_id` (string): ツールプロバイダー名
* `tool_name` (string): ツール名
* `tool_description` (string): ツールの説明
* `tool_configuration` (dict\[str, Any]): ツールの設定情報
* `tool_parameters` (dict\[str, dict]): LLMによる推論が必要なパラメータ
* `name` (string): パラメータ名
* `type` (string): パラメータタイプ
* `required` (bool): 必須かどうか
* `description` (string): パラメータの説明
* `default` (any): デフォルト
* `options`(list\[string]): オプション項目
## 関連リソース
- [プラグイン開発の基本概念](/plugin-dev-ja/0111-getting-started-dify-plugin) - Difyプラグイン開発の全体像を理解する
- [開発者向けチートシート](/plugin-dev-ja/0131-cheatsheet) - プラグイン開発でよく使われるコマンドと概念のクイックリファレンス
- [ツールプラグイン開発詳細](/plugin-dev-ja/0222-tool-plugin) - ツールプラグイン開発プロセスの詳細を理解する
- [モデル設計規則](/plugin-dev-ja/0411-model-designing-rules) - モデル設定の仕様を理解する
{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}
---
[このページを編集する](https://github.com/langgenius/dify-docs/edit/main/plugin-dev-ja/0411-general-specifications.mdx) | [問題を報告する](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)