6 types derived from AIContent
Microsoft.Extensions.AI.Abstractions (5)
Contents\DataContent.cs (1)
29public class DataContent : AIContent
Contents\FunctionCallContent.cs (1)
17public sealed class FunctionCallContent : AIContent
Contents\FunctionResultContent.cs (1)
16public sealed class FunctionResultContent : AIContent
Contents\TextContent.cs (1)
11public sealed class TextContent : AIContent
Contents\UsageContent.cs (1)
14public class UsageContent : AIContent
Microsoft.Extensions.AI.Abstractions.Tests (1)
Contents\AIContentTests.cs (1)
34private sealed class DerivedAIContent : AIContent;
55 references to AIContent
Microsoft.Extensions.AI (4)
ChatCompletion\ChatCompletion{T}.cs (1)
120var content = choice?.Contents.Count == 1 ? choice.Contents[0] : null;
ChatCompletion\FunctionInvokingChatClient.cs (3)
196HashSet<AIContent>? contentsToRemove = null; 417HashSet<AIContent>? contentToRemove, 579var contents = new AIContent[results.Length];
Microsoft.Extensions.AI.Abstractions (21)
ChatCompletion\ChatMessage.cs (3)
14private IList<AIContent>? _contents; 36IList<AIContent> contents) 78public IList<AIContent> Contents
ChatCompletion\StreamingChatCompletionUpdate.cs (2)
43private IList<AIContent>? _contents; 84public IList<AIContent> Contents
ChatCompletion\StreamingChatCompletionUpdateExtensions.cs (9)
27/// <see langword="true"/> to attempt to coalesce contiguous <see cref="AIContent"/> items, where applicable, 28/// into a single <see cref="AIContent"/>, in order to reduce the number of individual content items that are included in 54/// <see langword="true"/> to attempt to coalesce contiguous <see cref="AIContent"/> items, where applicable, 55/// into a single <see cref="AIContent"/>, in order to reduce the number of individual content items that are included in 98new(default, new List<AIContent>()); 106((List<AIContent>)message.Contents).AddRange(update.Contents); 161CoalesceTextContent((List<AIContent>)entry.Value.Contents); 168foreach (var content in entry.Value.Contents) 183private static void CoalesceTextContent(List<AIContent> contents)
Contents\AIContent.cs (2)
20/// Initializes a new instance of the <see cref="AIContent"/> class. 28/// If an <see cref="AIContent"/> is created to represent some underlying object from another object
Contents\AIContentExtensions.cs (4)
14/// <summary>Internal extensions for working with <see cref="AIContent"/>.</summary> 18public static T? FindFirst<T>(this IList<AIContent> contents) 19where T : AIContent 34public static string ConcatText(this IList<AIContent> contents)
Utilities\AIJsonUtilities.Defaults.cs (1)
84[JsonSerializable(typeof(AIContent))]
Microsoft.Extensions.AI.Abstractions.Tests (6)
ChatCompletion\ChatMessageTests.cs (5)
60Assert.Throws<ArgumentNullException>("contents", () => new ChatMessage(ChatRole.User, (IList<AIContent>)null!)); 69List<AIContent> content = []; 193Assert.IsType<List<AIContent>>(new ChatMessage().Contents); 202List<AIContent> contents = []; 262IList<AIContent> items =
ChatCompletion\StreamingChatCompletionUpdateTests.cs (1)
48IList<AIContent> newList = [new TextContent("text")];
Microsoft.Extensions.AI.AzureAIInference (5)
AzureAIInferenceChatClient.cs (5)
421foreach (AIContent item in input.Contents) 452foreach (var content in input.Contents) 469/// <summary>Converts a list of <see cref="AIContent"/> to a list of <see cref="ChatMessageContentItem"/>.</summary> 470private static List<ChatMessageContentItem> GetContentParts(IList<AIContent> contents) 473foreach (var content in contents)
Microsoft.Extensions.AI.Ollama (2)
OllamaChatClient.cs (2)
232List<AIContent> contents = []; 354foreach (var item in content.Contents)
Microsoft.Extensions.AI.OpenAI (11)
OpenAIChatClient.cs (11)
129if (ToAIContent(contentPart) is AIContent aiContent) 257if (ToAIContent(contentPart) is AIContent aiContent) 538/// <summary>Creates an <see cref="AIContent"/> from a <see cref="ChatMessageContentPart"/>.</summary> 540/// <returns>The constructed <see cref="AIContent"/>, or null if the content part could not be converted.</returns> 541private static AIContent? ToAIContent(ChatMessageContentPart contentPart) 543AIContent? aiContent = null; 593foreach (AIContent item in input.Contents) 621foreach (var content in input.Contents) 645/// <summary>Converts a list of <see cref="AIContent"/> to a list of <see cref="ChatMessageContentPart"/>.</summary> 646private static List<ChatMessageContentPart> GetContentParts(IList<AIContent> contents) 649foreach (var content in contents)
Microsoft.Extensions.AI.Tests (6)
ChatCompletion\FunctionInvokingChatClientTests.cs (6)
242IEnumerable<AIContent> content = finalChat.SelectMany(m => m.Contents); 310IEnumerable<AIContent> content = finalChat.SelectMany(m => m.Contents); 544var expectedItem = expectedMessage.Contents[j]; 545var chatItem = chatMessage.Contents[j]; 611var expectedItem = expectedMessage.Contents[j]; 612var chatItem = chatMessage.Contents[j];