BotSharp/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs

67 lines
3.2 KiB
C#
Raw Normal View History

2024-08-15 23:19:10 +00:00
using BotSharp.Abstraction.Graph.Models;
using BotSharp.Abstraction.VectorStorage.Models;
2023-06-17 02:42:35 +00:00
namespace BotSharp.Abstraction.Knowledges;
public interface IKnowledgeService
{
2024-08-29 19:30:47 +00:00
#region Vector
2024-09-24 20:34:47 +00:00
Task<bool> ExistVectorCollection(string collectionName);
2024-09-09 19:16:09 +00:00
Task<bool> CreateVectorCollection(string collectionName, string collectionType, int dimension, string provider, string model);
2024-08-29 19:30:47 +00:00
Task<bool> DeleteVectorCollection(string collectionName);
2024-12-30 03:49:38 +00:00
Task<IEnumerable<VectorCollectionConfig>> GetVectorCollections(string? type = null);
2024-08-15 23:19:10 +00:00
Task<IEnumerable<VectorSearchResult>> SearchVectorKnowledge(string query, string collectionName, VectorSearchOptions options);
2024-08-23 18:49:06 +00:00
Task<StringIdPagedItems<VectorSearchResult>> GetPagedVectorCollectionData(string collectionName, VectorFilter filter);
2024-08-15 23:19:10 +00:00
Task<bool> DeleteVectorCollectionData(string collectionName, string id);
2024-09-18 21:17:54 +00:00
Task<bool> DeleteVectorCollectionAllData(string collectionName);
2024-08-23 16:25:44 +00:00
Task<bool> CreateVectorCollectionData(string collectionName, VectorCreateModel create);
2024-08-23 03:13:40 +00:00
Task<bool> UpdateVectorCollectionData(string collectionName, VectorUpdateModel update);
2024-09-22 20:05:26 +00:00
Task<bool> UpsertVectorCollectionData(string collectionName, VectorUpdateModel update);
2024-08-29 19:30:47 +00:00
#endregion
#region Graph
2024-08-15 23:19:10 +00:00
Task<GraphSearchResult> SearchGraphKnowledge(string query, GraphSearchOptions options);
2024-09-09 15:00:46 +00:00
#endregion
#region Document
2024-09-20 18:42:08 +00:00
/// <summary>
/// Save documents and their contents to knowledgebase
/// </summary>
/// <param name="collectionName"></param>
/// <param name="files"></param>
/// <returns></returns>
2024-11-15 16:36:17 +00:00
Task<UploadKnowledgeResponse> UploadDocumentsToKnowledge(string collectionName, IEnumerable<ExternalFileModel> files, ChunkOption? option = null);
2024-09-20 18:42:08 +00:00
/// <summary>
/// Save document content to knowledgebase without saving the document
/// </summary>
/// <param name="collectionName"></param>
/// <param name="fileName"></param>
/// <param name="fileSource"></param>
/// <param name="contents"></param>
/// <param name="refData"></param>
/// <returns></returns>
2024-10-10 17:55:44 +00:00
Task<bool> ImportDocumentContentToKnowledge(string collectionName, string fileName, string fileSource, IEnumerable<string> contents,
DocMetaRefData? refData = null, Dictionary<string, object>? payload = null);
2024-09-20 18:42:08 +00:00
/// <summary>
/// Delete one document and its related knowledge in the collection
/// </summary>
/// <param name="collectionName"></param>
/// <param name="fileId"></param>
/// <returns></returns>
2024-09-17 17:50:39 +00:00
Task<bool> DeleteKnowledgeDocument(string collectionName, Guid fileId);
2024-09-20 18:42:08 +00:00
/// <summary>
/// Delete all documents and their related knowledge in the collection
/// </summary>
/// <param name="collectionName"></param>
/// <param name="filter"></param>
/// <returns></returns>
Task<bool> DeleteKnowledgeDocuments(string collectionName, KnowledgeFileFilter filter);
Task<PagedItems<KnowledgeFileModel>> GetPagedKnowledgeDocuments(string collectionName, KnowledgeFileFilter filter);
2024-09-18 15:35:28 +00:00
Task<FileBinaryDataModel> GetKnowledgeDocumentBinaryData(string collectionName, Guid fileId);
2024-08-29 19:30:47 +00:00
#endregion
2024-09-09 16:32:31 +00:00
#region Common
Task<bool> RefreshVectorKnowledgeConfigs(VectorCollectionConfigsModel configs);
#endregion
2023-06-17 02:42:35 +00:00
}