Merge pull request #1133 from iceljc/master

add vector payload
This commit is contained in:
iceljc 2025-08-21 15:48:57 -05:00 committed by GitHub
commit 12077f0ebf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View file

@ -4,6 +4,7 @@ public class VectorCollectionData
{ {
public string Id { get; set; } public string Id { get; set; }
public Dictionary<string, VectorPayloadValue> Data { get; set; } = new(); public Dictionary<string, VectorPayloadValue> Data { get; set; } = new();
public Dictionary<string, object> Payload => Data?.ToDictionary(x => x.Key, x => x.Value.DataValue) ?? [];
public double? Score { get; set; } public double? Score { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

View file

@ -1,5 +1,4 @@
using BotSharp.Abstraction.VectorStorage.Enums; using BotSharp.Abstraction.VectorStorage.Enums;
using Newtonsoft.Json.Linq;
namespace BotSharp.Abstraction.VectorStorage.Models; namespace BotSharp.Abstraction.VectorStorage.Models;

View file

@ -11,6 +11,9 @@ public class VectorKnowledgeViewModel
[JsonPropertyName("data")] [JsonPropertyName("data")]
public IDictionary<string, VectorPayloadValue> Data { get; set; } public IDictionary<string, VectorPayloadValue> Data { get; set; }
[JsonPropertyName("payload")]
public IDictionary<string, object> Payload { get; set; }
[JsonPropertyName("score")] [JsonPropertyName("score")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Score { get; set; } public double? Score { get; set; }
@ -26,6 +29,7 @@ public class VectorKnowledgeViewModel
{ {
Id = result.Id, Id = result.Id,
Data = result.Data, Data = result.Data,
Payload = result.Payload,
Score = result.Score, Score = result.Score,
VectorDimension = result.Vector?.Length VectorDimension = result.Vector?.Length
}; };
@ -37,6 +41,7 @@ public class VectorKnowledgeViewModel
{ {
Id = data.Id, Id = data.Id,
Data = data.Data, Data = data.Data,
Payload = data.Payload,
VectorDimension = data.Vector?.Length VectorDimension = data.Vector?.Length
}; };
} }