-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #633 from iceljc/features/add-knowledge-docs
Features/add knowledge docs
- Loading branch information
Showing
64 changed files
with
1,460 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/Infrastructure/BotSharp.Abstraction/Files/Models/ExternalFileModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace BotSharp.Abstraction.Files.Models; | ||
|
||
public class ExternalFileModel : FileDataModel | ||
{ | ||
[JsonPropertyName("file_url")] | ||
public string FileUrl { get; set; } = string.Empty; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Infrastructure/BotSharp.Abstraction/Files/Models/FileBinaryDataModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace BotSharp.Abstraction.Files.Models; | ||
|
||
public class FileBinaryDataModel | ||
{ | ||
public string FileName { get; set; } | ||
public BinaryData FileBinaryData { get; set; } | ||
} |
2 changes: 1 addition & 1 deletion
2
...bstraction/Files/Models/InputFileModel.cs → ...Abstraction/Files/Models/FileDataModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Infrastructure/BotSharp.Abstraction/Files/Models/KnowledgeFileModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace BotSharp.Abstraction.Files.Models; | ||
|
||
public class KnowledgeFileModel | ||
{ | ||
public string FileId { get; set; } | ||
public string FileName { get; set; } | ||
public string FileExtension { get; set; } | ||
public string ContentType { get; set; } | ||
public string FileUrl { get; set; } | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Infrastructure/BotSharp.Abstraction/Knowledges/Enums/KnowledgeCollectionType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace BotSharp.Abstraction.Knowledges.Enums; | ||
|
||
public static class KnowledgeCollectionType | ||
{ | ||
public static string QuestionAnswer = "question-answer"; | ||
public static string Document = "document"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeDocMetaData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using BotSharp.Abstraction.VectorStorage.Models; | ||
|
||
namespace BotSharp.Abstraction.Knowledges.Models; | ||
|
||
public class KnowledgeDocMetaData | ||
{ | ||
[JsonPropertyName("collection")] | ||
public string Collection { get; set; } | ||
|
||
[JsonPropertyName("file_id")] | ||
public string FileId { get; set; } | ||
|
||
[JsonPropertyName("file_name")] | ||
public string FileName { get; set; } | ||
|
||
[JsonPropertyName("content_type")] | ||
public string ContentType { get; set; } | ||
|
||
[JsonPropertyName("vector_data_ids")] | ||
public IEnumerable<string> VectorDataIds { get; set; } = new List<string>(); | ||
|
||
[JsonPropertyName("create_date")] | ||
public DateTime CreateDate { get; set; } = DateTime.UtcNow; | ||
|
||
[JsonPropertyName("create_user_id")] | ||
public string CreateUserId { get; set; } | ||
} |
10 changes: 0 additions & 10 deletions
10
src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeSearchResult.cs
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/UploadKnowledgeResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace BotSharp.Abstraction.Knowledges.Models; | ||
|
||
public class UploadKnowledgeResponse | ||
{ | ||
[JsonPropertyName("success")] | ||
public IEnumerable<string> Success { get; set; } = new List<string>(); | ||
|
||
[JsonPropertyName("failed")] | ||
public IEnumerable<string> Failed { get; set; } = new List<string>(); | ||
|
||
[JsonPropertyName("is_success")] | ||
public bool IsSuccess { | ||
get | ||
{ | ||
return !Success.IsNullOrEmpty() && Failed.IsNullOrEmpty(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorCollectionConfigFilter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace BotSharp.Abstraction.VectorStorage.Models; | ||
|
||
public class VectorCollectionConfigFilter | ||
{ | ||
public IEnumerable<string>? CollectionNames { get; set; } | ||
public IEnumerable<string>? CollectionTypes { get; set; } | ||
public IEnumerable<string>? VectorStroageProviders { get; set; } | ||
|
||
public static VectorCollectionConfigFilter Empty() | ||
{ | ||
return new VectorCollectionConfigFilter(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorCollectionConfigModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace BotSharp.Abstraction.VectorStorage.Models; | ||
|
||
public class VectorCollectionConfigsModel | ||
{ | ||
[JsonPropertyName("collections")] | ||
public List<VectorCollectionConfig> Collections { get; set; } = new(); | ||
} | ||
|
||
public class VectorCollectionConfig | ||
{ | ||
/// <summary> | ||
/// Must be unique | ||
/// </summary> | ||
[JsonPropertyName("name")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Collection type, e.g., question-answer, document | ||
/// </summary> | ||
[JsonPropertyName("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonPropertyName("vector_storage")] | ||
public VectorStorageConfig VectorStorage { get; set; } | ||
|
||
[JsonPropertyName("text_embedding")] | ||
public KnowledgeEmbeddingConfig TextEmbedding { get; set; } | ||
} | ||
|
||
public class KnowledgeEmbeddingConfig | ||
{ | ||
[JsonPropertyName("provider")] | ||
public string Provider { get; set; } | ||
|
||
[JsonPropertyName("model")] | ||
public string Model { get; set; } | ||
|
||
[JsonPropertyName("dimension")] | ||
public int Dimension { get; set; } | ||
} | ||
|
||
public class VectorStorageConfig | ||
{ | ||
[JsonPropertyName("provider")] | ||
public string Provider { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.