Move PizzaBot project to another solution.
This commit is contained in:
parent
ab09f1fcae
commit
ba99aabd3e
46
PizzaBot.sln
Normal file
46
PizzaBot.sln
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33712.159
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebStarter", "src\WebStarter\WebStarter.csproj", "{07AD18C5-CE7B-495A-815F-170E93CCC42A}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{32FAFFFE-A4CB-4FEE-BF7C-84518BBC6DCC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.PizzaBot", "tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj", "{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{07AD18C5-CE7B-495A-815F-170E93CCC42A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{A1118A2C-C6D7-4E22-9462-964AEC7CC46E} = {32FAFFFE-A4CB-4FEE-BF7C-84518BBC6DCC}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A9969D89-C98B-40A5-A12B-FC87E55B3A19}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -40,6 +40,7 @@ The main documentation for the site is organized into the following sections:
|
|||
:caption: Get Started with BotSharp
|
||||
|
||||
quick-start/overview
|
||||
quick-start/get-started
|
||||
quick-start/installation
|
||||
|
||||
.. _agent-docs:
|
||||
|
|
|
|||
BIN
docs/quick-start/assets/PizzaBotSample1.png
Normal file
BIN
docs/quick-start/assets/PizzaBotSample1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
docs/quick-start/assets/PizzaBotSample2.png
Normal file
BIN
docs/quick-start/assets/PizzaBotSample2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
BIN
docs/quick-start/assets/PizzaBotSample3.png
Normal file
BIN
docs/quick-start/assets/PizzaBotSample3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
docs/quick-start/assets/PizzaBotSample4.png
Normal file
BIN
docs/quick-start/assets/PizzaBotSample4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
21
docs/quick-start/get-started.md
Normal file
21
docs/quick-start/get-started.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Get Started
|
||||
|
||||
### Get started with Pizza Bot
|
||||
|
||||
In order to allow developers to experience the convenience of BotSharp as quickly as possible, we have designed a basic sample project PizzaBot. This example allows you to run it quickly on your local machine. This example requires `llama-2` quantized model downloaded with `gguf` format if you want to run locally.
|
||||
|
||||
```console
|
||||
git clone https://github.com/SciSharp/BotSharp
|
||||
```
|
||||
|
||||
Double click `PizzaBot` to start the solution.
|
||||

|
||||
|
||||
Hit `WebStarter` to run it in Debug mode.
|
||||

|
||||
|
||||
Here you go, you will see this running screen.
|
||||

|
||||
|
||||
Next, try to access the chat from `Open API`, we public our [Postman collection](https://www.postman.com/orange-flare-634868/workspace/botsharp/collection/1346299-d1a31c49-825d-4449-bdc8-936c66ff6bfd). Remember to set the environment as `localhost`.
|
||||

|
||||
|
|
@ -119,8 +119,6 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"[{agent.Name}] {message.Role}: {message.Content}");
|
||||
|
||||
var msg = new RoleDialogModel(AgentRole.Assistant, message.Content)
|
||||
{
|
||||
CurrentAgentId= agent.Id
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using Microsoft.Extensions.Logging;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BotSharp.Plugin.LLamaSharp.Providers;
|
||||
|
|
@ -51,9 +52,9 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
|
||||
var inferenceParams = new InferenceParams()
|
||||
{
|
||||
Temperature = 0.9f,
|
||||
AntiPrompts = new List<string> { $"{AgentRole.User}:" },
|
||||
MaxTokens = 256
|
||||
Temperature = 0.1f,
|
||||
AntiPrompts = new List<string> { $"{AgentRole.User}:", "[/INST]" },
|
||||
MaxTokens = 64
|
||||
};
|
||||
|
||||
string totalResponse = "";
|
||||
|
|
@ -77,8 +78,6 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
totalResponse = totalResponse.Replace(anti, "").Trim();
|
||||
}
|
||||
|
||||
_logger.LogInformation($"[{agent.Name}] {AgentRole.Assistant}: {totalResponse}");
|
||||
|
||||
var msg = new RoleDialogModel(AgentRole.Assistant, totalResponse)
|
||||
{
|
||||
CurrentAgentId = agent.Id
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using BotSharp.Abstraction.Users;
|
||||
using BotSharp.Core;
|
||||
using BotSharp.Core.Users.Services;
|
||||
using EntityFrameworkCore.BootKit;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.Text;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
|
@ -26,15 +26,30 @@
|
|||
<None Remove="crawl-300d-2M-subword.bin" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(SolutionName)==PizzaBot">
|
||||
<PackageReference Include="BotSharp.OpenAPI" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.AzureOpenAI" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.ChatbotUI" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.HuggingFace" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.KnowledgeBase" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.LLamaSharp" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.MetaAI" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.MetaMessenger" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.MongoStorage" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.PaddleSharp" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.Qdrant" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.RoutingSpeeder" Version="$(PackageVersion)" />
|
||||
<PackageReference Include="BotSharp.Plugin.WeChat" Version="$(PackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LLamaSharp.Backend.Cuda11" Version="0.5.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.16" />
|
||||
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.11.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj" />
|
||||
|
||||
<ItemGroup Condition="$(SolutionName)==BotSharp">
|
||||
<ProjectReference Include="..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\Infrastructure\BotSharp.OpenAPI\BotSharp.OpenAPI.csproj" />
|
||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.AzureOpenAI\BotSharp.Plugin.AzureOpenAI.csproj" />
|
||||
|
|
@ -49,5 +64,9 @@
|
|||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.RoutingSpeeder\BotSharp.Plugin.RoutingSpeeder.csproj" />
|
||||
<ProjectReference Include="..\Plugins\BotSharp.Plugin.WeChat\BotSharp.Plugin.WeChat.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@
|
|||
|
||||
"PluginLoader": {
|
||||
"Assemblies": [
|
||||
"BotSharp.Plugin.MongoStorage",
|
||||
"BotSharp.Core",
|
||||
"BotSharp.Plugin.MongoStorage",
|
||||
"BotSharp.Plugin.AzureOpenAI",
|
||||
"BotSharp.Plugin.MetaAI",
|
||||
"BotSharp.Plugin.HuggingFace",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "Ordering",
|
||||
"description": "Make pizza order according to user's preference.",
|
||||
"createdDateTime": "2023-07-26T02:29:25.123224Z",
|
||||
"updatedDateTime": "2023-07-26T02:29:25.123274Z",
|
||||
"id": "c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd"
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
[
|
||||
{
|
||||
"name": "get_pizza_price",
|
||||
"description": "call this function to get the pizza price",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pizza_type": {
|
||||
"type": "string",
|
||||
"description": "The pizza type."
|
||||
},
|
||||
"quantity": {
|
||||
"type": "string",
|
||||
"description": "quantity of pizza."
|
||||
}
|
||||
},
|
||||
"required": ["pizza_type", "quantity"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "get_pizza_types",
|
||||
"description": "get all pizza types.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "place_an_order",
|
||||
"description": "Place an order when user has confirmed the pizza type and quantity.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pizza_type": {
|
||||
"type": "string",
|
||||
"description": "The pizza type."
|
||||
},
|
||||
"quantity": {
|
||||
"type": "number",
|
||||
"description": "quantity of pizza."
|
||||
},
|
||||
"unit_price": {
|
||||
"type": "number",
|
||||
"description": "unit price"
|
||||
}
|
||||
},
|
||||
"required": ["pizza_type", "quantity", "unit_price"]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
You are now a Pizza Ordering agent, and you can help customers order a pizza according to the user's preferences.
|
||||
|
||||
Follow below step to place order:
|
||||
1: Ask user preferences.
|
||||
2: Confirm with user the pizza type and quantity.
|
||||
3: Call function place_an_order to purchase.
|
||||
|
||||
Use below information to help ordering process:
|
||||
* Today is {{current_date}}, the time now is {{current_time}}, day of week is {{current_weekday}}.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{% if pizza_type == "cheese" -%}
|
||||
The price for a slice of cheese pizza is {{ cheese_unit_price }}. Would you like to proceed the order?
|
||||
{%- endif %}
|
||||
{% if quantity == nil -%}
|
||||
How many slices would you like to order?
|
||||
{%- endif %}
|
||||
|
|
@ -6,13 +6,6 @@
|
|||
"createdTime": "2023-08-14T18:14:11.6829767Z",
|
||||
"id": "1273379c-4419-460a-b0a2-5695afd097f5"
|
||||
},
|
||||
{
|
||||
"userId": "456e35c5-caf0-4d45-9084-b44a8ca717e4",
|
||||
"agentId": "ff431273-0c28-4647-88bf-86d82443c579",
|
||||
"updatedTime": "2023-08-14T18:14:11.6833783Z",
|
||||
"createdTime": "2023-08-14T18:14:11.6829767Z",
|
||||
"id": "5ed47062-3dba-4b96-a7d7-5dbab48b71ad"
|
||||
},
|
||||
{
|
||||
"userId": "456e35c5-caf0-4d45-9084-b44a8ca717e4",
|
||||
"agentId": "c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
<PackageReference Include="BotSharp.Core" Version="0.12.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in a new issue