This commit is contained in:
Haiping Chen 2023-06-03 12:01:38 -05:00
parent 2f25a55f80
commit 8a25fe6c86
6 changed files with 11 additions and 9 deletions

View file

@ -7,7 +7,7 @@ namespace BotSharp.Core;
public static class AzureAiServiceCollectionExtensions
{
public static IServiceCollection AddAzureOpenAi(this IServiceCollection services, IConfiguration config)
public static IServiceCollection AddAzureOpenAiPlatform(this IServiceCollection services, IConfiguration config)
{
services.AddSingleton(x =>
{

View file

@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="LLamaSharp" Version="0.3.0" />
<PackageReference Include="LLamaSharp.Backend.Cpu" Version="0.3.0" />
<PackageReference Include="LLamaSharp.Backend.Cuda11" Version="0.3.0" />
</ItemGroup>
<ItemGroup>

View file

@ -8,7 +8,7 @@ namespace BotSharp.Core;
public static class BotSharplServiceCollectionExtensions
{
public static IServiceCollection AddBotSharpCommunityPlatform(this IServiceCollection services, IConfiguration config)
public static IServiceCollection AddBotSharpPlatform(this IServiceCollection services, IConfiguration config)
{
services.AddSingleton(x =>
{

View file

@ -36,9 +36,10 @@ public class ChatCompletionHandler : IChatCompletionHandler
Func<string, Task> onChunkReceived)
{
string totalResponse = "";
// var prompt = GetInstruction();
// var content = string.Join("\n", conversations.Select(x => $"\n{x.Content}"));
foreach (var response in _model.Chat(conversations.Last().Content, "", "UTF-8"))
var prompt = GetInstruction();
var content = string.Join(". ", conversations.Select(x => $"{x.Role}: {x.Content.Replace("user:", "")}")).Trim();
content += ". assistant: ";
foreach (var response in _model.Chat(content, prompt, "UTF-8"))
{
Console.Write(response);
totalResponse += response;

View file

@ -12,8 +12,8 @@ builder.Services.AddHttpContextAccessor();
// Add BotSharp
builder.Services.AddBotSharp(builder.Configuration);
builder.Services.AddBotSharpCommunityPlatform(builder.Configuration);
// builder.Services.AddAzureOpenAi(builder.Configuration);
builder.Services.AddBotSharpPlatform(builder.Configuration);
// builder.Services.AddAzureOpenAiPlatform(builder.Configuration);
builder.Services.AddCors(options =>
{

View file

@ -17,7 +17,8 @@
"ModelPath": "C:\\Users\\haipi\\Downloads\\ggml-vic13b-q5_1.bin",
"InstructionFile": "Prompts\\chat-with-bob.txt",
"ChatSampleFile": "Prompts\\chat-samples.txt",
"MaxContextLength": 512
"MaxContextLength": 2048,
"NumberOfGpuLayer": 10
},
"AzureAi": {