10 types derived from MessagePart
Aspire.Dashboard (10)
Model\GenAI\GenAIMessages.cs (10)
34public class TextPart : MessagePart 47public class ToolCallRequestPart : MessagePart 62public class ToolCallResponsePart : MessagePart 76public class BlobPart : MessagePart 91public class FilePart : MessagePart 106public class UriPart : MessagePart 121public class ReasoningPart : MessagePart 134public class ServerToolCallPart : MessagePart 149public class ServerToolCallResponsePart : MessagePart 163public class GenericPart : MessagePart
34 references to MessagePart
Aspire.Dashboard (29)
Model\GenAI\GenAIItemPartViewModel.cs (3)
29public MessagePart? MessagePart { get; init; } 53public static GenAIItemPartViewModel CreateMessagePart(MessagePart part) 66private static TextVisualizerViewModel CreateMessagePartVisualizer(MessagePart p)
Model\GenAI\GenAIItemViewModel.cs (6)
40if (ItemParts.Any(p => p.MessagePart?.Type is MessagePart.ToolCallType or MessagePart.ServerToolCallType)) 49if (ItemParts.Any(p => p.MessagePart?.Type is MessagePart.ToolCallType or MessagePart.ServerToolCallType)) 53if (ItemParts.Any(p => p.MessagePart?.Type is MessagePart.ToolCallResponseType or MessagePart.ServerToolCallResponseType))
Model\GenAI\GenAIMessageParsingHelper.cs (4)
82internal static MessagePart? ReadMessagePart(ref Utf8JsonReader reader) 87internal static (string role, List<MessagePart> parts, bool partsTruncated) ReadChatMessage(ref Utf8JsonReader reader) 95List<MessagePart>? parts = null; 123(parts, partsTruncated) = DeserializeArrayIncrementally<MessagePart>(ref reader, ReadMessagePart);
Model\GenAI\GenAIMessages.cs (15)
187public List<MessagePart> Parts { get; set; } = new(); 205/// Handles polymorphic serialization and deserialization of <see cref="MessagePart"/> types. 207internal sealed class MessagePartConverter : JsonConverter<MessagePart> 209public override MessagePart? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 224MessagePart.TextType => Deserialize<TextPart>(doc.RootElement, options), 225MessagePart.ToolCallType => TryParseStringArguments(Deserialize<ToolCallRequestPart>(doc.RootElement, options)), 226MessagePart.ToolCallResponseType => Deserialize<ToolCallResponsePart>(doc.RootElement, options), 227MessagePart.BlobType => Deserialize<BlobPart>(doc.RootElement, options), 228MessagePart.FileType => Deserialize<FilePart>(doc.RootElement, options), 229MessagePart.UriType => Deserialize<UriPart>(doc.RootElement, options), 230MessagePart.ReasoningType => Deserialize<ReasoningPart>(doc.RootElement, options), 231MessagePart.ServerToolCallType => TryParseServerToolCallArguments(Deserialize<ServerToolCallPart>(doc.RootElement, options)), 232MessagePart.ServerToolCallResponseType => Deserialize<ServerToolCallResponsePart>(doc.RootElement, options), 260public override void Write(Utf8JsonWriter writer, MessagePart value, JsonSerializerOptions options) 300[JsonSerializable(typeof(MessagePart))]
Model\GenAI\GenAIVisualizerDialogViewModel.cs (1)
293var (instructionParts, truncated) = GenAIMessageParsingHelper.DeserializeArrayIncrementally<MessagePart>(systemInstructions, GenAIMessageParsingHelper.ReadMessagePart);
Aspire.Dashboard.Components.Tests (1)
Controls\GenAIVisualizerDialogTests.cs (1)
83var systemInstruction = JsonSerializer.Serialize(new List<MessagePart>
Aspire.Dashboard.Tests (4)
Model\GenAIVisualizerDialogViewModelTests.cs (4)
496var systemInstruction = JsonSerializer.Serialize(new List<MessagePart> 620var systemInstruction = JsonSerializer.Serialize(new List<MessagePart> 694var systemInstruction = JsonSerializer.Serialize(new List<MessagePart> 2255var systemInstruction = JsonSerializer.Serialize(new List<MessagePart>