0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Difyのチュートリアル(Basic)を試してみた

Posted at

背景・目的

先日、MeetupでDifyについて概要を学びました。今回あらためて整理しました。

まとめ

下記に特徴をまとめます。

特徴 説明
Difyとは Difyは、AIアプリケーションを構築するためのOSS
Backend as a ServiceとLLMOpsを組み合わせることで、生成型AIソリューションの開発を効率化する
Difyは、Define + Modifyが由来
Difyの機能 下記を統合する
・LLMサポート
・Promtオーケストレーションインターフェイス
・RAGエンジン
・AIエージェントフレームワーク
・ローコードワークフロー
・インターフェイスとAPI

概要

下記を基に整理します。

Welcome to Dify

Dify is an open-source platform for building AI applications. We combine Backend-as-a-Service and LLMOps to streamline the development of generative AI solutions, making it accessible to both developers and non-technical innovators.

Our platform integrates:

  • Support for mainstream LLMs
  • An intuitive Prompt orchestration interface
  • High-quality RAG engines
  • A flexible AI Agent framework
  • An Intuitive Low-code Workflow
  • Easy-to-use interfaces and APIs

With Dify, you can skip the complexity and focus on what matters most - creating innovative AI applications that solve real-world problems.

  • Difyは、AIアプリケーションを構築するためのOSS
  • Backend as a ServiceとLLMOpsを組み合わせることで、生成型AIソリューションの開発を効率化する
  • 下記を統合する
    • LLMサポート
    • Promtオーケストレーションインターフェイス
    • RAGエンジン
    • AIエージェントフレームワーク
    • ローコードワークフロー
    • インターフェイスとAPI

The Advantage of Dify

While many AI development tools offer individual components, Dify provides a comprehensive, production-ready solution. Think of Dify as a well-designed scaffolding system, not just a toolbox.

As an open-source platform, Dify is co-created by a dedicated professional team and a vibrant community. This collaboration ensures rapid iteration, robust features, and a user-friendly interface.

With Dify, you can:

  • Deploy capabilities similar to Assistants API and GPTs using any model
  • Maintain full control over your data with flexible security options
  • Leverage an intuitive interface for easy management and deployment
  • Difyは単なるツールボックスではなく、well-designed scaffolding systemである
  • プロフェッショナルチームとコミュニティにより共同開発されている
  • 迅速なイテレーション、堅牢な機能、ユーザーフレンドリーなインターフェイスが実現されている
  • 下記のことが可能になる
    • 任意のモデルを使用して、アシスタントAPIやGPTと同様の機能を展開する
    • 柔軟なセキュリティオプションで完全に制御
    • 直感的なインターフェイスを活用して簡単に管理と導入が可能

Dify

  • Difyは、Define + Modifyが由来
  • AIアプリとの定義と継続的な改善を意味する
  • Difyの活用事例
    • Startups
      • AIアイデアのプロトタイプ作成と反復と迅速に行う
      • MVPを構築し、資金調達や顧客契約
    • Established Businesses
      • LLM機能を活用して既存アプリケーションを強化する
      • DifyのRESTful APIを使用してプロンプトとビジネスロジックを分離し、管理I/Fを使用してデータ、コスト、使用状況を追跡する
    • Enterprise AI infrastructure
      • 銀行、テクノロジー企業はDifyを社内LLMゲートウェイとして導入し、集中管理されtあガバナンスによるGenAIの導入を促進する
    • AI Enthusiasts and Learners
      • 6万人以上の開発者がDifyで最初のAIアプリを開発

Features and Specifications

下記を基に整理します。

Project Basics

項目 内容
設立 2023/3
Official R&D Team フルタイム従業員15名以上
コミュニティ コントリビューター 290人以上
BEテクノロジー Pyhon/Flask/PostgreSQL
FEテクノロジー Next.js
コードベースサイズ 130,000以上
リリース頻度 平均 一週間に一度

料金

下記を基に整理します。

  • クラウドサービスとセルフホストサービスの2つがある
  • クラウドサービス
    • SANDBOX
      • 無料
    • PROFESSIONAL
      • 59 USD ワークスペース / 月
    • TEAM
      • 159 USD ワークスペース / 月
  • セルフホストサービス
    • COMMUNITY
      • 無料
    • PREMIUM
      • クラウドマーケットプレイスに基づく
    • ENTERPRISE
      • 年間契約のみ

What is an Agent

下記を基に整理します。

An Agent is an AI system that simulates human behavior and capabilities. It interacts with the environment through natural language processing, understands input information, and generates corresponding outputs. The Agent also has "perception" capabilities, can process and analyze various forms of data, and can call and use various external tools and APIs to complete tasks, extending its functional scope. This design allows the Agent to handle complex situations more flexibly and simulate human thinking and behavior patterns to some extent.

  • エージェントとは、人間の行動・能力をシミュレートするAIシステム
  • 自然言語処理を通じて環境とインタラクションし、入力情報を理解しそれに応じた出力を生成する
  • エージェントはperceptionも有しており、様々な形式のデータを処理・分析し、様々な外部ツールやAPIを呼び出してタスクを実行し、機能範囲を拡張する
  • エージェントは複雑な状況にも柔軟に対応し、人間の思考や行動パターンをある程度シミュレートする事が可能

実践

アカウントの作成

  1. 画面右上の「始める」をクリックします

  2. 今回は、GitHubでサインアップします

  3. Authorize langgeniusをクリックします

  4. できました

Workshop / Basic

下記を基に試します。

How to Build an AI Image Generation App

Diyを使用してAI画像生成アプリを作ります。

ここでは下記を学びます。

  • Difyを使ったエージェント構築方法
  • エージェントの基本概念
  • 迅速なエンジニアリングの基礎
  • ツールの使用
  • 大規模モデルハルシネーションの概念

Setting Stability API Key

  1. こちらから、Stability APIキー管理ページに移動します

  2. ユーザ登録が必要です
    image.png

  3. 管理ページに移動し、コピーします
    image.png

  4. Difyの管理画面で、ツールをクリックします

  5. Stabilityを検索します
    image.png

  6. 「インストール」します
    image.png

  7. 「認証する」をクリックします
    image.png

  8. API Keyに、Stabilityで取得したAPI Keyを設定し保存します

    image.png

Configure Model Providers

画像生成のためのプロンプトを記述するためのLLMを用意します。

Difyの無料バージョンでは、200の無料のOpneAIメッセージ具レジットが提供されています

  1. 画面右上のアカウント>「設定」をクリックします
    image.png

  2. 「モデルプロバイダー」をクリックします
    image.png

  3. OpenAIをインストールします
    image.png
    image.png

  4. 追加されました。確かにクォーターが200クレジットになっています
    image.png

Build an Agent

  1. ①「Studio」>②「Agent」>②「Create from Blank」をクリックします
    image.png

  2. Choose App Typeを①「Chatbot」を②「Name」を入力しCreateをクリックします
    image.png

  3. Toolsで「+Add」をクリックし、「StableDiffusion」を選択します
    image.png

Write Prompts

  1. Instructionsに下記のプロンプトを入力します

    Draw the specified content according to the user's prompt using stability_text2image.
    
  2. Modelを「gpt-3.5-turbo-16k」を指定します
    image.png

  3. 下記をTalk to Botに入力します

    Draw a girl holding an open book
    
  4. レスポンスが返ってきました
    image.png

考察

今回、Difyのチュートリアル(Basic)を試してみました。次回はIntermediateのチュートリアルを試してみます。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?