Init Core.Rule module
This commit is contained in:
parent
b52cb96c40
commit
4012305e58
|
|
@ -51,4 +51,9 @@ public class BuiltInAgentId
|
|||
/// Evaluate prompt and conversation
|
||||
/// </summary>
|
||||
public const string Evaluator = "dfd9b46d-d00c-40af-8a75-3fbdc2b89869";
|
||||
|
||||
/// <summary>
|
||||
/// Translates user-defined natural language rules into programmatic code
|
||||
/// </summary>
|
||||
public const string RuleEncoder = "6acfb93c-3412-402e-9ba5-c5d3cd8f0161";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Infrastructure\BotSharp.Abstraction\BotSharp.Abstraction.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
19
src/Infrastructure/BotSharp.Core.Rules/RulesPlugin.cs
Normal file
19
src/Infrastructure/BotSharp.Core.Rules/RulesPlugin.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
namespace BotSharp.Core.Rules;
|
||||
|
||||
public class RulesPlugin : IBotSharpPlugin
|
||||
{
|
||||
public string Id => "0197c1bc-9ae6-4c56-a305-8a1b4095bebc";
|
||||
public string Name => "BotSharp Rules";
|
||||
public string Description => "Translates user-defined natural language rules into programmatic code and is responsible for executing these rules under user-specified conditions.";
|
||||
public string IconUrl => "https://w7.pngwing.com/pngs/442/614/png-transparent-regulation-computer-icons-regulatory-compliance-medical-device-manufacturing-others-miscellaneous-blue-text-thumbnail.png";
|
||||
|
||||
public string[] AgentIds =
|
||||
[
|
||||
BuiltInAgentId.RuleEncoder
|
||||
];
|
||||
|
||||
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
4
src/Infrastructure/BotSharp.Core.Rules/Using.cs
Normal file
4
src/Infrastructure/BotSharp.Core.Rules/Using.cs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
global using BotSharp.Abstraction.Agents.Enums;
|
||||
global using BotSharp.Abstraction.Plugins;
|
||||
global using Microsoft.Extensions.Configuration;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -8,8 +8,10 @@ namespace BotSharp.Core.SideCar;
|
|||
public class BotSharpSideCarPlugin : IBotSharpPlugin
|
||||
{
|
||||
public string Id => "06e5a276-bba0-45af-9625-889267c341c9";
|
||||
public string Name => "Side Car";
|
||||
public string Description => "Provides side car for calling agent cluster in conversation";
|
||||
public string Name => "BotSharp SideCar";
|
||||
public string Description => "Provide side car pattern to to better handle Agent Cluster calls in the same conversation. Agent cluster is composed of multiple Routing Agents.";
|
||||
public string? IconUrl => "https://icons.veryicon.com/png/128/internet--web/2022-alibaba-cloud-product-icon-cloud/aliyuncvc-cloud-video-conference.png";
|
||||
|
||||
|
||||
public SettingsMeta Settings => new SettingsMeta("SideCar");
|
||||
public object GetNewSettingsInstance() => new SideCarSettings();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Anthropic.SDK" Version="4.1.1" />
|
||||
<PackageReference Include="Anthropic.SDK" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Jint" Version="4.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Infrastructure\BotSharp.Abstraction\BotSharp.Abstraction.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
using BotSharp.Abstraction.Plugins;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BotSharp.Plugin.JavaScriptInterpreter;
|
||||
|
||||
public class JsInterpreterPlugin : IBotSharpAppPlugin
|
||||
{
|
||||
public string Id => "7a5a8cd7-26d9-4ac3-9d79-d02084bea372";
|
||||
public string Name => "JavaScript Interpreter";
|
||||
public string Description => "";
|
||||
public string? IconUrl => "";
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LLamaSharp" Version="0.12.0" />
|
||||
<PackageReference Include="LLamaSharp" Version="0.18.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ public class LlamaAiModel
|
|||
_params = new ModelParams(Path.Combine(_settings.ModelDir, model))
|
||||
{
|
||||
ContextSize = (uint)_settings.MaxContextLength,
|
||||
Seed = 1337,
|
||||
GpuLayerCount = _settings.NumberOfGpuLayer
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace BotSharp.Plugin.LLamaSharp.Providers;
|
||||
|
||||
|
|
@ -19,7 +21,7 @@ public class TextEmbeddingProvider : ITextEmbedding
|
|||
_settings = settings;
|
||||
}
|
||||
|
||||
public Task<float[]> GetVectorAsync(string text)
|
||||
public async Task<float[]> GetVectorAsync(string text)
|
||||
{
|
||||
if (_embedder == null)
|
||||
{
|
||||
|
|
@ -29,10 +31,10 @@ public class TextEmbeddingProvider : ITextEmbedding
|
|||
_embedder = new LLamaEmbedder(weights, @params);
|
||||
}
|
||||
|
||||
return _embedder.GetEmbeddings(text);
|
||||
return (await _embedder.GetEmbeddings(text)).First();
|
||||
}
|
||||
|
||||
public Task<List<float[]>> GetVectorsAsync(List<string> texts)
|
||||
public async Task<List<float[]>> GetVectorsAsync(List<string> texts)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="pythonnet" Version="3.0.3" />
|
||||
<PackageReference Include="pythonnet" Version="3.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue