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 => doc.RootElement.Deserialize<TextPart>(options), 225MessagePart.ToolCallType => TryParseStringArguments(doc.RootElement.Deserialize<ToolCallRequestPart>(options)), 226MessagePart.ToolCallResponseType => doc.RootElement.Deserialize<ToolCallResponsePart>(options), 227MessagePart.BlobType => doc.RootElement.Deserialize<BlobPart>(options), 228MessagePart.FileType => doc.RootElement.Deserialize<FilePart>(options), 229MessagePart.UriType => doc.RootElement.Deserialize<UriPart>(options), 230MessagePart.ReasoningType => doc.RootElement.Deserialize<ReasoningPart>(options), 231MessagePart.ServerToolCallType => TryParseServerToolCallArguments(doc.RootElement.Deserialize<ServerToolCallPart>(options)), 232MessagePart.ServerToolCallResponseType => doc.RootElement.Deserialize<ServerToolCallResponsePart>(options), 260public override void Write(Utf8JsonWriter writer, MessagePart value, JsonSerializerOptions options) 294[JsonSerializable(typeof(MessagePart))]
Model\GenAI\GenAIVisualizerDialogViewModel.cs (1)
291var (instructionParts, truncated) = GenAIMessageParsingHelper.DeserializeArrayIncrementally<MessagePart>(systemInstructions, GenAIMessageParsingHelper.ReadMessagePart);
Aspire.Dashboard.Components.Tests (1)
Controls\GenAIVisualizerDialogTests.cs (1)
61var systemInstruction = JsonSerializer.Serialize(new List<MessagePart>
Aspire.Dashboard.Tests (4)
Model\GenAIVisualizerDialogViewModelTests.cs (4)
488var systemInstruction = JsonSerializer.Serialize(new List<MessagePart> 611var systemInstruction = JsonSerializer.Serialize(new List<MessagePart> 684var systemInstruction = JsonSerializer.Serialize(new List<MessagePart> 2224var systemInstruction = JsonSerializer.Serialize(new List<MessagePart>