20 types derived from AIContent
Microsoft.Extensions.AI.Abstractions (16)
Contents\CodeInterpreterToolCallContent.cs (1)
17public sealed class CodeInterpreterToolCallContent : AIContent
Contents\CodeInterpreterToolResultContent.cs (1)
13public sealed class CodeInterpreterToolResultContent : AIContent
Contents\DataContent.cs (1)
37public class DataContent : AIContent
Contents\ErrorContent.cs (1)
15public class ErrorContent : AIContent
Contents\FunctionCallContent.cs (1)
17public sealed class FunctionCallContent : AIContent
Contents\FunctionResultContent.cs (1)
16public sealed class FunctionResultContent : AIContent
Contents\HostedFileContent.cs (1)
18public sealed class HostedFileContent : AIContent
Contents\HostedVectorStoreContent.cs (1)
19public sealed class HostedVectorStoreContent : AIContent
Contents\McpServerToolCallContent.cs (1)
19public sealed class McpServerToolCallContent : AIContent
Contents\McpServerToolResultContent.cs (1)
19public sealed class McpServerToolResultContent : AIContent
Contents\TextContent.cs (1)
13public sealed class TextContent : AIContent
Contents\TextReasoningContent.cs (1)
18public sealed class TextReasoningContent : AIContent
Contents\UriContent.cs (1)
19public class UriContent : AIContent
Contents\UsageContent.cs (1)
14public class UsageContent : AIContent
Contents\UserInputRequestContent.cs (1)
18public class UserInputRequestContent : AIContent
Contents\UserInputResponseContent.cs (1)
18public class UserInputResponseContent : AIContent
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
1418private class DerivedAIContent : AIContent
Microsoft.Extensions.AI.Tests (3)
ChatCompletion\DistributedCachingChatClientTest.cs (2)
887public class CustomAIContent1(string text, DateTime date) : AIContent 893public class CustomAIContent2(string text, int number) : AIContent
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
590private sealed class NonSerializableAIContent : AIContent;
11 instantiations of AIContent
Microsoft.Extensions.AI.Abstractions.Tests (3)
Contents\AIContentTests.cs (3)
15AIContent c = new(); 23AIContent c = new(); 39AIContent original = new()
Microsoft.Extensions.AI.OpenAI (4)
OpenAIResponsesChatClient.cs (4)
240message.Contents.Add(new() { RawRepresentation = outputItem }); 403yield return CreateUpdate(new AIContent { RawRepresentation = mtdli }); 427AIContent annotatedContent = new(); 1118results.Add(new() { RawRepresentation = part });
Microsoft.Extensions.AI.OpenAI.Tests (4)
OpenAIConversionTests.cs (4)
563new AIContent { RawRepresentation = ResponseItem.CreateWebSearchCallItem() }, 564new AIContent { RawRepresentation = ResponseItem.CreateReferenceItem("123") }, 571new AIContent { RawRepresentation = ResponseItem.CreateReasoningItem("text") }, 575new AIContent { RawRepresentation = ResponseItem.CreateSystemMessageItem("test") },
282 references to AIContent
Aspire.Dashboard (1)
Model\Assistant\AIHelpers.cs (1)
498public static IList<ChatMessage> GetMessages(ChatResponseUpdate update, Func<AIContent, bool>? filter = null)
Microsoft.Extensions.AI (16)
ChatCompletion\FunctionInvokingChatClient.cs (11)
503IList<AIContent> contents = update.Contents; 769IList<AIContent> content, [NotNullWhen(true)] ref List<FunctionCallContent>? functionCalls) 1073var contents = new List<AIContent>(results.Length); 1245List<AIContent>? rejectedFunctionCallResults = GenerateRejectedFunctionResults(notInvokedResponses.rejections); 1302List<AIContent>? keptContents = null; 1307var content = message.Contents[j]; 1399/// <returns>The <see cref="AIContent"/> for the rejected function calls.</returns> 1400private static List<AIContent>? GenerateRejectedFunctionResults(List<ApprovalResultWithRequestMessage>? rejections) => 1402rejections.ConvertAll(static m => (AIContent)new FunctionResultContent(m.Response.FunctionCall.CallId, "Error: Tool call invocation was rejected by user.")) : 1518private static bool TryReplaceFunctionCallsWithApprovalRequests(IList<AIContent> content, out List<AIContent>? updatedContent)
ChatCompletion\OpenTelemetryChatClient.cs (1)
247foreach (AIContent content in message.Contents)
ChatCompletion\OpenTelemetryImageGenerator.cs (1)
188List<AIContent> content = [];
ChatReduction\SummarizingChatReducer.cs (3)
201/// <summary>Returns whether the given <see cref="AIContent"/> relates to tool calling capabilities.</summary> 203/// This method returns <see langword="true"/> for content types whose meaning depends on other related <see cref="AIContent"/> 207private static bool IsToolRelatedContent(AIContent content) => content
Microsoft.Extensions.AI.Abstractions (87)
ChatCompletion\ChatMessage.cs (5)
17private IList<AIContent>? _contents; 38public ChatMessage(ChatRole role, IList<AIContent>? contents) 84public IList<AIContent> Contents 108/// <summary>Gets a <see cref="AIContent"/> object to display in the debugger display.</summary> 110private AIContent? ContentForDebuggerDisplay
ChatCompletion\ChatResponseExtensions.cs (18)
56/// contiguous <see cref="AIContent"/> items where applicable, e.g. multiple 75/// <param name="filter">A predicate to filter which <see cref="AIContent"/> gets included in the message.</param> 82public static void AddMessages(this IList<ChatMessage> list, ChatResponseUpdate update, Func<AIContent, bool>? filter = null) 110/// contiguous <see cref="AIContent"/> items where applicable, e.g. multiple 133/// message boundaries, as well as coalescing contiguous <see cref="AIContent"/> items where applicable, e.g. multiple 161/// message boundaries, as well as coalescing contiguous <see cref="AIContent"/> items where applicable, e.g. multiple 187/// <summary>Coalesces sequential <see cref="AIContent"/> content elements.</summary> 188internal static void CoalesceContent(IList<AIContent> contents) 268List<AIContent>? inputs = null; 306List<AIContent>? output = null; 326static string MergeText(IList<AIContent> contents, int start, int end) 340IList<AIContent> contents, 343Func<IList<AIContent>, int, int, TContent> merge) 344where TContent : AIContent 383static bool TryAsCoalescable(AIContent content, [NotNullWhen(true)] out TContent? coalescable) 397if (contents is List<AIContent> contentsList) 429CoalesceContent((List<AIContent>)response.Messages[i].Contents); 489foreach (var content in update.Contents)
ChatCompletion\ChatResponseUpdate.cs (5)
36private IList<AIContent>? _contents; 55public ChatResponseUpdate(ChatRole? role, IList<AIContent>? contents) 80public IList<AIContent> Contents 154/// <summary>Gets a <see cref="AIContent"/> object to display in the debugger display.</summary> 156private AIContent? ContentForDebuggerDisplay
Contents\AIAnnotation.cs (1)
23/// <summary>Gets or sets any target regions for the annotation, pointing to where in the associated <see cref="AIContent"/> this annotation applies.</summary>
Contents\AIContent.cs (2)
39/// Initializes a new instance of the <see cref="AIContent"/> class. 52/// If an <see cref="AIContent"/> is created to represent some underlying object from another object
Contents\AIContentExtensions.cs (3)
15/// <summary>Internal extensions for working with <see cref="AIContent"/>.</summary> 19public static string ConcatText(this IEnumerable<AIContent> contents) 21if (contents is IList<AIContent> list)
Contents\AnnotatedRegion.cs (1)
8/// <summary>Describes the portion of an associated <see cref="AIContent"/> to which an annotation applies.</summary>
Contents\CodeInterpreterToolCallContent.cs (2)
36/// <see cref="DataContent"/> for binary data, or other <see cref="AIContent"/> types as supported 40public IList<AIContent>? Inputs { get; set; }
Contents\CodeInterpreterToolResultContent.cs (2)
33/// or other <see cref="AIContent"/> types as supported by the service. 35public IList<AIContent>? Outputs { get; set; }
Contents\McpServerToolResultContent.cs (1)
40public IList<AIContent>? Output { get; set; }
Contents\TextSpanAnnotatedRegion.cs (3)
9/// <summary>Describes a location in the associated <see cref="AIContent"/> based on starting and ending character indices.</summary> 22/// Gets or sets the start character index (inclusive) of the annotated span in the <see cref="AIContent"/>. 28/// Gets or sets the end character index (exclusive) of the annotated span in the <see cref="AIContent"/>.
Functions\AIFunctionFactory.cs (14)
102/// However, return values whose declared type is <see cref="AIContent"/>, a derived type of <see cref="AIContent"/>, or 180/// or else using <see cref="AIJsonUtilities.DefaultOptions"/>. However, return values whose declared type is <see cref="AIContent"/>, a 181/// derived type of <see cref="AIContent"/>, or any type assignable from <see cref="IEnumerable{AIContent}"/> are not serialized; 272/// However, return values whose declared type is <see cref="AIContent"/>, a derived type of <see cref="AIContent"/>, or 357/// or else using <see cref="AIJsonUtilities.DefaultOptions"/>. However, return values whose declared type is <see cref="AIContent"/>, a 358/// derived type of <see cref="AIContent"/>, or any type assignable from <see cref="IEnumerable{AIContent}"/> are returned 462/// However, return values whose declared type is <see cref="AIContent"/>, a derived type of <see cref="AIContent"/>, or any type 1123typeof(AIContent).IsAssignableFrom(type) || 1124typeof(IEnumerable<AIContent>).IsAssignableFrom(type); 1138if (typeof(IEnumerable<AIContent>).IsAssignableFrom(type)) 1140return typeof(IEnumerable<AIContent>);
Image\ImageGenerationRequest.cs (2)
28public ImageGenerationRequest(string prompt, IEnumerable<AIContent>? originalImages) 44public IEnumerable<AIContent>? OriginalImages { get; set; }
Image\ImageGenerationResponse.cs (2)
22public ImageGenerationResponse(IList<AIContent>? contents) 44public IList<AIContent> Contents
Image\ImageGeneratorExtensions.cs (1)
131IEnumerable<AIContent> originalImages,
SpeechToText\SpeechToTextResponse.cs (4)
17private IList<AIContent>? _contents; 27public SpeechToTextResponse(IList<AIContent> contents) 77IList<AIContent> contents = Contents; 100public IList<AIContent> Contents
SpeechToText\SpeechToTextResponseUpdate.cs (3)
34private IList<AIContent>? _contents; 44public SpeechToTextResponseUpdate(IList<AIContent> contents) 92public IList<AIContent> Contents
SpeechToText\SpeechToTextResponseUpdateExtensions.cs (3)
33ChatResponseExtensions.CoalesceContent((List<AIContent>)response.Contents); 59ChatResponseExtensions.CoalesceContent((List<AIContent>)response.Contents); 94foreach (var content in update.Contents)
Tools\HostedCodeInterpreterTool.cs (2)
23/// <summary>Gets or sets a collection of <see cref="AIContent"/> to be used as input to the code interpreter tool.</summary> 29public IList<AIContent>? Inputs { get; set; }
Tools\HostedFileSearchTool.cs (2)
23/// <summary>Gets or sets a collection of <see cref="AIContent"/> to be used as input to the file search tool.</summary> 30public IList<AIContent>? Inputs { get; set; }
Utilities\AIJsonUtilities.cs (9)
25/// Adds a custom content type to the polymorphic configuration for <see cref="AIContent"/>. 34where TContent : AIContent 43/// Adds a custom content type to the polymorphic configuration for <see cref="AIContent"/>. 49/// <exception cref="ArgumentException"><paramref name="contentType"/> is a built-in content type or does not derived from <see cref="AIContent"/>.</exception> 57if (!typeof(AIContent).IsAssignableFrom(contentType)) 59Throw.ArgumentException(nameof(contentType), $"The content type must derive from {nameof(AIContent)}."); 191if (checkBuiltIn && (contentType.Assembly == typeof(AIContent).Assembly)) 193Throw.ArgumentException(nameof(contentType), $"Cannot register built-in {nameof(AIContent)} types."); 199if (typeInfo.Type == typeof(AIContent))
Utilities\AIJsonUtilities.Defaults.cs (2)
121[JsonSerializable(typeof(AIContent))] 122[JsonSerializable(typeof(IEnumerable<AIContent>))]
Microsoft.Extensions.AI.Abstractions.Tests (36)
AssertExtensions.cs (2)
33var expectedItem = expectedMessage.Contents[j]; 34var chatItem = chatMessage.Contents[j];
ChatCompletion\ChatMessageTests.cs (6)
72message = new(ChatRole.User, (IList<AIContent>?)null); 76message = new ChatMessage(ChatRole.User, Array.Empty<AIContent>()); 87List<AIContent> content = []; 170Assert.IsType<List<AIContent>>(new ChatMessage().Contents); 179List<AIContent> contents = []; 253IList<AIContent> items =
ChatCompletion\ChatResponseUpdateTests.cs (1)
48IList<AIContent> newList = [new TextContent("text")];
Contents\AIContentTests.cs (7)
15AIContent c = new(); 23AIContent c = new(); 39AIContent original = new() 48string json = JsonSerializer.Serialize(original, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(AIContent))); 51AIContent? deserialized = (AIContent?)JsonSerializer.Deserialize(json, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(AIContent)));
Contents\CodeInterpreterToolCallContentTests.cs (1)
32IList<AIContent> inputs = [new TextContent("print('hello')")];
Contents\CodeInterpreterToolResultContentTests.cs (1)
32IList<AIContent> output = [new TextContent("Hello, World!")];
Contents\McpServerToolResultContentTests.cs (2)
41IList<AIContent> output = []; 58Output = new List<AIContent> { new TextContent("result") }
Image\ImageGenerationResponseTests.cs (4)
30List<AIContent> content = []; 72List<AIContent> contents = [ 98List<AIContent> contents = [ 136List<AIContent> contents = [
Image\ImageGeneratorTests.cs (1)
139AIContent[] originalImages = [new DataContent((byte[])[1, 2, 3, 4], "image/png")];
SpeechToText\SpeechToTextResponseTests.cs (4)
17Assert.Throws<ArgumentNullException>("contents", () => new SpeechToTextResponse((IList<AIContent>)null!)); 64Assert.Throws<ArgumentNullException>("contents", () => new SpeechToTextResponse((IList<AIContent>)null!)); 73List<AIContent> content = []; 133List<AIContent> newContents = [new TextContent("text1"), new TextContent("text2")];
SpeechToText\SpeechToTextResponseUpdateTests.cs (1)
41List<AIContent> newList = [new TextContent("content1")];
Utilities\AIJsonUtilitiesTests.cs (6)
510JsonElement schema = AIJsonUtilities.CreateJsonSchema(typeof(AIContent), serializerOptions: options); 1050AIContent c = new DerivedAIContent { DerivedValue = 42 }; 1054AIContent? deserialized = JsonSerializer.Deserialize<AIContent>(json, options); 1077Assert.Throws<ArgumentException>("contentType", () => options.AddAIContentType<AIContent>("discriminator")); 1088AIContent c = new DerivedAIContent();
Microsoft.Extensions.AI.AzureAIInference (5)
AzureAIInferenceChatClient.cs (5)
440foreach (AIContent item in input.Contents) 482foreach (var content in input.Contents) 499/// <summary>Converts a list of <see cref="AIContent"/> to a list of <see cref="ChatMessageContentItem"/>.</summary> 500private static List<ChatMessageContentItem> GetContentParts(IList<AIContent> contents) 505foreach (var content in contents)
Microsoft.Extensions.AI.AzureAIInference.Tests (4)
AzureAIInferenceChatClientTests.cs (2)
145[new ChatMessage(ChatRole.User, "hello".Select(c => (AIContent)new TextContent(c.ToString())).ToList())] : 218[new ChatMessage(ChatRole.User, "hello".Select(c => (AIContent)new TextContent(c.ToString())).ToList())] :
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
33var expectedItem = expectedMessage.Contents[j]; 34var chatItem = chatMessage.Contents[j];
Microsoft.Extensions.AI.Evaluation (14)
ChatMessageExtensions.cs (2)
99/// This function only considers the <see cref="ChatMessage.Text"/> and ignores any <see cref="AIContent"/>s 138/// This function only considers the <see cref="ChatMessage.Text"/> and ignores any <see cref="AIContent"/>s
ChatResponseExtensions.cs (1)
20/// This function only considers the <see cref="ChatResponse.Text"/> and ignores any <see cref="AIContent"/>s
EvaluationContext.cs (11)
28/// <see cref="AIContent"/>s that represent <b>all</b> the contextual information that is modeled by the 41/// <see cref="Contents"/> property returns a collection of <see cref="AIContent"/>s that represent <b>all</b> the 53/// Gets or sets a list of <see cref="AIContent"/> objects that include all the information present in this 60/// images, and other similar <see cref="AIContent"/> objects for other modalities such as audio and video in the 70/// <see cref="AIContent"/>s that represent <b>all</b> the contextual information that is modeled by the 84/// <see cref="Contents"/> property returns a collection of <see cref="AIContent"/>s that represent <b>all</b> the 89/// A list of <see cref="AIContent"/> objects that include all the information present in this 92public IList<AIContent> Contents { get; set; } 101protected EvaluationContext(string name, IEnumerable<AIContent> contents) 114protected EvaluationContext(string name, params AIContent[] contents) 115: this(name, contents as IEnumerable<AIContent>)
Microsoft.Extensions.AI.Evaluation.Quality (1)
ChatResponseExtensions.cs (1)
29foreach (AIContent content in modelResponse.Messages.SelectMany(m => m.Contents))
Microsoft.Extensions.AI.Evaluation.Reporting (5)
JsonSerialization\EvaluationContextConverter.cs (5)
14private sealed class DeserializedEvaluationContext(string name, IReadOnlyList<AIContent> contents) 31IReadOnlyList<AIContent>? contents = null; 68JsonTypeInfo contentsTypeInfo = options.GetTypeInfo(typeof(IReadOnlyList<AIContent>)); 69contents = JsonSerializer.Deserialize(ref reader, contentsTypeInfo) as IReadOnlyList<AIContent>; 90JsonTypeInfo contentsTypeInfo = options.GetTypeInfo(typeof(IReadOnlyList<AIContent>));
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (5)
src\Libraries\Microsoft.Extensions.AI.Evaluation.Reporting\CSharp\JsonSerialization\EvaluationContextConverter.cs (5)
14private sealed class DeserializedEvaluationContext(string name, IReadOnlyList<AIContent> contents) 31IReadOnlyList<AIContent>? contents = null; 68JsonTypeInfo contentsTypeInfo = options.GetTypeInfo(typeof(IReadOnlyList<AIContent>)); 69contents = JsonSerializer.Deserialize(ref reader, contentsTypeInfo) as IReadOnlyList<AIContent>; 90JsonTypeInfo contentsTypeInfo = options.GetTypeInfo(typeof(IReadOnlyList<AIContent>));
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (7)
ScenarioRunResultTests.cs (7)
17private sealed class TestContext(string name, params AIContent[] contents) 344if (x?.Contents is IList<AIContent> xContents && y?.Contents is IList<AIContent> yContents) 356private class AIContentComparer : IEqualityComparer<AIContent> 360public bool Equals(AIContent? x, AIContent? y) 375public int GetHashCode(AIContent obj)
Microsoft.Extensions.AI.Evaluation.Safety (5)
AIContentExtensions.cs (2)
10internal static bool IsTextOrUsage(this AIContent content) 13internal static bool IsImageWithSupportedFormat(this AIContent content) =>
ContentSafetyEvaluator.cs (1)
112relevantContext.SelectMany(c => c.Contents) is IEnumerable<AIContent> contents && contents.Any() &&
ContentSafetyServicePayloadUtilities.cs (2)
316foreach (AIContent content in message.Contents) 452foreach (AIContent content in message.Contents)
Microsoft.Extensions.AI.Integration.Tests (6)
ImageGeneratorIntegrationTests.cs (4)
47var content = Assert.Single(response.Contents); 81foreach (var content in response.Contents) 96AIContent[] originalImages = [new DataContent(imageData, "image/png") { Name = "dotnet.png" }]; 109var content = response.Contents[0];
PromptBasedFunctionCallingChatClient.cs (1)
90var contentItem = message.Contents.SingleOrDefault();
ReducingChatClientTests.cs (1)
98foreach (AIContent content in message.Contents)
Microsoft.Extensions.AI.OpenAI (48)
MicrosoftExtensionsAIChatExtensions.cs (2)
85static IEnumerable<ChatMessageAnnotation> ConvertAnnotations(IEnumerable<AIContent>? contents) 92foreach (var content in contents)
OpenAIAssistantsChatClient.cs (4)
394foreach (var input in codeInterpreterTool.Inputs) 415foreach (var input in fileSearchInputs) 526foreach (AIContent content in chatMessage.Contents) 530case AIContent when content.RawRepresentation is MessageContent rawRep:
OpenAIChatClient.cs (15)
166foreach (AIContent item in input.Contents) 192foreach (var content in input.Contents) 243/// <summary>Converts a list of <see cref="AIContent"/> to a list of <see cref="ChatMessageContentPart"/>.</summary> 244internal static List<ChatMessageContentPart> ToOpenAIChatContent(IEnumerable<AIContent> contents) 248foreach (var content in contents) 271private static ChatMessageContentPart? ToChatMessageContentPart(AIContent content) 275case AIContent when content.RawRepresentation is ChatMessageContentPart rawContentPart: 310private static ChatImageDetailLevel? GetImageDetail(AIContent content) 477if (ToAIContent(contentPart) is AIContent aiContent) 683/// <summary>Creates <see cref="AIContent"/>s from <see cref="ChatMessageContent"/>.</summary> 686internal static void ConvertContentParts(ChatMessageContent content, IList<AIContent> results) 697/// <summary>Creates an <see cref="AIContent"/> from a <see cref="ChatMessageContentPart"/>.</summary> 699/// <returns>The constructed <see cref="AIContent"/>, or <see langword="null"/> if the content part could not be converted.</returns> 700private static AIContent? ToAIContent(ChatMessageContentPart contentPart) 702AIContent? aiContent = null;
OpenAIImageGenerator.cs (2)
68var originalImage = request.OriginalImages.FirstOrDefault(); 145List<AIContent> contents = [];
OpenAIResponsesChatClient.cs (25)
195((List<AIContent>)message.Contents).AddRange(ToAIContents(messageItem.Content)); 298ChatResponseUpdate CreateUpdate(AIContent? content = null) => 427AIContent annotatedContent = new(); 735Dictionary<string, AIContent>? idToContentMapping = null; 762foreach (AIContent item in input.Contents) 791case AIContent when item.RawRepresentation is ResponseContentPart rawRep: 842foreach (AIContent item in input.Contents) 846case AIContent when item.RawRepresentation is ResponseItem rawRep: 851static FunctionCallOutputResponseItem SerializeAIContent(string callId, IEnumerable<AIContent> contents) 855foreach (var content in contents) 938case AIContent ac: 942case IEnumerable<AIContent> items: 976foreach (AIContent item in input.Contents) 980case AIContent when item.RawRepresentation is ResponseItem rawRep: 1016if (idToContentMapping?.TryGetValue(mstrc.CallId, out AIContent? callContentFromMapping) is true && 1074/// <summary>Convert a sequence of <see cref="ResponseContentPart"/>s to a list of <see cref="AIContent"/>.</summary> 1075private static List<AIContent> ToAIContents(IEnumerable<ResponseContentPart> contents) 1077List<AIContent> results = []; 1127private static void PopulateAnnotations(ResponseContentPart source, AIContent destination) 1166/// <summary>Adds new <see cref="AIContent"/> for the specified <paramref name="mtci"/> into <paramref name="contents"/>.</summary> 1167private static void AddMcpToolCallContent(McpToolCallItem mtci, IList<AIContent> contents) 1196/// <summary>Adds new <see cref="AIContent"/> for the specified <paramref name="cicri"/> into <paramref name="contents"/>.</summary> 1197private static void AddCodeInterpreterContents(CodeInterpreterCallResponseItem cicri, IList<AIContent> contents) 1212Outputs = cicri.Outputs is { Count: > 0 } outputs ? outputs.Select<CodeInterpreterCallOutput, AIContent?>(o => 1218}).OfType<AIContent>().ToList() : null,
Microsoft.Extensions.AI.OpenAI.Tests (6)
OpenAIResponseClientIntegrationTests.cs (2)
456Tools = [AIFunctionFactory.Create((string city) => new List<AIContent> 532Tools = [AIFunctionFactory.Create(() => new List<AIContent>
OpenAIResponseClientTests.cs (2)
3593new FunctionResultContent("call_456", new List<AIContent> 3828new FunctionResultContent("call_mixed", new List<AIContent>
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
33var expectedItem = expectedMessage.Contents[j]; 34var chatItem = chatMessage.Contents[j];
Microsoft.Extensions.AI.Tests (35)
ChatCompletion\DistributedCachingChatClientTest.cs (5)
694if (typeInfo.Type == typeof(AIContent)) 814var expectedItem = expectedMessage.Contents[itemIndex]; 815var actualItem = actualMessage.Contents[itemIndex]; 848var expectedItemItem = expectedItem.Contents[itemIndex]; 849var actualItemItem = actualItem.Contents[itemIndex];
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
568IEnumerable<AIContent> content = finalChat.SelectMany(m => m.Contents); 929AIContent[] resultContents = existingSearchResult is not null && existingSearchResult.Contents.OfType<FunctionResultContent>().ToList() is { } frcs
Functions\AIFunctionFactoryTest.cs (25)
931AIFunctionFactory.Create(() => (AIContent)new TextContent("text")), 932AIFunctionFactory.Create(async () => (AIContent)new TextContent("text")), 933AIFunctionFactory.Create(async ValueTask<AIContent> () => (AIContent)new TextContent("text")), 936AIFunctionFactory.Create(async ValueTask<AIContent> () => new TextContent("text")), 946await ValidateAsync<IEnumerable<AIContent>>( 948AIFunctionFactory.Create(() => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 949AIFunctionFactory.Create(async () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 950AIFunctionFactory.Create(async ValueTask<IEnumerable<AIContent>> () => (IEnumerable<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 953await ValidateAsync<AIContent[]>( 955AIFunctionFactory.Create(() => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 956AIFunctionFactory.Create(async () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 957AIFunctionFactory.Create(async ValueTask<AIContent[]> () => (AIContent[])[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 960await ValidateAsync<List<AIContent>>( 962AIFunctionFactory.Create(() => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 963AIFunctionFactory.Create(async () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 964AIFunctionFactory.Create(async ValueTask<List<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 967await ValidateAsync<IEnumerable<AIContent>>( 969AIFunctionFactory.Create(() => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 970AIFunctionFactory.Create(async () => (IList<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]), 971AIFunctionFactory.Create(async ValueTask<IList<AIContent>> () => (List<AIContent>)[new TextContent("text"), new DataContent(new byte[] { 1, 2, 3 }, "application/octet-stream")]),
Image\LoggingImageGeneratorTests.cs (1)
116AIContent[] originalImages = [new DataContent((byte[])[1, 2, 3, 4], "image/png")];
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
33var expectedItem = expectedMessage.Contents[j]; 34var chatItem = chatMessage.Contents[j];
Microsoft.Extensions.DataIngestion.Tests (1)
Processors\AlternativeTextEnricherTests.cs (1)
47var content = Assert.Single(materializedMessages[1].Contents);