Skip to content

Commit f2dc57c

Browse files
authored
Merge branch 'SciSharp:master' into master
2 parents 9803eb4 + e1e835a commit f2dc57c

18 files changed

+10
-10
lines changed

docs/architecture/agent-utility/intro.md renamed to docs/architecture/agent-utility.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document aims to introduce the agent utility concept and provide an instruc
77
The agent utility is a unique feature that can be integrated into agent to enhance its capability. Its core principle is that it can dynamically and seamlessly add extra prompts and add task-oriented functions (or tools) during conversation, without disrupting the agent’s primary purpose. In other words, the agent utility can perform extra tasks based on the context of conversation. Typical examples of agent utility include reading images/pdf, generating image, and sending http requests. [Fig 2.1.1](#agent-utility-example) demonstrates an example of these utilities. In this example, “Chatbot” is a simple agent to answer user questions and the utilities extend its capability to explain image content, generate requested image, and send a specific http request.
88

99
<div id="agent-utility-example">
10-
<img src="assets/agent-utility-example.png" style="display: block; margin: auto;" />
10+
<img src="assets/agent-utility/agent-utility-example.png" style="display: block; margin: auto;" />
1111
</div>
1212
<br />
1313

@@ -18,7 +18,7 @@ In this section, we outline the steps to set up a custom agent utility. We start
1818
The basic code structure of a typical agent utility includes prompt/function data, hooks, and function implementation. We can add specific utility prompts and functions in different projects. Note that the agent “6745151e-6d46-4a02-8de4-1c4f21c7da95” is considered as a dedicated utility assistant, and every prompt and function can be optionally used as a utility. [Fig 3.1.1](#agent-utility-code-structure) presents the structure of prompt, function, hooks, and implementation of an http utility.
1919

2020
<div id="agent-utility-code-structure">
21-
<img src="assets/agent-utility-code-structure.png" style="display: block; margin: auto;" />
21+
<img src="assets/agent-utility/agent-utility-code-structure.png" style="display: block; margin: auto;" />
2222
</div>
2323
<br />
2424

@@ -322,7 +322,7 @@ public class HandleHttpRequestFn : IFunctionCallback
322322
Here we introduce a new feature: utility inheritance. As we are using the routing-based multi-agent architecture, different agents may come into the call stack while we are handling user requests. With the utility inheritance, the agent can not only use the utilities added to itself but also inherit the utilities from the entry agent, which is the first agent that comes into the call stack, such as a router agent. [Fig 3.5.1](#routing-architecture) illustrates a typical example of routing-based multi-agent architecture, where “Pizza Bot” is the router and "Order Inquery", "Ordering", "Payment" are task agents. When the user starts chatting, “Pizza Bot” first comes into the call stack, with "Order Inquery", "Ordering", or "Payment" joining next depending on what the user actually requests. For example, if we allow "Order Inquery" to inherit utilities, all the utilities from itself as well as “Pizza Bot” will be invoked once the "Order Inquery" agent is in action.
323323

324324
<div id="routing-architecture">
325-
<img src="assets/routing-arch.png" style="display: block; margin: auto;" />
325+
<img src="assets/agent-utility/routing-arch.png" style="display: block; margin: auto;" />
326326
</div>
327327
<br />
328328

@@ -365,7 +365,7 @@ Here we introduce the agent setup with utilities and inheritance. As we introduc
365365

366366

367367
<div id="router-utility-ui">
368-
<img src="assets/router-utility-ui.png" style="display: block; margin: auto;" />
368+
<img src="assets/agent-utility/router-utility-ui.png" style="display: block; margin: auto;" />
369369
</div>
370370
<br />
371371
<br />
@@ -387,7 +387,7 @@ Here we introduce the agent setup with utilities and inheritance. As we introduc
387387
<br />
388388

389389
<div id="task-agent-utility-ui">
390-
<img src="assets/task-agent-utility-ui.png" style="display: block; margin: auto;" />
390+
<img src="assets/agent-utility/task-agent-utility-ui.png" style="display: block; margin: auto;" />
391391
</div>
392392
<br />
393393

@@ -422,7 +422,7 @@ public class HttpHandlerPlugin : IBotSharpPlugin
422422
[Fig 4.1.2](#register-assembly) demonstrates the utility assembly registration in “appsettings.json”. It is important to note that we are required to add the project reference to the Startup project, e.g., WebStarter. Moreover, we are required to add any new custom agent utility in the “Plugin” folder instead of the “BotSharp” folder.
423423

424424
<div style="text-align: center;" id="register-assembly">
425-
<img src="assets/register-assembly.png" />
425+
<img src="assets/agent-utility/register-assembly.png" />
426426
</div>
427427
<br />
428428

@@ -431,21 +431,21 @@ public class HttpHandlerPlugin : IBotSharpPlugin
431431
In this section, we demonstrate an http utility. After we set up and integrate the custom agent utility in backend, we can start the BotSharp-UI and go to any specific agent. [Fig 5.1.1](#add-utility) shows an example of the “Chatbot” agent, where we can add any registered utilities in the highlight section.
432432

433433
<div style="text-align: center;" id="add-utility">
434-
<img src="assets/add-utility.png" />
434+
<img src="assets/agent-utility/add-utility.png" />
435435
</div>
436436
<br />
437437

438438
Once we add the utility, we can initialize a conversation by clicking the bot icon at the top left corner. [Fig 5.1.2](#chat-window-demo) shows the conversation window, where we can find the number of utilities at the left panel. We can also click the agent name to go back to the agent page.
439439

440440
<div style="text-align: center;" id="chat-window-demo">
441-
<img src="assets/chat-window-demo.png" />
441+
<img src="assets/agent-utility/chat-window-demo.png" />
442442
</div>
443443
<br />
444444

445445
Here we use dummy rest APIs (source: https://dummy.restapiexample.com/) for the demo purpose. [Fig 5.1.3](#dummy-http) displays the various http requests sent in the conversation with “Chatbot”. We can see that the “Http Handler” utility has successfully extends the agent to send http request and receive response.
446446

447447
<div style="text-align: center;" id="dummy-http">
448-
<img src="assets/dummy-http.png" />
448+
<img src="assets/agent-utility/dummy-http.png" />
449449
</div>
450450
<br />
451451

-61.3 KB
Binary file not shown.
-56 KB
Binary file not shown.
-47.8 KB
Binary file not shown.
-77 KB
Binary file not shown.
-26.5 KB
Binary file not shown.
-13.4 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)