2018-09-28 22:25:55 +00:00
|
|
|
|
using BotSharp.Platform.Models;
|
2018-10-02 02:49:01 +00:00
|
|
|
|
using BotSharp.Platform.Models.AiRequest;
|
|
|
|
|
|
using BotSharp.Platform.Models.AiResponse;
|
2018-10-03 17:21:19 +00:00
|
|
|
|
using BotSharp.Platform.Models.MachineLearning;
|
2018-09-28 22:25:55 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Platform.Abstraction
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Platform abstraction
|
|
|
|
|
|
/// Implement this interface to build a Chatbot platform
|
|
|
|
|
|
/// </summary>
|
2018-10-01 17:15:17 +00:00
|
|
|
|
public interface IPlatformBuilder<TAgent>
|
2018-09-28 22:25:55 +00:00
|
|
|
|
{
|
2018-10-01 17:15:17 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Agent storage
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
IAgentStorage<TAgent> Storage { get; set; }
|
|
|
|
|
|
|
2018-09-28 22:25:55 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Parse options for the incoming text or voice request from the sender.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
// DialogRequestOptions RequestOptions { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-10-01 13:36:39 +00:00
|
|
|
|
/// Convert platform specific data to standard training corpus format
|
2018-09-28 22:25:55 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="agent"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2018-10-05 06:39:39 +00:00
|
|
|
|
Task<TrainingCorpus> ExtractorCorpus(TAgent agent);
|
2018-09-28 22:25:55 +00:00
|
|
|
|
|
2018-10-03 01:44:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Load agent from files.
|
|
|
|
|
|
/// There must contain a meta.json
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dataDir"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2018-10-05 06:39:39 +00:00
|
|
|
|
Task<TAgent> LoadAgentFromFile<TImporter>(string dataDir) where TImporter : IAgentImporter<TAgent>, new();
|
2018-10-03 01:44:11 +00:00
|
|
|
|
|
2018-09-28 22:25:55 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <typeparam name="TStorage"></typeparam>
|
|
|
|
|
|
/// <param name="agent"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2018-10-05 06:39:39 +00:00
|
|
|
|
Task<bool> SaveAgent(TAgent agent);
|
2018-10-01 13:36:39 +00:00
|
|
|
|
|
2018-10-04 21:18:46 +00:00
|
|
|
|
Task<ModelMetaData> Train(TAgent agent, TrainingCorpus corpus, BotTrainOptions options);
|
2018-10-02 02:49:01 +00:00
|
|
|
|
|
2018-10-05 06:39:39 +00:00
|
|
|
|
Task<AiResponse> TextRequest(AiRequest request);
|
2018-09-28 22:25:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|