Is Dify the easiest way to build AI Applications?
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
🤖 AIアプリ開発のツールDefyの紹介
この段落では、新しいAIアプリのアイデアを実現するためのツールDefyについて紹介しています。Defyを使うと、ウェブ検索や他のツールから情報を取得し、モデルに渡して回答を得ることができます。Defyは、グラフィカルインターフェースでコンポーネントを接続し、数クリックでアプリを展開できるため、インフラのホスティングに必要なウェブ検索APIやベクターデータベース、フロントエンドなどがすぐに用意できます。また、Defyはホスティングサービスを提供する一方で、Dockerを使用してセルフホスティングも可能で、AMA(Anthropic Model API)との連携が想定されています。
🔧 Defyの設定とモデルプロバイダーの設定方法
第二段落では、Defyの設定方法とモデルプロバイダーの設定について説明しています。Defyの設定には、ポートの設定や環境ファイルの編集、Dockerコンテナの実行などが含まれます。モデルプロバイダーとしてAMAを使用する場合、特定のモデルを追加し、ベースURLやコンテキストサイズ、最大トークン制限を設定する必要があります。また、DefyのUIではツールの設定やアプリの作成、ワークフローの構築が行えますが、ナビゲーションやツールの順序付けが不明瞭な点に留意する必要があります。
🛠️ Defyを使ったAIアプリの開発フローとアプリの実行
最後の段落では、Defyを使ってAIアプリの開発フローを作成し、実行する方法について詳しく説明しています。開発者は、アプリの最初の入力を定義し、モデルにプロンプトを送信して回答を得るためのワークフローを構築します。ウェブ検索やLLM(Large Language Model)を利用して、ユーザーのクエリに応じた回答を生成することができます。アプリの実行時には、問題が発生した場合のトレーシング機能や、アプリのパフォーマンスを監視するモニタリング機能が利用できます。また、DefyのUIのカスタマイズ性やアプリの重さ、ナビゲーションの改善点についても触れています。
Mindmap
Keywords
💡AIアプリ
💡ウェブ検索API
💡ベクターデータベース
💡Defyツール
💡モデルプロバイダー
💡Docker
💡グラフィカルインターフェース
💡ワークフロー
💡検索エンジン
💡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
what if you had an idea for a new AI app
that would take a query get some
information from a web search or some
other tools pass that info and the query
to the model and spit out the answer how
long would it take you to build that app
it's not that difficult but how long
would it take you to spin up the
infrastructure to host that app
including the web search API a vector
database if you need it a front end and
anything else your application requires
using a tool called defy you could have
it do it for you so all you need to do
is connect the components in a graphical
interface answer a few questions and
click a button to deploy it you will
instantly have a UI your users can work
with right away as well as an API for
the app for when you want to build a
more bespoke UI it's kind of magical it
it isn't perfect but I kind of dig it
the one thing you have to set up is the
model provider I'm going to assume that
you have Ama installed for this one but
if you don't you can go to ama.com and
follow the instructions in the middle of
the
homeage there are two main ways you can
use defy you can pay them to host the
application and anything you build and
the prices seem pretty reasonable but
I'm more excited about self-hosting and
using it with AMA so to spin it up
you'll need to have Docker
installed I'll assume that you've done
that already if you don't there are
plenty of tutorials for that then you
need to clone the GitHub repo to your
local machine or wherever you want to
run defy so get clone and this URL now
go into the Divide directory and then
into the docker directory copy the env.
example file
Tov if you already have something
running on Port 80 on your machine there
are three settings you need to change in
the EnV file first decide what port you
want to use in my case I'm using Port 80
88 so in the EnV file if you're
connecting to Local Host change app web
URL and service API URL to
http localhost col
888 this will be used in the UI for any
links to other parts of the app and way
down at the bottom change expose engine
xort to
8088 there's a lot of other stuff you
can set here such as the vector database
to use storage Integrations and more but
let's move on to running
at the command line run Docker compose
up- D it'll take a bit of time to
download all the images and start
everything up there are at least nine
containers running when everything is
set so open up a browser to Local Host
Port 888 the first time you log in you
need to set an admin account then you
can log in as that account there are a
few different parts of the product and I
hope they reorganize the navigation
because there are some things you only
need rarely that are in the top
navigation and other things that you
need every day that are buried several
clicks away you typically start in the
studio this is where you design apps and
can see the apps you've already created
explore lets you discover examples of
defy apps knowledge lets you add content
to a vector database tools is a list of
all the tools you can use and this is
where you set up the login information
for those tools thankfully there aren't
a huge number of tools because they
aren't in any order and there's no way
to see which are enabled and configured
and which are not well let's start by
configuring a couple of things the first
is going to be olama our model provider
I'm going to assume that you have llama
3 and namic embed text models installed
if you don't run AMA pole llama 3 and ol
Lama pole namic embed text so back into
defi go to your name at the top right of
the window under there you can find
settings and right at the top is model
provider of course this also has no sord
order so you just have to look for it
when you find it click add model so we
want to add a regular chat model like
llama 3 that's going to be the first
option L for model name enter llama 3
this actually has to be a model you have
and it will error out if you don't base
URL can be a little tricky if you
installed oama locally on your machine
you might be tempted Ed to put Local
Host Port
11434 but defi is running in Docker and
so Local Host would probably refer to
that Docker container what you need to
do instead is put
HTTP host. doer. internal colon11 1434
that's how this container can find the
actual host of the system if you put
your AMA server somewhere else then
point to that location for completion
mode leave it at chat for model context
we need need to be a little bit careful
the original model released by meta has
a contact size of 8K and there are lots
of fine tunes that bump that up by
enormous amounts but all models in ol
with a few exceptions default to 2K
since many users have limited memory
it's easy enough to increase that by
setting the numb CTX parameter in a
model file or in the CLI or in the API
call but since we're just using the
default let's set this to
248 the next thing is Max token limit
some models have a contact size that's a
lot bigger than what it can output there
was a recent anthropic release that has
something like a 200k context but output
maxes out at 4K normally we can just set
this to the same as the context size
finally this does not have Vision
support so leave that unchecked since
we're here go back to the top and click
add model for a llama again for model
name enter nomic embed text enter the
same URL which in my case is
HTTP host. doer. internal
11434 it's reasonable to have multiple
olama servers each hosting different
models so that's why we have to enter
this each time finally model contact
size is a little different you can see
on this page for the model num CX is
already set to
8192 so enter that in the size text box
now I don't understand why but most text
boxes in this UI seem to take one
character and then take the focus away
totally bizarre okay for each of these
two models you may need to click the
Switch to enable them we're going to be
using web search so the next step is to
go to set up the tools which probably
should be done in settings but isn't up
at the top navbar is tools again there's
no sword order I really like using
search andng that's search with an X
instead of a CH I have it running as a
doer container all the time and use it
often if you don't have it visit this
site and get it up and running
throughout defy they use very
inconsistent phrases for configuring
things here we need to just point to the
URL for the search NG API but instead of
anything that makes sense we need to
click to authorize so click that our
defy containers are probably not on the
same Docker Network as search NG so
enter the same Docker host name we used
before assuming it also is installed on
Docker so
HTTP host. doer. internal colon 3333
since my search NG host is using Port
3333 you may be using something else
then click save if you get the URL wrong
it won't let you move on with all that
set let's build our app so go into the
studio create a new app by starting with
a blank and we have a few choices
there's a chat bot text generator agent
and workflow but the only one that seems
to be really interesting is the workflow
let's so let's choose that and give it a
name the start box allows us to define
the first inputs to the flow when using
a model it's important to define a
prompt so create a new input field
called prompt with a label of what would
you like to know and a decent length now
click that plus sign on the right side
and we have a number of choices to use
for our next block llm will send a
prompt to a model knowledge retrieval
pulls relevant content text out of a
vector database end is the final block
of any workflow question classifier lets
you use a model to determine if any
variable fits a certain class you define
the classes which are just buckets to
group possible matches maybe you want to
look for queries that have a date or an
artist name or a place name or that need
a tool to answer or anything else for
each match class you could continue down
a different path and then there is if
else where you can compare compare any
variable against any other value and
Define different paths for each option
iteration lets you take any variable
that has a list or array of items and
then run the same block or multiple
blocks on each thing maybe the previous
block generated a list of topics and you
want a set of tweets for each block to
be
generated next is code this lets us run
any arbitrary python or JavaScript code
using any variables as input template
lets you apply a Ginger 2 template to
any variable or set of variables
variable aggregator lets you combine
variables to create a new variable
parameter extractor will use a model to
try to extract one or more parameters
from a variable finally there's HTP
request this lets you make any restful
API request with API Keys headers and
parameters we can also run lots of tools
here so if you switch to the tools tab
you can find lots of ways of running web
searches and lots of other things you
may have to set these up first and
there's no way to see what's set up and
what is not but one common example is
adding the current date to a request
because otherwise the model has no way
of knowing so for our first block choose
search and G search at the query string
box type a slash and then choose query
from the start block leave everything
else as is on the right side of the Box
click the plus sign and choose llm
choose llama 3 from the model list you
can add whatever context you like a
system prompt and then for the user
prompt just type in slash and choose
query from the start now I'll add a
period just in case the user didn't type
one and then add use the following
information to help answer the question
colon slash and then choose text from
the search and G section before we chose
the plus sign on the right side of the
box but you can also go down to the
bottom of this dialogue and click select
next box and then select end now set the
output to Output and specify the text
from the model this is a pretty simple
flow but let's try it out click the Run
button at the top right enter in a
question then click Start run if there
are any problems along the way it'll let
you know you can also go over to tracing
and it'll show you the input and output
of each box you can also publish and
then run the app as an end User it's not
the prettiest app and there isn't much
customization that can happen but it's a
good start but go back to the studio and
choose monitoring change analysis to
today and we see the runs from today
that's pretty nice we also have access
to the API where we can trigger the
start and get the result at the end I
also love the fact that you can build a
flow one time and then reuse it in your
other workflows by clicking publish this
as a
tool there is a lot more to defy and
it's probably worth continuing to dig
into it but again it's not perfect the
navigation in the app needs a bit of
work and nothing is is sorted in any way
that makes any sense the published UI is
always the same and it would be nice to
be able to tweak it but as I say that it
sounds a bit nitpicky some bigger
complaints is that it's a pretty heavy
app there are a lot of moving pieces
maybe more than it really needs it feels
like it started simple and rather than
removing code they just kept adding and
adding which gets a bit dangerous I
would love to see this get clean up a
bit labels should be a bit more
consistent but again this is getting
nitpicky and if I have to be nitpicky
then maybe I think it's really awesome
for beginners this is an amazing way to
get started and for more experienced ABS
it's a great way to prototype an idea
quickly without getting stuck in the
weeds of deploying to the test group of
users we didn't really touch the rag
stuff built in here but it defaults
using weate and you can easily swap that
out to using other Vector databases as
well there is a lot you can do just by
tweaking that configuration file which
unfortunately is only minimally
documented there's a lot in there that
isn't very clear but with a little trial
and error you can probably figure it out
what do you think is this a tool that
you could use do you have any ideas of
what you might build with it I'd love to
hear about it in the comments below
thanks so much for watching goodbye
start with a
coffee and then some water
5.0 / 5 (0 votes)