Documentation Index
Fetch the complete documentation index at: https://dify-6c0370d8-docs-sync-pr-768.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
⚠️ このドキュメントは AI によって自動翻訳されています。不正確な部分がある場合は、
英語版 を参照してください。
コマンドラインインターフェース(CLI)を使用してDifyプラグインのセットアップとパッケージ化を行います。CLIは、初期化からパッケージ化まで、プラグイン開発ワークフローを効率的に管理する方法を提供します。
このガイドでは、Difyプラグイン開発におけるCLIの使用方法について説明します。
前提条件
始める前に、以下がインストールされていることを確認してください:
- Pythonバージョン 3.12
- Dify CLI
- Homebrew(Macユーザーの場合)
Difyプラグインプロジェクトの作成
brew tap langgenius/dify
brew install dify
Dify GitHubリリースページから最新のDify CLIを取得してください# Download dify-plugin-darwin-arm64
chmod +x dify-plugin-darwin-arm64
mv dify-plugin-darwin-arm64 dify
sudo mv dify /usr/local/bin/
これでDify CLIのインストールが完了しました。以下のコマンドを実行してインストールを確認できます:
以下のコマンドを使用して新しいDifyプラグインプロジェクトを作成できます:
プロンプトが表示されたら、必要なフィールドを入力してください:
Edit profile of the plugin
Plugin name (press Enter to next step): hello-world
Author (press Enter to next step): langgenius
Description (press Enter to next step): hello world example
Repository URL (Optional) (press Enter to next step): Repository URL (Optional)
Enable multilingual README: [✔] English is required by default
Languages to generate:
English: [✔] (required)
→ 简体中文 (Simplified Chinese): [✔]
日本語 (Japanese): [✘]
Português (Portuguese - Brazil): [✘]
Controls:
↑/↓ Navigate • Space/Tab Toggle selection • Enter Next step
pythonを選択してEnterキーを押し、Pythonプラグインテンプレートで続行します。
Select the type of plugin you want to create, and press `Enter` to continue
Before starting, here's some basic knowledge about Plugin types in Dify:
- Tool: Tool Providers like Google Search, Stable Diffusion, etc. Used to perform specific tasks.
- Model: Model Providers like OpenAI, Anthropic, etc. Use their models to enhance AI capabilities.
- Endpoint: Similar to Service API in Dify and Ingress in Kubernetes. Extend HTTP services as endpoints with custom logi
- Agent Strategy: Implement your own agent strategies like Function Calling, ReAct, ToT, CoT, etc.
Based on the ability you want to extend, Plugins are divided into four types: Tool, Model, Extension, and Agent Strategy
- Tool: A tool provider that can also implement endpoints. For example, building a Discord Bot requires both Sending and
- Model: Strictly for model providers, no other extensions allowed.
- Extension: For simple HTTP services that extend functionality.
- Agent Strategy: Implement custom agent logic with a focused approach.
We've provided templates to help you get started. Choose one of the options below:
-> tool
agent-strategy
llm
text-embedding
rerank
tts
speech2text
moderation
extension
デフォルトのdifyバージョンを入力します。空白のままにすると最新バージョンが使用されます:
Edit minimal Dify version requirement, leave it blank by default
Minimal Dify version (press Enter to next step):
準備完了です!CLIは指定したプラグイン名で新しいディレクトリを作成し、プラグインの基本構造をセットアップします。
プラグインの実行
hello-worldディレクトリにいることを確認してください
.envファイルを編集して、APIキーやその他の設定などのプラグインの環境変数を設定します。これらの変数はDifyダッシュボードで確認できます。Dify環境にログインし、右上の「プラグイン」アイコンをクリックしてから、デバッグアイコン(または虫のようなもの)をクリックします。ポップアップウィンドウで「APIキー」と「ホストアドレス」をコピーします。(キーとホストアドレスの取得インターフェースを示すローカルの対応するスクリーンショットを参照してください)
INSTALL_METHOD=remote
REMOTE_INSTALL_HOST=debug-plugin.dify.dev
REMOTE_INSTALL_PORT=5003
REMOTE_INSTALL_KEY=********-****-****-****-************
以下のコマンドを使用して、プラグインをローカルで実行できます:
pip install -r requirements.txt
python -m main
このページを編集する | 問題を報告する