10 types derived from MessagePart
Aspire.Dashboard (10)
Model\GenAI\GenAIMessages.cs (10)
33public class TextPart : MessagePart 46public class ToolCallRequestPart : MessagePart 61public class ToolCallResponsePart : MessagePart 75public class BlobPart : MessagePart 90public class FilePart : MessagePart 105public class UriPart : MessagePart 120public class ReasoningPart : MessagePart 133public class ServerToolCallPart : MessagePart 148public class ServerToolCallResponsePart : MessagePart 162public 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)
186public List<MessagePart> Parts { get; set; } = new(); 204/// Handles polymorphic serialization and deserialization of <see cref="MessagePart"/> types. 206internal sealed class MessagePartConverter : JsonConverter<MessagePart> 208public override MessagePart? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 223MessagePart.TextType => doc.RootElement.Deserialize<TextPart>(options), 224MessagePart.ToolCallType => TryParseStringArguments(doc.RootElement.Deserialize<ToolCallRequestPart>(options)), 225MessagePart.ToolCallResponseType => doc.RootElement.Deserialize<ToolCallResponsePart>(options), 226MessagePart.BlobType => doc.RootElement.Deserialize<BlobPart>(options), 227MessagePart.FileType => doc.RootElement.Deserialize<FilePart>(options), 228MessagePart.UriType => doc.RootElement.Deserialize<UriPart>(options), 229MessagePart.ReasoningType => doc.RootElement.Deserialize<ReasoningPart>(options), 230MessagePart.ServerToolCallType => TryParseServerToolCallArguments(doc.RootElement.Deserialize<ServerToolCallPart>(options)), 231MessagePart.ServerToolCallResponseType => doc.RootElement.Deserialize<ServerToolCallResponsePart>(options), 259public override void Write(Utf8JsonWriter writer, MessagePart value, JsonSerializerOptions options) 293[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)
65var 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>