Controlling Agents with Step-by-Step Execution (Part 5, Introduction to Agents)
Summary
TLDRこの動画では、より細かい粒度でエージェントをステップバイステップで制御できる「ステップバイステップ制御レベルAPI」について解説しています。低レベルAPIにより、タスクの作成と実行が分離され、各ステップと次に来るステップを確認できます。エミュレーションの実行方法とステップバイステップ実行の違いを示し、応答の各ステップを確認する方法を説明します。また、データの読み込みやインデックス作成、クエリエンジンの設定など、高度なプロセスをステップバイステップで実行する方法も紹介しています。
Takeaways
- 🤖 ステップバイステップで制御できるエージェントの紹介:低レベルAPIを使用して、より詳細にエージェントを制御できます。
- 🔍 タスクの作成と実行が分離されているため、各ステップと次のステップを確認できます。
- 📈 直接実行とステップバイステップ実行の比較で、実行の違いを実感できます。
- 🚀 関数呼び出しエージェントとリアクションエージェントの両方でステップバイステップで制御できるエージェントを使用できます。
- 📚 ノートブックでは関数呼び出しエージェントを使用して、ステップバイステップの実行方法を示しています。
- 🔢 演算の例として、20 + 2 * 4 - 8 の計算を通じて、ステップバイステップの実行方法を説明しています。
- 📊 データの分析に例として、R&D費用と収益の変化を分析する方法を説明しています。
- 📆 3月、6月、9月のUberの文書を用いて、データの読み込みと索引の作成方法を紹介しています。
- 🛠️ ステップバイステップで実行する際には、各ステップの出力を確認し、最終的なLLM応答を受け取ります。
- 🔄 ステップバイステップの実行中に、人間によるフィードバックを追加することができます。
- 🔍 ステップが漏れている場合でも、人間がフィードバックを追加して正しい方向に導くことができます。
Q & A
ステップバイステップ制御レベルエージェントとは何ですか?
-ステップバイステップ制御レベルエージェントは、より細かいアプローチでエージェントをステップスルーおよび制御できる低レベルAPIです。
タスクの作成とタスクの実行はどのように分離されていますか?
-ステップバイステップ制御レベルエージェントでは、タスクの作成と実行が分離され、各ステップを個別に表示し、次のステップと一緒に確認できます。
ステップバイステップ実行とは何ですか?
-ステップバイステップ実行は、一度に全てを実行するのではなく、各ステップを個別に実行し、確認することで、プロセスの理解やトラブルシューティングを容易にします。
リアクションエージェントと関数呼び出しエージェントのどちらがこのノートブックで使用されていますか?
-このノートブックでは、関数呼び出しエージェントを使用していますが、リアクションエージェントも使用することができます。
計算ツールを使用して何を実行できますか?
-計算ツールを使用すると、基本的な計算機能(例えば、加算、減算、乗算など)を実行できます。
ステップバイステップ実行の利点は何ですか?
-ステップバイステップ実行の利点は、プロセスの各ステップを個別に確認し、問題が発生した場所を特定し、適切な修正を行うことができることです。また、システムに人間フィードバックを追加することもできます。
データの読み込みとインデックス作成にはどれくらいの時間がかかりますか?
-データの読み込みとインデックス作成には、それぞれのドキュメントのページ数が多いため、時間がかかることがあります。
R&D費用と収益の変化を分析するために、どのようなエージェントを作成しましたか?
-R&D費用と収益の変化を分析するために、関数呼び出しエージェントを作成し、3月のツール、6月のツール、9月のツールを使用してクエリエンジンを定義しました。
ステップバイステップ実行中に人間フィードバックを追加するにはどうすればいいですか??
-ステップバイステップ実行中に人間フィードバックを追加するには、各ステップの出力を確認し、必要に応じて入力としてフィードバックを提供することで可能です。
ステップバイステップ制御レベルエージェントを使用する際に、最後のステップを識別する方法は何ですか?
-最後のステップを識別するには、各ステップの出力で「last」というフラグがfalseまたはtrueを返すかどうかを確認します。
このビデオスクリプトの目的は何ですか?
-このビデオスクリプトの目的是、ステップバイステップ制御レベルエージェントの使い方と、それがどのように役立つかを説明することで、視聴者の理解を深め、応用方法を提供します。
Outlines
📚 ステップバイステップ制御のAPIエージェント
この段落では、RaviがLama indexから来て、ビデオでステップバイステップ制御のAPIエージェントについて説明しています。これは、より細かいアプローチでエージェントを通過し、制御できる低レベルAPIです。タスクの作成とタスクの実行が分離され、各ステップと次のステップを一緒に見ることができます。このノートブックでは、関数呼び出しエージェントを使用して、ステップバイステップ制御エージェントを示します。まず、通常の実行を実行して、ステップバイステップの実行との違いを理解します。次に、タスクを作成し、各ステップを実行し、最終的な結果を得ることができます。
🔍 データ分析のためのステップバイステップ実行
この段落では、Raviがデータ分析のステップバイステップ実行について説明しています。まず、データの読み込みとインデックス作成を行い、クエリエンジンを設定します。その後、March、June、Septemberの3つのツールを作成し、R&D費用と収益の変化を分析します。ステップバイステップ実行では、各ステップを個別に実行し、最終的な結果を得ることができます。また、ステップ間に人間のフィードバックを追加して、出力を変更することもできます。この方法で、ステップバイステップ制御エージェントを使用して、システムの出力を確認し、改善することができます。
Mindmap
Keywords
💡Stepwise Control
💡API
💡Function Calling Agent
💡Task Creation
💡Execution
💡Calculator Functions
💡React Agent
💡Indexing
💡Query Engine
💡Human Feedback
💡Final Response
Highlights
Introduction to stepwise control level agent, a lower level API for granular control of an agent.
Task creation and tax execution are separated, allowing for a detailed view of each step and upcoming steps.
Execution without stepwise shows a direct result, highlighting the difference when compared to stepwise execution.
Stepwise controllable agents are available with both react agent and function calling agent.
Demonstration of function calling agent in the notebook, with the option to experiment with the react agent as well.
Explanation of how to execute tasks directly and the difference in stepwise execution.
Importing required modules and setup of API key for the demonstration.
Creation of tools from calculator functions and setup for the function calling agent.
Execution of the agent directly showing the sequence of operations: multiplication, addition, subtraction, and final LLM response.
Stepwise execution demonstration, showing how to execute one step at a time and check for the last step.
Illustration of how step outputs can be checked and how the process continues to the next step.
Transition from demonstration with calculator functions to using rack tools with actual documents.
Loading and indexing of large documents, such as March, June, and September Uber documents.
Creation of query engine and definition of tools for each month's documents.
Direct execution of the agent to analyze changes in R&D expenditures and revenue.
Stepwise execution with rack tools, showing the process of calling each month's tool and getting outputs.
Inclusion of human feedback into the stepwise process to influence the direction and outcome of the agent's response.
Conclusion summarizing the use of stepwise controllable agents for experimentation and exploration.
Transcripts
hey everyone Ravi here from Lama index
um so in this video we'll look into uh
stepwise control level agent so this is
a low level lower level API um that
allows you to step through and control
an agent on a more uh granular approach
so basically uh in these cases task
creation and the tax execution are
separated so so that you can view each
step and uh together with the upcoming
steps as well so we'll uh you can
actually see the differentiation when
you execute it directly without any uh
stepwise execution and doing stepwise
execution uh in this notebook so
stepwise U controllable agents are uh
available with both react agent and uh
function calling agent uh in this
notebook uh I'll show with the function
calling agent but feel free to exper
with the react agent as well so let's
get started with
it we'll import all the modules required
uh
setup API key uh we have all the usual
uh calculator functions and we'll create
the
tools out of it and then uh we'll create
the uh function calling agent as usual
ual first we'll execute it directly
without any stepwise execution so this
will help you to understand the
differentiation so here the result is 20
like 20 + 2 * 4 - 8 so there is
multiplication first and then addition
and then
subtraction and then a final llm
response so um that's how it is executed
right there are four steps uh one
multiply then the addition then the
subtraction and then the final llm
response now let's see how you can do
this stepwise rather than in one single
go right so first step is to create this
task this is the task and then we'll go
with the uh executing the first step
which is run step and then you get the
one step
output you can check the uh step output
here you can see
that this is not uh last step and what
is the output what are the arguments
what is output from this right all those
things you can check the uh step output.
e last which is false so that are steps
ahead so run it again uh so you got the
next step which is addition 28 you can
check again whether it's last step or
not this is not so run it again and then
you can see that uh this is subtraction
is done and then probably you check if
this is the last step
again um this is false right so you need
to run it
again so and the lrm response here it
ends so and then finally you get a
response right so here you can see what
are all the different steps you can run
through it uh by checking whether it's a
last step or not and get a final
response so this is more of lower level
API agent API um uh that you can see
what are the different steps going on um
executing one step at a
time okay we'll observe the similar
thing with the rack tools as well so
we'll consider uh uh March June and
September Uber uh
documents and uh let's load the data
this will take some time uh because of
the huge uh number of pages in each of
the document and then we'll uh create
index and tools um
so we have a function to Define get the
Tool uh this will uh create index and
then uh create query engine and then
Define the
tool so let's do that and then let's
create uh
uh tools for uh March June and September
and get the query engine
tools now we'll uh create the agent and
then first let's do the direct execution
analyze the changes in R&D expenditures
and revenue let's see how it works so
think still it's loading the
data we take a minute of time probably
uh even indexing might take more
time so let's
see and then once it is executed so and
then we can see the stepwise execution
as well uh Again by creating the task
and running one step at a time and
checking whether it's a last step or not
right
so we'll see how it works so yeah
yeah
so here you can see it called the March
2022 first and
then uh it gave some
output then it went for uh
June
tool and then again
think the final one the
September right so this give the output
and you'll get a final response um so
here as well there are four steps right
uh first calling
the March then uh June September and
then the final llm
response so so that's how it is uh let's
do the uh stepwise execution
now and then create the
task and you can check the first
step so it called U March 2022 tool with
the input R&D expenditures and revenue
and then check if it last step which is
false and then run the next step
again right
um I should ideally call the
June yeah June 2022
tool and then if check if the last step
no run
again it should call the September one
now so yeah this is the September one
and then yeah let's check this is the
last step I should be know and then next
step this is like
the llm response
ideally yeah so this is the last step
and finally get the
response that's it so we went through
each step individually and got the final
response and also you can actually give
a separate input in the one of these
steps right as a human
feedback so let's create the agent and
create the task let's run first step the
first step is uh March whatever we have
seen um yeah it call the March tool and
then it gets the response obviously this
is not the last step uh the next step we
have seen is June so we'll ask uh with
the input what about September
so now it will it should ideally call
September yeah so with the September
tool and it generates a response
accordingly so in this way you can uh
check individual uh stepwise in outputs
and also uh add human feedback uh into
the system and then see uh how the
output changes so let's say some
sometimes the some of these steps uh uh
maybe missed then you can add a human
feedback and then
uh write into get into the right
direction so that's how you can use uh
stepwise controllable agents um do
experiment with it and uh explore the
notebook see you in the next video
5.0 / 5 (0 votes)