Skip to content

Commit ab09f1f

Browse files
committed
Support HuggingFace Inference API.
1 parent 8552357 commit ab09f1f

File tree

42 files changed

+361
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+361
-89
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<LangVersion>10.0</LangVersion>
44
<OutputPath>..\..\..\packages</OutputPath>
5-
<PackageVersion>0.12.1</PackageVersion>
5+
<PackageVersion>0.12.3</PackageVersion>
66
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
77
</PropertyGroup>
88
</Project>

docs/architecture/assets/overview.drawio

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<mxfile host="Electron" modified="2023-09-11T03:31:43.410Z" 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="lRrajK2n_0sEKLZhDFCg" version="21.6.8" type="device">
1+
<mxfile host="Electron" modified="2023-09-17T13:34:27.318Z" 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="rOwRDk0nfgbjTZKasu5c" version="21.6.8" type="device">
22
<diagram id="6jfvZ688tm8pOZHgqSFM" name="Page-1">
3-
<mxGraphModel dx="1418" dy="820" 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">
3+
<mxGraphModel dx="1418" dy="820" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
44
<root>
55
<mxCell id="0" />
66
<mxCell id="1" parent="0" />
7-
<mxCell id="kNc4F-3AqUrd7lAFkTx2-3" value="BotSharp&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Agent&lt;br&gt;Conversation&lt;br&gt;Routing&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffcc99;strokeColor=#36393d;fontStyle=1;sketch=1;curveFitting=1;jiggle=2;" parent="1" vertex="1">
8-
<mxGeometry x="345.71" y="340" width="214.29" height="60" as="geometry" />
7+
<mxCell id="kNc4F-3AqUrd7lAFkTx2-3" value="BotSharp&lt;br&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Agent&lt;br&gt;Conversation&lt;br&gt;Routing&lt;br&gt;Reasoning&lt;br&gt;&lt;/span&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffcc99;strokeColor=#36393d;fontStyle=1;sketch=1;curveFitting=1;jiggle=2;" parent="1" vertex="1">
8+
<mxGeometry x="345.71" y="330.5" width="214.29" height="79" as="geometry" />
99
</mxCell>
1010
<mxCell id="9DShFkwYbzccSmdIPQ0x-7" value="&lt;b&gt;Phone&amp;nbsp;Voice&lt;/b&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#36393d;sketch=1;curveFitting=1;jiggle=2;" parent="1" vertex="1">
1111
<mxGeometry x="240" y="240" width="90" height="40" as="geometry" />

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
# built documents.
6565
#
6666
# The short X.Y version.
67-
version = '0.9'
67+
version = '0.12'
6868
# The full version, including alpha/beta/rc tags.
69-
release = '0.9.0'
69+
release = '0.12.0'
7070

7171
# The language for content autogenerated by Sphinx. Refer to documentation
7272
# for a list of supported languages.
@@ -170,7 +170,7 @@
170170
# dir menu entry, description, category)
171171
texinfo_documents = [
172172
(master_doc, 'BotSharp', 'BotSharp Documentation',
173-
author, 'BotSharp', 'The LLM powered Chatbot framework.',
173+
author, 'BotSharp', 'The LLM application framework.',
174174
'Miscellaneous'),
175175
]
176176

docs/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
The Open Source AI Bot Platform Builder
6+
The Open Source LLM Application Framework
77
======================================================
88

99
.. image:: https://img.shields.io/discord/1106946823282761851?label=Discord
1010
:target: `discord`_
1111

12-
**Build the AI chatbot platform from scratch with .NET**
12+
**Build the AI bot from scratch with .NET**
1313

14-
> The LLM powered Conversational Service framework
14+
> The LLM powered Conversational Service building blocks and best practice
1515

1616
*"Conversation as a platform (CaaP) is the future, so it's perfect that we're already offering the whole toolkits to .NET developers using BotSharp the Bot Platform Builder to build a CaaP. It opens up as much learning power as possible for your robots and precisely control every step of the AI processing pipeline."*
1717

18-
**BotSharp** is an open source bot framework for AI Bot platform builders. This project involves natural language understanding, computer vision and audio processing technologies, and aims to promote the development and application of intelligent robot assistants in information systems. Out-of-the-box machine learning algorithms allow ordinary programmers to develop artificial intelligence applications faster and easier.
18+
**BotSharp** is an open source AI framework for your enterprise-grade LLM applications. This project involves natural language understanding, computer vision and audio processing technologies, and aims to promote the development and application of intelligent robot assistants in business oriented systems. Out-of-the-box machine learning algorithms allow ordinary programmers to develop artificial intelligence applications faster and easier.
1919

2020
It's witten in C# running on .NET which is a full cross-platform framework. C# is an enterprise-grade programming language which is widely used to code business logic in information management related system. More friendly to corporate developers. BotSharp adopts machine learning algrithm in C/C++ interfaces directly which skips the python interfaces. That will facilitate the feature of the typed language C#, and be easier when refactoring code in system scope.
2121

22-
BotSharp is strictly in accordance with the components principle and decouples every part that is needed in the platform builder. So you can choose different UI/UX, or pick up a different NLP Tagger, or select a more advanced algorithm to do NER tasks. They are all modularized based on unified interfaces.
22+
BotSharp is strictly in accordance with the components principle and decouples every part that is needed in the platform builder. So you can choose different UI/UX, or pick up a different Vector Storage, or select a more advanced algorithm to do NLU tasks. They are all modularized based on unified interfaces.
2323

2424
.. image:: static/logos/BotSharp.png
2525
:height: 64px
118 KB
Loading

docs/quick-start/overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Overview
22

3-
BotSharp is an open source machine learning framework for AI Bot platform builder. This project involves natural language understanding and audio processing technologies, and aims to promote the development and application of intelligent robot assistants in information systems. Out of the box machine learning algorithms allow ordinary programmers to develop artificial intelligence applications faster and easier.
3+
BotSharp is an open source application framework to speed up integrate LLMs into your current business system. This project involves natural language understanding and audio processing technologies, and aims to promote the development and application of intelligent robot assistants in information systems. Out of the box machine learning algorithms allow ordinary programmers to develop artificial intelligence applications faster and easier.
44

55
BotSharp is an high compatible and high scalable platform builder. It is in accordance with components princple strictly, decouples every part that needed in the platform builder. So you can choose different UI/UX, or pick up a different NLP Tagger, or select a more advanced algrithm to do NER task. They are all modulized based on unfied interfaces.
66

7-
![ ](../static/screenshots/BotSharp_arch.png "BotSharp Architecture Chart")
7+
![ ](./assets/overview.png "BotSharp Architecture Chart")
88
From the chart ahead we can see that based on botsharp you can launch your own chatbot platform with 3 components:
99

1010
- Storage module: Botsharp supports memory and redis DB 2 methods.
@@ -21,7 +21,7 @@ Even with this simple question, you can see conversational experience are hard t
2121

2222
Your code would have to handle all these different types of requests ro carry out the same logic: looking up some forecast information for a feature. For this reason, a traditional computer interface would tend to force users to input a well-known, standard request at the detriment of the user experience, because it's just easier.
2323

24-
However, BotSharp lets you easily achieve a conversational user experience by handling the natural language understanding (NLU) for you.When you use BotSharp, you can create agents that can understand the meaning of natural language and the nuances and trainslate that to structured meaning your software can understand.
24+
However, BotSharp lets you easily achieve a conversational user experience by handling the natural language understanding (NLU) for you. When you use BotSharp, you can create agents that can understand the meaning of natural language and the nuances and trainslate that to structured meaning your software can understand.
2525

2626
Features
2727
-------------
@@ -30,6 +30,6 @@ Features
3030
* Integrate with multiple LLMs like ChatGPT and LLaMA.
3131
* Using plug-in design, it is easy to expand functions.
3232
* Working with multiple Vector Stores for senmatic search.
33-
* Supporting different UI providers like [Chatbot UI](https://github.com/mckaywrigley/chatbot-ui) and [HuggingChat UI](https://github.com/huggingface/chat-ui).
33+
* Supporting different UI providers like [Chatbot UI](https://github.com/SciSharp/chatbot-ui) and [HuggingChat UI](https://github.com/huggingface/chat-ui).
3434
* Integrated with popular social platforms like Facebook Messenger, Slack and Telegram.
3535
* Providing REST APIs to work with your own UI.

src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationStateService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public interface IConversationStateService
88
ConversationState Load(string conversationId);
99
string GetState(string name, string defaultValue = "");
1010
ConversationState GetStates();
11-
IConversationStateService SetState(string name, string value);
11+
IConversationStateService SetState<T>(string name, T value);
1212
void CleanState();
1313
void Save();
1414
}

src/Infrastructure/BotSharp.Abstraction/Conversations/Models/IncomingMessageModel.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ public class IncomingMessageModel
88

99
public virtual string Channel { get; set; } = string.Empty;
1010

11+
/// <summary>
12+
/// Completion Provider
13+
/// </summary>
14+
[JsonPropertyName("provider")]
15+
public virtual string? Provider { get; set; } = null;
16+
1117
/// <summary>
1218
/// Model name
1319
/// </summary>
1420
[JsonPropertyName("model")]
15-
public virtual string? ModelName { get; set; } = null;
21+
public virtual string? Model { get; set; } = null;
1622

1723
/// <summary>
1824
/// The sampling temperature to use that controls the apparent creativity of generated completions.

src/Infrastructure/BotSharp.Abstraction/MLTasks/IChatCompletion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace BotSharp.Abstraction.MLTasks;
22

33
public interface IChatCompletion
44
{
5-
string ModelName { get; }
5+
string Provider { get; }
66
Task<bool> GetChatCompletionsAsync(Agent agent,
77
List<RoleDialogModel> conversations,
88
Func<RoleDialogModel, Task> onMessageReceived,

src/Infrastructure/BotSharp.Abstraction/Utilities/StringExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Linq;
21
using System.Text.RegularExpressions;
32

43
namespace BotSharp.Abstraction.Utilities;

0 commit comments

Comments
 (0)