Coze | How to use Workflows
Summary
TLDRこのビデオでは、ワークフローを使ってAIチャットボットをカスタマイズする方法を紹介しています。NBAの最新情報や統計、スコアをリアルタイムで提供するNBAボットを作成する例を通じて、マルチステップタスクを自動化する方法を説明します。ワークフローはノードを用いてタスクを分割し、最終結果を得るためのステップを定義します。プラグインやコードノードを活用してAPIからデータを取得し、大規模言語モデルを用いてユーザーにわかりやすい形で情報を提供します。ワークフローの実装前後でのボットの応答の違いも比較され、カスタマイズの重要性が強調されています。
Takeaways
- 🤖 AIチャットボットを作成するためにコードを使用し、プロンプト、追加スキル、プラグインを使用してボットにパーソナを与え、ナレッジベースを使用してインテリジェンスを提供している。
- 🛠️ ワークフローを使用して、マルチステップのタスクを完了する方法を紹介し、ボットをさらにカスタマイズする方法を説明している。
- 🏀 NBAボットの例を使用して、シーズン中の最新情報、統計、スコアを提供するだけでなく、過去のゲームやリアルタイムのゲームも確認できるようにしている。
- 📅 ワークフローの追加前と追加後のボットの応答の違いを比較し、データの正確性と一貫性を高めるためにワークフローが重要な役割を果たしていることを示している。
- 🔗 ワークフローはノードから構成されており、それらはステップとして機能し、最終結果を得るために互いに接続している。
- 🔧 コードノードを使用して、入力変数を処理し、特定の値を生成することができるが、ワークフローを作成する際にはコーディングの知識は必要ないが役立つ。
- 🔍 ナレッジノードはナレッジベースを使用して、問い合わせと入力に基づいて情報を照合し、情報提供を行う。
- 📝 if条件ノードと変数ノードはロジックを処理し、特定の条件に基づいて意思決定を行い、値を読み書きして保存することができる。
- 🔌 プラグインはワークフローのノードとして機能し、特定の情報源にアクセスするために使用される。
- 📈 ワークフローのテスト実行を通じて、ボットがAPIから受け取ったデータを処理し、ユーザーに必要な情報のみを提供するように調整している。
- 📝 最後に、ワークフローを公開し、ボットにワークフローを追加して、より良い応答を提供するように調整している。
Q & A
コードを使用してAIチャットボットを作成することとはどういう意味ですか?
-AIチャットボットを作成するためにコードを使用することは、プロンプトを使用してボットのパーソナを与えること、プラグインやスキルを追加してボットの機能を強化し、ナレッジベースを通じて知能を提供することであり、特定のニーズに応じてさらにカスタマイズすることが可能です。
ワークフローとは何で、どのようにしてマルチステップのタスクを完了させるのに役立つか説明してください。
-ワークフローは、タスクを完了させるためのステップバイステップのプロセスを定義するツールです。マルチステップのタスクを完了させるためには、ワークフロー内の各ノードを通じて入力を処理し、最終的な結果を得るための出力を生成します。
このビデオではどのような種類のAIチャットボットを作成していますか?
-ビデオではNBAボットを作成しており、その目的は最新の統計情報、スコア、シーズン中のすべてのNBAゲームに関する情報を提供することです。また、過去のシーズンやリアルタイムでのゲームも確認できます。
ワークフローを使わずにボットが生成するレスポンスと、ワークフローを使用した場合の違いは何ですか?
-ワークフローを使わずにボットが生成するレスポンスは、不正確なデータや不要な情報を含んでいる可能性があります。一方、ワークフローを使用することで、最も正確なデータを取得し、ユーザーに一貫した方法で提供できます。
ノードとは何で、ワークフロー内で何の役割を果たしますか?
-ノードはワークフローを構成する基本単位であり、特定の結果を得るために一つのステップを表します。ノードは互いに接続され、ユーザーからの入力を処理し、特定の答えを得るために必要な情報を提供します。
ワークフロー内で使用されるコードノードとは何であり、何のために使われますか?
-コードノードはワークフロー内で使用され、入力変数を処理し、戻り値を生成します。これは、APIやプラグインから特定の結果を得る必要がある場合に、コーディング知識が非常に役立ちますが、ワークフローを作成するためにはコーディングの知識は必須ではありません。
プラグインとは何で、ワークフロー内でどのように役立つのですか?
-プラグインは外部サービスやAPIと接続し、特定のデータを取得したり機能を提供したりするツールです。ワークフロー内でプラグインは、特定のタスクを自動化したり、必要な情報を取得したりするのに役立ちます。
このビデオではどのようにして独自のプラグインを作成し、それをワークフローに統合しましたか?
-ビデオでは独自のプラグインを作成し、NBA APIに接続して必要なデータを取得できるようにしました。そして、そのプラグインをワークフローにドラッグアンドドロップして、必要な情報を処理し、ユーザーに提供するように統合しました。
ワークフローの最終ステップであるエンドノードはどのような役割を持っていますか?
-エンドノードはワークフローの最終ステップで、ユーザーが求める答えを生成し、フォーマットして提供します。エンドノードは、ワークフロー内のすべてのステップを通じて得られた情報を元に、ユーザーにわかりやすい形で結果を提示します。
ワークフローを使用することでボットのレスポンス品質はどのように向上するのですか?
-ワークフローを使用することで、ボットはより正確な情報を取得し、必要のない情報を除外してユーザーに提供できます。これにより、ボットのレスポンス品質は向上し、ユーザーが求める情報をより正確かつ効果的に提供できます。
このビデオの最後にどのようにしてワークフローをボットに適用するか説明されていますか?
-ビデオの最後に、ワークフローを作成し、それをボットの空間に追加する手順が説明されています。そして、ワークフローを適用することで、ボットのレスポンスがどのように向上するのかを比較することができます。
Outlines
🤖 AIチャットボットのワークフローの紹介
この段落では、AIチャットボットを作成し、その個性を作り出し、知識ベースを通じて知能を与える方法が説明されています。さらに、ワークフローを使ってボットが特定のニーズに合わせて複数ステップのタスクを完了する方法も紹介されています。ワークフローは、ノードと呼ばれる基本単位からなり、それらが相互に接続して最終結果を得る仕組みです。ノードには、大規模言語モデルノード、プロンプト、コードノード、知識ノード、条件分岐、変数ノードなどがあります。また、プラグインや他のワークフローもノードとして使用できると示されています。
🏀 NBAゲーム情報のためのプラグインの作成とワークフローの構築
この段落では、NBAのスコアと統計情報を取得するためのカスタムプラグインを作成し、それをワークフローに組み込む方法が説明されています。プラグインはNDA APIに接続し、過去のゲームやリアルタイムのゲーム情報を含むデータを取得します。ワークフローでは、開始ノードからプラグインにデータを渡し、コードノードを使って必要な情報だけを抽出します。その後、大規模言語モデルノードを使って情報をユーザーにとって理解しやすい形に変換し、応答コンテンツを使って最終的な結果を整形します。
📊 NBAゲーム結果の詳細な情報抽出と整形
この段落では、コードノードを使ってAPIから取得したデータを加工し、必要な情報のみを抽出する方法が説明されています。次に、大規模言語モデルノードを使って、抽出された情報をユーザーに伝えるためのプロンプトを作成し、応答コンテンツを使って結果を整形します。これにより、ボットからの応答はより正確で詳細になり、ユーザーが求める情報だけを効率的に提供できます。
📝 ワークフローの実装前後でのボット応答の比較
最後の段落では、ワークフローを実装する前後のボットの応答を比較しています。ワークフローを実装する前は、ボットからの応答が不正確で、望まないゲームの結果も含まれていることが示されています。しかし、ワークフローを実装した後、ボットはAPIとコードノード、大規模言語モデルを通じて正確な情報を提供し、ユーザーの質問に適切に答えることができます。ワークフローの実装の重要性とその効果が明確に示されています。
Mindmap
Keywords
💡AI chatbot
💡Workflows
💡Persona
💡Skills
💡Plugins
💡Knowledge bases
💡Nodes
💡Large language model
💡API
💡Customization
Highlights
Creating an AI chatbot involves giving the bot a persona using prompts, extra skills or plugins, and knowledge bases.
Customization of the bot can be enhanced using workflows to complete multi-step tasks.
The example project is an NBA bot designed to provide the latest information, statistics, and scores of NBA games, including past, present, and real-time games.
Workflows help ensure accurate data by setting up multi-step tasks and providing uniform information to the user.
The starting node takes user input, and the end node produces the output in workflows.
Basic nodes include large language models, prompts, code nodes, knowledge nodes, if conditions, and variable nodes.
Plugins can also be used as nodes in workflows, and custom plugins can be created for specific needs.
An example custom plugin connects to an NBA API to fetch game data, scores, stats, and other relevant information.
Nodes in workflows connect in a sequence to achieve the desired result, with each node performing a specific task.
Code nodes allow processing of input variables and generation of return values, enhancing the workflow's capabilities.
Knowledge nodes use knowledge bases to match information based on inputs, aiding in accurate data retrieval.
If conditions and variable nodes help with logic, making decisions based on conditions and storing values for later use.
The example workflow involves nodes for starting input, NBA data retrieval, code processing, and output formatting.
The code node processes the NBA API data to extract only the necessary information, making the response concise.
The large language model node formats the extracted information into a readable format for the user.
Workflows significantly improve the accuracy and presentation of information provided by the bot.
The final output is tailored to present the number of games, teams, and scores for a specific date as per the workflow's design.
Transcripts
so you've been using codes to create an
AI chatbot that means that you've given
your Bot a Persona using prompts some
extra skills or plugins and then also
intelligence using knowledge bases
however you want to customize it even
more so that your Bot knows how to
really complete task tailor towards your
specific needs so in this video I'm
going to show you how to use workflows
so that your Bot knows how to complete
multi-step task let's head over to the
CO's workspace so I can show you how
workflows can really enhance your B
[Music]
all right so I'm creating an NBA bot and
the purpose of this spot is to give me
the latest information the statistics
and the scores of all the NBA games that
are happening this season and not only
that I'll be able to look at games that
happened in the past and previous
seasons and also games that are
happening in real time so the spot is
pretty powerful and workflows are going
to help us get there so there's actually
no need for me to really even look at
ESPN anymore because I have my own
personal assistant so if we look at our
Persona impr prompts I have a character
set with some skills and constraints and
over time I'll be able to add more to
this to enhance our bot even further so
if we look at the skills here we don't
have any plugins or workflows right now
so the reason why is because we haven't
created it yet and also because I want
to show you the difference between how
this operates without a workflow versus
towards the end of the video how it
operates when we do add the workflow so
let's ask this bot what the scores were
for January 20th 2024 and we'll see the
difference later on so let's see how
this bot generates a
response so I do remember watching games
on this day and I don't remember any of
these games happening the Warriors never
played the Rockets and the Lakers did
not play the Milwaukee Bucks on this
date so this is where workflows are
going to come into play we're not sure
where this data came from however with
workflows we'll be able to set up a
multi-step task in order for us to get
the most accurate data and deliver it to
our user in a uniform way so what we'll
do now is we'll go over here to add
workflows and we'll create our
workflow and we'll name our workflow
MBA workflow for
now and the description box is a place
that you can describe your workflow of
course however it uses a large language
model to help our workflow understand
how it needs to be invoked so we can
just say get the latest
NBA
scores okay so the first thing to
understand about workflows are nodes and
nodes are the basic unit of what make up
workflow and nodes connect to one
another in order to get an end result so
think of a node as a step that it takes
in order to give our user the specific
answer that we want so we have our
starting node here that it comes with
and this starting node is where the user
puts an input or the question that
they're asking and then the other node
that uh the workflow gives us is the end
node here and the end node is what
produces our output and Returns the
value that we're looking for here so
that would be our
answer now there are a few other nodes
that go in between the start node and
the end node and if we bring our
attention here to the left side we'll
see that we have basic nodes so we have
our large language model node which
invokes a large language model and it
can gener generate a response based on
the input that we give it and then we
also have a prompt that we can have to
specify our answer even more and I'll
show you how to use that too we also
have our code node here which allows you
to process an input variable and it will
generate a return value so with work
flows just keep in mind you don't need
to know how to code however it does help
a lot if you do have this knowledge
because being able to get these specific
answers from things like plugins or apis
you're going to be required to know how
to code or at least understand what's
going on to get the results that you
want now the next node that we have here
are the knowledge nodes and this is a
node that uses the knowledge bases that
you create and matches information based
on what you're asking here and what your
inputs are then we also have our if
condition and our variable nodes here
which are a little bit more related to
coding however these are to help with
logic so our if condition here will
allow us to um actually make some type
of decision if something's happening
then do this and our variable node here
is to help us read and write values so
that we can store things and pass them
on when we need them to be um so not
only do we have these basic nodes we
also have plugins that can be nodes and
workflows that can also be nodes so you
can also use another workflow that you
you created as a node itself but in this
video we're not going to cover that but
uh we're actually going to talk about
plugins here so with plugins we have
plenty of plugins like Reddit Microsoft
Outlook slack Google search you name in
however these plugins right here aren't
really going to specifically give me
what I want so I took my time to create
my own plug-in and this plugin connects
to an NDA API that I'm able to grab the
data that I want so this data consists
of games that happened in the past or
even games that are happening right now
in real time so I'm able to grab the
scores and stats and also even see who
even officiated the game now I might not
need all that information to create this
workflow however we're going to use bits
and pieces of it all right so let's add
our MBA node here from our plugins and
we'll just drag it here to the middle
now what we'll do is actually name this
starting input that we have here and
we're just going to name the starting
input date because this is where the
user is going to be asking their
question um so this question is based
off of the date that we're going to be
sending to this NBA API node that we
have here as well so our description
we'll just set this simply as what this
is going to do it's just going to be
taking a date in by a format and the
format doesn't really matter because
it's going to be running through an llm
anyways so it's going to be able to
determine the date based on how we
rewrite it now the next step is we're
going to connect our starting node to
our NBA Daily data node that has our NBA
plugin in it right so this plugin is
already created and it's already looking
for this game date here so we're using
the game date to determine where uh what
games are being played now this game
date we're going to reference this to
the input that we have from the start
node on the date so we're connecting
this date this question of what games
happen on this date to this NBA node
that's actually a plugin that connects
to an API and this API has all of the
data that we need for games that are
happening in real time or games that
happened in the past based on the date
that we ask now when we use this plug-in
here we have this payload with all this
data and so for the next step what I'm
going to do is I'm going to add a code
node here so you can see what it looks
like when we connect all this to code
and we start to parse out this
information the code node requires the
most amount of complexity here but it's
not required for you to make a
workflow I'm still going to show you how
to do it anyways because it is important
to know the power that this code node
can actually bring to your workflow that
will then be presented in your Bot so
we'll go ahead and we'll connect this
daily data node to our code node and
I'll use a block of code that I've
already created and I'll explain it and
go down each
line but before we do that let's take a
look at these input puts I want to make
sure that I am getting the inputs that I
need from this NBA Daily data node so
I'm going to need a few things let's
look through this uh payload that we get
so we look through here through date and
I definitely want some games all this
data from who was the away team to the
profiles of the players all the way to
the game count as well so let's take
this input and we're going to name it
games and then we're going to have this
reference our NBA Daily data payload and
we'll look for here in date and we'll
get games and then I'm going to add
another input here for the games count
so I want to be able to tell my user how
many games happened on that day as well
because every day is different so I'll
take this I'll go to NBA Daily data and
then I'll also go to my payload my dat
and game count and it's just great
because I can go through all these
different fields here and customize my
response how I want it to look so now
that I have these inputs here let's take
a look at this code block a bit now this
code block all it's telling me is to go
through the uh list of games that we
have inside of our payload so it'll tell
me all the games that are happening
create a new array of these games and
bring me back the profile the box score
who the home team was and who was the
away team and here all I'm saying is
bring me back the city of the home team
and bring me back the name of the home
team and the same thing for the away
team as well so I'm just going through
all this information that's being taken
from this node and pass to the code and
I'm just splitting it into little tiny
chunks so I can only get the information
that I'm actually looking for and not a
bunch of other things that are not
necessary now for this output what I'll
do now as well is I'll set up my out
outut so that my things that I'm getting
as my input from here are going to be
passed on to the next node which would
be my large language model so I want
these same inputs these answers for what
were the games and how many games
happened and then within that same uh
information we're getting from this node
we'll get the profile the box score who
the home team was and who the way team
was and so forth so let's go here and
add our
games and we'll keep this as a type
string right because it's just a text
and then we're going to add another one
here for game
count and we'll change this to a number
because just the number of games that
we're going to be presenting to the user
so the next step is to create a large
language model node and put it here in
order to connect to our code node
because this large language model node
is going to be able to take this
information that we have in this
unreadable format and make it more
legible for our user to understand so
what I'll do now is I'll take this large
language model prompt that I've already
created as well and I'll put this inside
of our large language model node so
let's move things over to the
side and we'll connect our nodes
together right and let's connect this to
the end node here and what I'll do now
is change my GPT model to GPT 4 and I
can keep the temperature the same but
the things that are different is I'm
going to this input right is actually
going to be referencing our input of the
games so I'm going to put games here and
then I'm going to reference what I'm
getting from this code node it's being
passed down so this input that I put
here for the games that's getting from
the plugin and then it's spitting back
out here through this output I want to
pass this output all the way to this
large language model so let's go here
and take from our code I want the games
now I have a prompt that I've already
written as well and this prompt is just
describing what I want this workflow to
do with the data that I'm passing to it
from the code node now this is just
going to be able to tell our uh large
language model exactly what we want and
it's going to be able to Output inside
of our end result a lot better than how
it would without this larger language
model so for this output I'm just going
to custom make this to game results and
I'll just do game res for short and I'll
keep this as a string because this is
just going to be a text again that's
going to hold all the information that I
want and I'll just say that this is the
results of the
games okay great so now I have
everything ready to go and it's
connected to my end node here now my end
node is pretty much how I want my result
to be formatted here right so I'm
already have all the information
information that I need and now I'm just
being able to present it to the user the
way that I want to with this end node
and I'm going to take this game result
that we
have and I'm going to have that as an
input but before I do that let's add an
answer with a direct answer content as
well and this is where we're going to be
able to format our response the way we
want it to be so we'll take game results
let's do game res and I'm going to
reference that to what we're getting
from our large link model all right I'll
also take my date that I'm going to be
taking from the user from the beginning
right so I have to reference my date
from the start and then I also am going
to take my game count right so we have
our game count because we want to have
our amount of games that we're going to
present to our user as well and we have
our game count is coming from our uh our
code all right so now all we need to do
is create some type of answer content
and we're going to customize how this
answer is going to look so um we're
going to use these same input fields in
order to do that and I've already have
this written out here so that when it
does print out to the user and they ask
hey tell me the scores for this specific
date it's going to list it in a way that
we have this formatted here so the bot's
going to
say there were blank amount of games on
a certain date here were the results so
now we have all these notes connected
and let's give it a test run and see how
it
works so we have this date here we'll
submit for the 20th of January and we'll
submit it and let's zoom out a bit and
we're going to see how this workflow is
being used here so we have our starting
node is already having a success and our
start node again is just taking in our
input so we can display our result here
and you'll see this just taking in the
date right and then we also have our NBA
Daily data node and this here is taking
in our our game date and it's giving us
back this payload and it's letting us
know we had eight games on that day
here's some highlights here's the away
team and all this other information that
we're going to need but if you look at
how much data is in here there's a lot
and we really don't need all of this now
this then gets passed to our code node
and this is where we take care of
truncating that data and making it a lot
smaller because we're only asking for
the profile the box score who the home
team was who the away team was and the
amount of games that did happen on that
day so we have our display result here
and we'll see that we have this input
given from this API and look how much
longer this is from this input that
we're getting from the API or this node
and how much shorter it is now when we
run it through this code because we're
only taking out the information that we
want now this is being passed to our
large language model node now this large
language model node is taking this
information from this output and running
it through this prompt to make it more
readable for us
and we show this display result here and
we take this input this same output that
we get from here it turns into an input
and an outputs here are the game results
uh the NBA games that happen Milwaukee
Bucks Detroit Pistons it shows all these
games that happen on this date and
notice how this list is a lot shorter
now it's only showing these eight games
so when we pass this large language
model node inputs and outputs to our
successful end node we're going to only
take out this information that we do
want to present to our user the game
results the game date and the game count
and if we display our results here
you'll see that we have it custom made
on how we've written here in our answer
content and it says there were x amount
of games here on this date and it's
going to present it in the way that we
wanted to so let's go right here and
publish our workflow after a successful
run that we just
have and we can go over here to are bot
currently there's no workflows or
plugins in this bot it's just powered by
a Persona impr prompt at the moment so
what I'm going to do now is just compare
how this bot responds without a workflow
versus how it will respond when we do
add the workflow so let's just ask this
spot the same question we had before
what happens on January 20th tell me the
scores and let's
see so right now I can already tell you
off the bat this Warriors versus Lakers
game did not happen on this date
and either did this Heat versus 76ers
game so I'm not sure where this
information is coming from and it
doesn't mean that these Bots are not
intelligent it's just that it's not
tailored for our needs yet and that's
where the workflow is come into play so
let's see how this looks when we add a
workflow now if I go to I created and
add my workflow to the
space I'll ask this bot the same
question again and then we're going to
see how this response is completely
different
now so as you you can see here it's
going through the workflow just remember
all those nodes that the inputs are
being passed from one node to the next
all the way to get to the end result and
as we look at how this response is we'll
see that this is tailored to how we
wrote it in our workflow remember we
wrote in our workflow that there were
going to be a certain amount of games on
this date that's how we formatted the
text to be and now this workflow is
going through the API and the also the
code node the large language model all
the way to the end to give us the
accurate information and the accurate
scores that happen on the state so
that's the power of workflows right I
can specify how I want things to look
and tailor make it for my users all
right so that's how you use workflows
with codes now it's the most advanced
feature when it comes to using the
platform however you can really see the
difference in the quality of the answer
your Bot gives when you implement a
workflow now if you want to learn more
check out our documentation and also
join us on Discord keep a lookout for
more videos and I'll see you next time
Voir Plus de Vidéos Connexes
AWS re:Invent 2023 - Use RAG to improve responses in generative AI applications (AIM336)
Difyのコードブロックを使い、スプレッドシートからデータを取得して回答する仕組みを作る
話題のDifyを使う上での注意点と設定方法について解説してみた
生成AI モデルの開発と展開のためのNVIDIA NeMoフレームワーク
Extend Copilot for Sales with custom data and insights from your own apps
【6分で分かる】大規模言語モデルを使ったRAGについて解説!
5.0 / 5 (0 votes)