Merge branch 'master' into re-format-the-code
This commit is contained in:
commit
7c93820ae5
|
|
@ -1 +1,70 @@
|
|||
<mxfile host="app.diagrams.net" modified="2023-08-15T02:10:02.985Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" version="20.6.0" etag="WycAnBgN-yxZpTCzoOFG" type="device"><diagram id="6jfvZ688tm8pOZHgqSFM" name="Page-1">zZVdb4MgFIZ/jZdNFLraXbau3W72kXTLromcCimCo3Ta/frBxFq1TdZkSZcYA+85HOB5EQOc5NW9JgV7VBREgEJaBfguQCgaIxS4J6T7WomnYS1kmlOf1Aor/gVebNJ2nMK2k2iUEoYXXTFVUkJqOhrRWpXdtLUS3VkLksFAWKVEDNV3Tg2r1SmKW/0BeMaamaPJbR3JSZPsd7JlhKrySMKLACdaKVO38ioB4eA1XOpxyzPRw8I0SPObAZundLwc4dnHm6axmC03rxUa+SqfROz8hhNGjF+w2TcUtNpJCq5QFOB5ybiBVUFSFy2t71ZjJhc+7EuCNlCdXWt0IGCPDqgcjN7bFD8AjT20fa9fth5EDVh2xH/iNeJtzw6lWzK24eFcAAoNQL0wJeHqpMb/jhQekHp2nMK5JlxenRfu8cLxtXnFpz5BRypUa/uaZXZn2wE3S8B04WyNVhtIlFDaKtIdTjxfcyF6EhE8k7ab2rpg9bnjye2NN/OBnFPqpjnpRutX+DeGRLhnyPRmYMjkhB/4cj9st71uf2JHPy28+AY=</diagram></mxfile>
|
||||
<mxfile host="Electron" modified="2023-09-04T01:23:28.461Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.8 Chrome/114.0.5735.289 Electron/25.5.0 Safari/537.36" etag="A6frJLpTHNKz4FBL38kf" version="21.6.8" type="device">
|
||||
<diagram id="6jfvZ688tm8pOZHgqSFM" name="Page-1">
|
||||
<mxGraphModel dx="1434" dy="836" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="kNc4F-3AqUrd7lAFkTx2-3" value="BotSharp<br><span style="font-weight: normal;">Agent<br>Conversation<br>Routing</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffcc99;strokeColor=#36393d;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="345.71" y="340" width="214.29" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-7" value="<b>Phone&nbsp;Voice</b>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="240" y="240" width="90" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-8" value="<b>Web Chat</b>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="360" y="240" width="90" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-9" value="<b>Message</b>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="474" y="240" width="90" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-10" value="<b>Open API</b>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="590" y="240" width="90" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-11" value="<h1>BotSharp AI Orchestration</h1><p><br></p>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="50" y="50" width="310" height="120" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-12" value="<b>Knowlege Base</b>" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;fillColor=#eeeeee;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="270" y="670" width="60" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-13" value="<b>Knowledge</b><br>RAG" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#cce5ff;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="240" y="565" width="120" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-14" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;labelPosition=left;verticalLabelPosition=middle;align=right;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="150" y="260" width="20" height="450" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-15" value="<b><br><br>Agent</b>" style="shape=actor;whiteSpace=wrap;html=1;fillColor=#ffff88;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="345.71" y="450" width="42.86" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-16" value="<b><br><br>Agent</b>" style="shape=actor;whiteSpace=wrap;html=1;fillColor=#ffff88;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="431.43" y="450" width="42.86" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-17" value="<b><br><br>Agent</b>" style="shape=actor;whiteSpace=wrap;html=1;fillColor=#ffff88;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="517.14" y="450" width="42.86" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-18" value="<b>Meta Messenger</b>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#cce5ff;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="381.43" y="565" width="120" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-19" value="<b>Data Storage</b>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#cce5ff;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="520" y="565" width="120" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-20" value="<b>Storage</b>" style="shape=datastore;whiteSpace=wrap;html=1;fillColor=#eeeeee;strokeColor=#36393d;" vertex="1" parent="1">
|
||||
<mxGeometry x="550" y="680" width="60" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-22" value="<b>UI/ UX</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="60" y="250" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-25" value="<b>Kernel</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="60" y="355" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-26" value="<b>Agent</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="60" y="460" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-27" value="<b>Plugin</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="60" y="565" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9DShFkwYbzccSmdIPQ0x-28" value="<b>Data Storage</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="60" y="680" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
|
|
|
|||
3
docs/architecture/routing.md
Normal file
3
docs/architecture/routing.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Routing
|
||||
|
||||
Routing is an important function that allows multiple Agents to work together to complete enterprise-level tasks. When you apply LLM to your business system, it is inevitable to develop agents with different functions. How to effectively manage so many agents with different responsibilities is a challenging task. From an engineering perspective, each Different teams are responsible for the development of different Agents, and the teams will face the problem of mutual isolation between Agents. The ideal situation is that they can be developed independently but cooperate with each other.
|
||||
|
|
@ -36,7 +36,7 @@ The main documentation for the site is organized into the following sections:
|
|||
.. _get-started:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:maxdepth: 2
|
||||
:caption: Get Started with BotSharp
|
||||
|
||||
quick-start/overview
|
||||
|
|
@ -45,7 +45,7 @@ The main documentation for the site is organized into the following sections:
|
|||
.. _agent-docs:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:maxdepth: 2
|
||||
:caption: Agent & Conversation
|
||||
|
||||
agent/intro
|
||||
|
|
@ -55,7 +55,7 @@ The main documentation for the site is organized into the following sections:
|
|||
.. _integration-docs:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:maxdepth: 2
|
||||
:caption: Interactive Channels
|
||||
|
||||
channels/intro
|
||||
|
|
@ -65,7 +65,7 @@ The main documentation for the site is organized into the following sections:
|
|||
.. _knowledge-base:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:maxdepth: 2
|
||||
:caption: Knowledge Base
|
||||
|
||||
knowledge-base/text-embedding
|
||||
|
|
@ -76,7 +76,7 @@ The main documentation for the site is organized into the following sections:
|
|||
.. _llm:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:maxdepth: 2
|
||||
:caption: Prompt Engineering
|
||||
|
||||
prompt/prompt
|
||||
|
|
@ -87,12 +87,13 @@ The main documentation for the site is organized into the following sections:
|
|||
.. _architecture-docs:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:maxdepth: 2
|
||||
:caption: Architecture:
|
||||
|
||||
architecture/authentication
|
||||
architecture/plugin
|
||||
architecture/hooks
|
||||
architecture/routing
|
||||
architecture/data-persistence
|
||||
|
||||
If you feel that this project is helpful to you, please Star us on the project, we will be very grateful.
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@ public interface IConversationService
|
|||
|
||||
List<RoleDialogModel> GetDialogHistory(string conversationId, int lastCount = 20);
|
||||
Task CleanHistory(string agentId);
|
||||
|
||||
Task CallFunctions(RoleDialogModel msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ public partial class AgentService
|
|||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
var query = from a in db.Agent
|
||||
join ua in db.UserAgent on a.Id equals ua.AgentId
|
||||
where ua.UserId == _user.Id
|
||||
join u in db.User on ua.UserId equals u.Id
|
||||
where ua.UserId == _user.Id || u.ExternalId == _user.Id || a.IsPublic
|
||||
select a.ToAgent();
|
||||
return query.ToList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<VersionPrefix>0.10.1</VersionPrefix>
|
||||
<VersionPrefix>0.10.4</VersionPrefix>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="Globals">
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace BotSharp.Core.Conversations.Services;
|
|||
|
||||
public partial class ConversationService
|
||||
{
|
||||
private async Task CallFunctions(RoleDialogModel msg)
|
||||
public async Task CallFunctions(RoleDialogModel msg)
|
||||
{
|
||||
var hooks = _services.GetServices<IConversationHook>()
|
||||
.OrderBy(x => x.Priority).ToList();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ public class AgentRecord : DbRecord, IBotSharpTable
|
|||
[MaxLength(512)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public bool IsPublic { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime CreatedDateTime { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -115,8 +115,20 @@ public class Simulator
|
|||
|
||||
RoleDialogModel response = null;
|
||||
await chatCompletion.GetChatCompletionsAsync(agent, wholeDialogs, async msg
|
||||
=> response = msg, fn
|
||||
=> Task.CompletedTask);
|
||||
=> response = msg, async fn
|
||||
=>
|
||||
{
|
||||
// execute function
|
||||
// Save states
|
||||
SaveStateByArgs(JsonSerializer.Deserialize<JsonDocument>(fn.FunctionArgs));
|
||||
|
||||
var conversationService = _services.GetRequiredService<IConversationService>();
|
||||
// Call functions
|
||||
await conversationService.CallFunctions(fn);
|
||||
|
||||
response = fn;
|
||||
response.Content = fn.ExecutionResult;
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
var choice = response.Value.Choices[0];
|
||||
var message = choice.Message;
|
||||
|
||||
_logger.LogInformation($"Token Usage: {response.Value.Usage.PromptTokens} prompt + {response.Value.Usage.CompletionTokens} completion = {response.Value.Usage.TotalTokens} total");
|
||||
|
||||
if (choice.FinishReason == CompletionsFinishReason.FunctionCall)
|
||||
{
|
||||
_logger.LogInformation($"[{agent.Name}]: {message.FunctionCall.Name} => {message.FunctionCall.Arguments}");
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>10</LangVersion>
|
||||
<VersionPrefix>0.10.1</VersionPrefix>
|
||||
<VersionPrefix>0.10.2</VersionPrefix>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue