Is Dify the easiest way to build AI Applications?

Matt Williams
25 Jul 202413:49

Summary

TLDRこのビデオスクリプトでは、新しいAIアプリのアイデアを実現するためのツール「Defy」を紹介しています。ウェブ検索や他のツールから情報を取得し、モデルに渡して答えを出す仕組みを簡単に構築できると説明されています。Defyを使うと、グラフィカルインターフェースでコンポーネントを接続、質問に答え、ボタンをクリックするだけでデプロイが可能です。さらに、Amaをインストールし、DockerでDefyを実行する方法、モデルプロバイダーの設定、ツールの設定、そしてアプリの作成方法について詳細にガイドされています。初心者でも始められ、経験豊富な開発者でもアイデアのプロトタイピングに役立つ、非常に魅力的なツールです。

Takeaways

  • 🤖 新AIアプリのアイデアを実現するプロセスが説明されています。
  • 🔍 アプリはウェブ検索や他のツールから情報を取得し、モデルに渡して回答を生成します。
  • 🚀 'Defy'ツールを使用することで、インフラのセットアップを簡素化し、グラフィカルインターフェースでコンポーネントを接続できます。
  • 💻 自己ホスティングも可能で、DockerとAMA(Anthropic Model API)が必要になります。
  • 📝 Defyの設定には、ポートの設定やモデルプロバイダーの追加などいくつかのステップが必要です。
  • 🔗 モデルプロバイダーとしてAMAを使用し、特定のモデルを追加して設定します。
  • 🔎 ウェブ検索ツールの設定もアプリに必要で、'Search and G'のようなツールが挙げられます。
  • 🛠️ Defyのアプリ作成プロセスには、入力フィールドの定義やワークフローの構築が含まれます。
  • 📊 モニタリング機能を使って、アプリの実行状況を確認できます。
  • 🔄 アプリのワークフローは公開して再利用でき、さまざまなシナリオで応用できます。
  • 🛑 Defyにはいくつかの欠点もありますが、初心者向けに非常に使いやすく、プロトタイピングに最適です。

Q & A

  • 新しいAIアプリのアイデアをどうやって実現するの?

    -ウェブ検索や他のツールから情報を取得し、それをモデルに渡して答えを出すようなAIアプリの開発を提案しています。

  • アプリのインフラストラクチャを構築するにはどれくらいの時間がかかりますか?

    -ツールDefyを使用することで、グラフィカルインターフェースでコンポーネントを接続し、数クリックでアプリを展開できます。

  • Defyツールとは何ですか?

    -Defyは、AIアプリを素早く構築できるツールで、グラフィカルインターフェースでアプリを作成・展開することが可能です。

  • Defyを使用する前に何が必要ですか?

    -Defyを使用するには、Dockerがインストールされた環境と、GitHubリポジトリのクローンが必要です。

  • Defyでアプリを作成する際の最初のステップは何ですか?

    -最初のステップは、adminアカウントの設定です。その後、アプリを作成し、必要なツールやモデルプロバイダーを設定します。

  • Ama(Anthropic Model API)とは何ですか?

    -Amaは、モデルプロバイダーの一つで、Defyと組み合わせて使用することで、AIモデルを活用できます。

  • Defyでアプリを作成する際に、モデルプロバイダーとしてAmaを設定するにはどうすればよいですか?

    -Defyの設定ページでモデルプロバイダーを追加し、AmaのベースURLやモデル名、コンテキストサイズなどの詳細を入力します。

  • Defyでアプリを作成する際に使用するツールとは何ですか?

    -Defyでは、ウェブ検索やその他のAPIリクエストを行うためのツールを使用することができます。

  • Defyで作成したアプリを実際に動かすためには?

    -Dockerコンテナ内でDefyを実行し、ブラウザで指定のポートにアクセスしてアプリを操作します。

  • Defyのアプリ作成プロセスで、ワークフローとは何ですか?

    -ワークフローは、Defyでアプリを作成する際のステップやロジックを定義するもので、様々なツールやモデルを組み合わせて使用します。

  • Defyのアプリ作成で、どのような問題点があると指摘されていますか?

    -ナビゲーションの改善や、UIのカスタマイズ性の制限、アプリの重さなどが指摘されています。

  • Defyを使用してAIアプリを開発することの利点は何ですか?

    -素早くプロトタイプを作成し、デプロイの複雑さを避けることができます。また、初心者向けにも使いやすいインターフェースがあります。

Outlines

00:00

🤖 AIアプリ開発のツールDefyの紹介

この段落では、新しいAIアプリのアイデアを実現するためのツールDefyについて紹介しています。Defyを使うと、ウェブ検索や他のツールから情報を取得し、モデルに渡して回答を得ることができます。Defyは、グラフィカルインターフェースでコンポーネントを接続し、数クリックでアプリを展開できるため、インフラのホスティングに必要なウェブ検索APIやベクターデータベース、フロントエンドなどがすぐに用意できます。また、Defyはホスティングサービスを提供する一方で、Dockerを使用してセルフホスティングも可能で、AMA(Anthropic Model API)との連携が想定されています。

05:01

🔧 Defyの設定とモデルプロバイダーの設定方法

第二段落では、Defyの設定方法とモデルプロバイダーの設定について説明しています。Defyの設定には、ポートの設定や環境ファイルの編集、Dockerコンテナの実行などが含まれます。モデルプロバイダーとしてAMAを使用する場合、特定のモデルを追加し、ベースURLやコンテキストサイズ、最大トークン制限を設定する必要があります。また、DefyのUIではツールの設定やアプリの作成、ワークフローの構築が行えますが、ナビゲーションやツールの順序付けが不明瞭な点に留意する必要があります。

10:02

🛠️ Defyを使ったAIアプリの開発フローとアプリの実行

最後の段落では、Defyを使ってAIアプリの開発フローを作成し、実行する方法について詳しく説明しています。開発者は、アプリの最初の入力を定義し、モデルにプロンプトを送信して回答を得るためのワークフローを構築します。ウェブ検索やLLM(Large Language Model)を利用して、ユーザーのクエリに応じた回答を生成することができます。アプリの実行時には、問題が発生した場合のトレーシング機能や、アプリのパフォーマンスを監視するモニタリング機能が利用できます。また、DefyのUIのカスタマイズ性やアプリの重さ、ナビゲーションの改善点についても触れています。

Mindmap

Keywords

💡AIアプリ

AIアプリとは、人工知能技術を活用して開発されたアプリケーションのことを指します。このビデオでは、新しいAIアプリのアイデアを考案し、ウェブ検索や他のツールから情報を取得し、それをモデルに渡して答えを出すプロセスについて説明しています。AIアプリは、日常生活やビジネスの多様な分野に応用されており、このビデオの主題であるAI技術の応用例として重要です。

💡ウェブ検索API

ウェブ検索APIとは、ウェブ上で公開されている情報を検索するためのアプリケーションプログラミングインターフェースのことを指します。ビデオでは、AIアプリがウェブ検索APIを利用して情報を収集し、ユーザーのクエリに応じた回答を提供するプロセスを紹介しています。ウェブ検索APIは、情報検索機能を提供するAIアプリの重要なコンポーネントです。

💡ベクターデータベース

ベクターデータベースは、データを多次元空間上の点として表現し、類似性に基づいて検索を行うデータベースのことを指します。ビデオでは、AIアプリがベクターデータベースを用いて、関連性の高い情報を取得するプロセスについて触れています。このデータベースは、自然言語処理や情報検索分野で広く使われています。

💡Defyツール

Defyは、アプリケーションを迅速に構築するためのツールで、グラフィカルインターフェースを通じてコンポーネントを接続し、アプリケーションを展開することができます。ビデオでは、Defyツールを使ってAIアプリのインフラストラクチャを構築し、モデルプロバイダーやツールの設定を行う方法を説明しています。Defyは、開発者が迅速にプロトタイプを作ったり、アイデアを検証するための便利なツールです。

💡モデルプロバイダー

モデルプロバイダーとは、AIモデルを提供するサービスやシステムのことを指します。ビデオでは、AIアプリがAnthropic社が提供するモデルプロバイダーである「Alma」を利用して、自然言語処理タスクを実行する様子が紹介されています。モデルプロバイダーは、AIアプリの性能と応答の質に大きな影響を与える要素です。

💡Docker

Dockerは、ソフトウェアをコンテナ化し、異なる環境間で簡単に移植できるようにするオープンソースのプラットフォームです。ビデオでは、DefyツールをDockerコンテナとして実行し、AIアプリのインフラストラクチャを構築するプロセスを説明しています。Dockerは、開発やデプロイの効率化を図る上で重要な技術です。

💡グラフィカルインターフェース

グラフィカルインターフェースとは、コンピュータやアプリケーションを操作するための視覚的な手段であり、マウスやキーボードを使って操作します。ビデオでは、Defyツールのグラフィカルインターフェースを使って、AIアプリのコンポーネントを接続し、設定を行う方法を紹介しています。グラフィカルインターフェースは、ユーザーフレンドリーな操作性を提供します。

💡ワークフロー

ワークフローとは、業務やプロセスを一連のステップとして定義し、効率化や自動化を図る仕組みのことを指します。ビデオでは、Defyツールを使ってAIアプリのワークフローを作成し、ユーザーのクエリに応じた回答を生成するプロセスを説明しています。ワークフローは、複雑なタスクを管理し、一貫性を確保するための重要な概念です。

💡検索エンジン

検索エンジンとは、インターネット上の情報やウェブページを検索するためのシステムのことを指します。ビデオでは、検索エンジンのAPIを利用して、AIアプリがウェブ検索を行い、ユーザーのクエリに関連する情報を収集するプロセスを紹介しています。検索エンジンは、情報検索やデータ収集の核となる機能です。

💡API

APIとは、アプリケーションプログラミングインターフェースの略で、ソフトウェア間でデータをやり取りするための標準化された方法を提供します。ビデオでは、AIアプリがAPIを通じてウェブ検索エンジンやモデルプロバイダーと通信し、情報を取得するプロセスについて説明しています。APIは、異なるシステムやサービスを統合する上で不可欠な要素です。

Highlights

提出了一种新的AI应用概念,该应用通过查询和网络搜索获取信息,并将这些信息与查询一起传递给模型以生成答案。

介绍了Defy工具,它允许用户通过图形界面连接组件、回答问题并一键部署应用程序。

讨论了Defy的两种使用方式:付费托管和自托管,特别强调了与AMA结合使用的自托管选项。

详细说明了如何使用Docker安装并运行Defy,包括克隆GitHub仓库和配置环境文件。

解释了如何在Defy中设置模型提供者,例如Anthropic的模型,并提供了具体的配置步骤。

强调了Defy中模型的上下文大小和最大令牌限制的重要性,并提供了如何设置这些参数的指导。

讨论了如何在Defy中配置工具,例如SearchNG,以增强应用程序的功能。

展示了如何在Defy的工作室中设计和创建应用程序,包括定义输入字段和选择应用程序流程。

介绍了Defy中的不同块类型,如LLM、知识检索、问题分类器和HTTP请求等,以及它们在应用程序中的作用。

提供了一个示例,展示了如何使用Defy构建一个简单的工作流程,从搜索到模型生成答案。

讨论了Defy的监控和分析功能,允许用户查看应用程序的运行情况和性能。

强调了Defy的API功能,允许用户以编程方式触发应用程序的运行并获取结果。

提到了Defy的用户界面和定制性,以及如何通过发布工具重用工作流程。

指出了Defy的一些不足之处,如导航和标签一致性问题,以及应用程序的复杂性。

对Defy的整体评价是积极的,特别是对于初学者和需要快速原型的开发者。

鼓励观众分享他们对Defy的看法和可能的应用程序想法。

以感谢观看和告别结束了视频,同时建议观众开始一天的工作前先喝咖啡和水。

Transcripts

play00:00

what if you had an idea for a new AI app

play00:05

that would take a query get some

play00:07

information from a web search or some

play00:09

other tools pass that info and the query

play00:11

to the model and spit out the answer how

play00:14

long would it take you to build that app

play00:17

it's not that difficult but how long

play00:20

would it take you to spin up the

play00:21

infrastructure to host that app

play00:22

including the web search API a vector

play00:25

database if you need it a front end and

play00:27

anything else your application requires

play00:30

using a tool called defy you could have

play00:32

it do it for you so all you need to do

play00:35

is connect the components in a graphical

play00:37

interface answer a few questions and

play00:39

click a button to deploy it you will

play00:42

instantly have a UI your users can work

play00:44

with right away as well as an API for

play00:47

the app for when you want to build a

play00:49

more bespoke UI it's kind of magical it

play00:53

it isn't perfect but I kind of dig it

play00:57

the one thing you have to set up is the

play00:59

model provider I'm going to assume that

play01:01

you have Ama installed for this one but

play01:03

if you don't you can go to ama.com and

play01:05

follow the instructions in the middle of

play01:07

the

play01:08

homeage there are two main ways you can

play01:10

use defy you can pay them to host the

play01:13

application and anything you build and

play01:15

the prices seem pretty reasonable but

play01:18

I'm more excited about self-hosting and

play01:21

using it with AMA so to spin it up

play01:23

you'll need to have Docker

play01:25

installed I'll assume that you've done

play01:28

that already if you don't there are

play01:30

plenty of tutorials for that then you

play01:32

need to clone the GitHub repo to your

play01:34

local machine or wherever you want to

play01:37

run defy so get clone and this URL now

play01:41

go into the Divide directory and then

play01:43

into the docker directory copy the env.

play01:46

example file

play01:47

Tov if you already have something

play01:49

running on Port 80 on your machine there

play01:51

are three settings you need to change in

play01:53

the EnV file first decide what port you

play01:56

want to use in my case I'm using Port 80

play01:59

88 so in the EnV file if you're

play02:02

connecting to Local Host change app web

play02:05

URL and service API URL to

play02:09

http localhost col

play02:12

888 this will be used in the UI for any

play02:14

links to other parts of the app and way

play02:17

down at the bottom change expose engine

play02:19

xort to

play02:21

8088 there's a lot of other stuff you

play02:24

can set here such as the vector database

play02:26

to use storage Integrations and more but

play02:28

let's move on to running

play02:31

at the command line run Docker compose

play02:33

up- D it'll take a bit of time to

play02:36

download all the images and start

play02:38

everything up there are at least nine

play02:41

containers running when everything is

play02:43

set so open up a browser to Local Host

play02:46

Port 888 the first time you log in you

play02:49

need to set an admin account then you

play02:51

can log in as that account there are a

play02:53

few different parts of the product and I

play02:55

hope they reorganize the navigation

play02:57

because there are some things you only

play02:59

need rarely that are in the top

play03:01

navigation and other things that you

play03:02

need every day that are buried several

play03:05

clicks away you typically start in the

play03:07

studio this is where you design apps and

play03:10

can see the apps you've already created

play03:12

explore lets you discover examples of

play03:14

defy apps knowledge lets you add content

play03:18

to a vector database tools is a list of

play03:21

all the tools you can use and this is

play03:23

where you set up the login information

play03:25

for those tools thankfully there aren't

play03:27

a huge number of tools because they

play03:29

aren't in any order and there's no way

play03:32

to see which are enabled and configured

play03:35

and which are not well let's start by

play03:37

configuring a couple of things the first

play03:40

is going to be olama our model provider

play03:43

I'm going to assume that you have llama

play03:46

3 and namic embed text models installed

play03:50

if you don't run AMA pole llama 3 and ol

play03:53

Lama pole namic embed text so back into

play03:57

defi go to your name at the top right of

play03:59

the window under there you can find

play04:01

settings and right at the top is model

play04:04

provider of course this also has no sord

play04:06

order so you just have to look for it

play04:09

when you find it click add model so we

play04:11

want to add a regular chat model like

play04:13

llama 3 that's going to be the first

play04:15

option L for model name enter llama 3

play04:18

this actually has to be a model you have

play04:21

and it will error out if you don't base

play04:24

URL can be a little tricky if you

play04:26

installed oama locally on your machine

play04:29

you might be tempted Ed to put Local

play04:30

Host Port

play04:32

11434 but defi is running in Docker and

play04:35

so Local Host would probably refer to

play04:37

that Docker container what you need to

play04:39

do instead is put

play04:41

HTTP host. doer. internal colon11 1434

play04:47

that's how this container can find the

play04:49

actual host of the system if you put

play04:51

your AMA server somewhere else then

play04:53

point to that location for completion

play04:56

mode leave it at chat for model context

play04:59

we need need to be a little bit careful

play05:01

the original model released by meta has

play05:02

a contact size of 8K and there are lots

play05:05

of fine tunes that bump that up by

play05:08

enormous amounts but all models in ol

play05:11

with a few exceptions default to 2K

play05:14

since many users have limited memory

play05:16

it's easy enough to increase that by

play05:18

setting the numb CTX parameter in a

play05:20

model file or in the CLI or in the API

play05:22

call but since we're just using the

play05:24

default let's set this to

play05:27

248 the next thing is Max token limit

play05:30

some models have a contact size that's a

play05:32

lot bigger than what it can output there

play05:34

was a recent anthropic release that has

play05:36

something like a 200k context but output

play05:39

maxes out at 4K normally we can just set

play05:42

this to the same as the context size

play05:45

finally this does not have Vision

play05:47

support so leave that unchecked since

play05:50

we're here go back to the top and click

play05:52

add model for a llama again for model

play05:55

name enter nomic embed text enter the

play05:58

same URL which in my case is

play06:01

HTTP host. doer. internal

play06:05

11434 it's reasonable to have multiple

play06:08

olama servers each hosting different

play06:10

models so that's why we have to enter

play06:12

this each time finally model contact

play06:15

size is a little different you can see

play06:17

on this page for the model num CX is

play06:20

already set to

play06:21

8192 so enter that in the size text box

play06:24

now I don't understand why but most text

play06:27

boxes in this UI seem to take one

play06:29

character and then take the focus away

play06:31

totally bizarre okay for each of these

play06:34

two models you may need to click the

play06:36

Switch to enable them we're going to be

play06:38

using web search so the next step is to

play06:40

go to set up the tools which probably

play06:43

should be done in settings but isn't up

play06:45

at the top navbar is tools again there's

play06:48

no sword order I really like using

play06:50

search andng that's search with an X

play06:53

instead of a CH I have it running as a

play06:55

doer container all the time and use it

play06:58

often if you don't have it visit this

play07:00

site and get it up and running

play07:02

throughout defy they use very

play07:04

inconsistent phrases for configuring

play07:06

things here we need to just point to the

play07:09

URL for the search NG API but instead of

play07:12

anything that makes sense we need to

play07:15

click to authorize so click that our

play07:18

defy containers are probably not on the

play07:21

same Docker Network as search NG so

play07:23

enter the same Docker host name we used

play07:25

before assuming it also is installed on

play07:28

Docker so

play07:30

HTTP host. doer. internal colon 3333

play07:35

since my search NG host is using Port

play07:38

3333 you may be using something else

play07:42

then click save if you get the URL wrong

play07:44

it won't let you move on with all that

play07:47

set let's build our app so go into the

play07:49

studio create a new app by starting with

play07:52

a blank and we have a few choices

play07:54

there's a chat bot text generator agent

play07:57

and workflow but the only one that seems

play08:00

to be really interesting is the workflow

play08:02

let's so let's choose that and give it a

play08:04

name the start box allows us to define

play08:07

the first inputs to the flow when using

play08:09

a model it's important to define a

play08:11

prompt so create a new input field

play08:13

called prompt with a label of what would

play08:16

you like to know and a decent length now

play08:18

click that plus sign on the right side

play08:21

and we have a number of choices to use

play08:22

for our next block llm will send a

play08:25

prompt to a model knowledge retrieval

play08:28

pulls relevant content text out of a

play08:30

vector database end is the final block

play08:33

of any workflow question classifier lets

play08:35

you use a model to determine if any

play08:37

variable fits a certain class you define

play08:40

the classes which are just buckets to

play08:42

group possible matches maybe you want to

play08:44

look for queries that have a date or an

play08:46

artist name or a place name or that need

play08:49

a tool to answer or anything else for

play08:52

each match class you could continue down

play08:55

a different path and then there is if

play08:58

else where you can compare compare any

play09:00

variable against any other value and

play09:02

Define different paths for each option

play09:05

iteration lets you take any variable

play09:07

that has a list or array of items and

play09:09

then run the same block or multiple

play09:11

blocks on each thing maybe the previous

play09:14

block generated a list of topics and you

play09:17

want a set of tweets for each block to

play09:19

be

play09:20

generated next is code this lets us run

play09:23

any arbitrary python or JavaScript code

play09:26

using any variables as input template

play09:29

lets you apply a Ginger 2 template to

play09:31

any variable or set of variables

play09:33

variable aggregator lets you combine

play09:36

variables to create a new variable

play09:38

parameter extractor will use a model to

play09:40

try to extract one or more parameters

play09:42

from a variable finally there's HTP

play09:45

request this lets you make any restful

play09:48

API request with API Keys headers and

play09:51

parameters we can also run lots of tools

play09:53

here so if you switch to the tools tab

play09:55

you can find lots of ways of running web

play09:57

searches and lots of other things you

play09:59

may have to set these up first and

play10:01

there's no way to see what's set up and

play10:03

what is not but one common example is

play10:06

adding the current date to a request

play10:09

because otherwise the model has no way

play10:10

of knowing so for our first block choose

play10:14

search and G search at the query string

play10:16

box type a slash and then choose query

play10:19

from the start block leave everything

play10:21

else as is on the right side of the Box

play10:24

click the plus sign and choose llm

play10:27

choose llama 3 from the model list you

play10:29

can add whatever context you like a

play10:31

system prompt and then for the user

play10:32

prompt just type in slash and choose

play10:35

query from the start now I'll add a

play10:37

period just in case the user didn't type

play10:39

one and then add use the following

play10:41

information to help answer the question

play10:43

colon slash and then choose text from

play10:46

the search and G section before we chose

play10:49

the plus sign on the right side of the

play10:51

box but you can also go down to the

play10:52

bottom of this dialogue and click select

play10:54

next box and then select end now set the

play10:58

output to Output and specify the text

play11:00

from the model this is a pretty simple

play11:03

flow but let's try it out click the Run

play11:05

button at the top right enter in a

play11:07

question then click Start run if there

play11:10

are any problems along the way it'll let

play11:12

you know you can also go over to tracing

play11:14

and it'll show you the input and output

play11:16

of each box you can also publish and

play11:18

then run the app as an end User it's not

play11:21

the prettiest app and there isn't much

play11:23

customization that can happen but it's a

play11:25

good start but go back to the studio and

play11:27

choose monitoring change analysis to

play11:30

today and we see the runs from today

play11:33

that's pretty nice we also have access

play11:36

to the API where we can trigger the

play11:37

start and get the result at the end I

play11:40

also love the fact that you can build a

play11:42

flow one time and then reuse it in your

play11:45

other workflows by clicking publish this

play11:47

as a

play11:48

tool there is a lot more to defy and

play11:51

it's probably worth continuing to dig

play11:53

into it but again it's not perfect the

play11:55

navigation in the app needs a bit of

play11:57

work and nothing is is sorted in any way

play12:00

that makes any sense the published UI is

play12:03

always the same and it would be nice to

play12:05

be able to tweak it but as I say that it

play12:08

sounds a bit nitpicky some bigger

play12:11

complaints is that it's a pretty heavy

play12:13

app there are a lot of moving pieces

play12:17

maybe more than it really needs it feels

play12:19

like it started simple and rather than

play12:22

removing code they just kept adding and

play12:24

adding which gets a bit dangerous I

play12:27

would love to see this get clean up a

play12:29

bit labels should be a bit more

play12:31

consistent but again this is getting

play12:34

nitpicky and if I have to be nitpicky

play12:36

then maybe I think it's really awesome

play12:39

for beginners this is an amazing way to

play12:42

get started and for more experienced ABS

play12:45

it's a great way to prototype an idea

play12:48

quickly without getting stuck in the

play12:50

weeds of deploying to the test group of

play12:52

users we didn't really touch the rag

play12:55

stuff built in here but it defaults

play12:57

using weate and you can easily swap that

play12:59

out to using other Vector databases as

play13:01

well there is a lot you can do just by

play13:04

tweaking that configuration file which

play13:06

unfortunately is only minimally

play13:09

documented there's a lot in there that

play13:12

isn't very clear but with a little trial

play13:14

and error you can probably figure it out

play13:17

what do you think is this a tool that

play13:20

you could use do you have any ideas of

play13:22

what you might build with it I'd love to

play13:24

hear about it in the comments below

play13:26

thanks so much for watching goodbye

play13:36

start with a

play13:41

coffee and then some water

Rate This

5.0 / 5 (0 votes)

Related Tags
AI開発ウェブ検索ツール活用プロトタイピングDockerAPIベクターDBチャットボット検索エンジンインフラ構築
Do you need a summary in English?