20 types derived from AIContent
Microsoft.Extensions.AI.Abstractions (16)
Microsoft.Extensions.AI.Abstractions.Tests (1)
Microsoft.Extensions.AI.Tests (3)
11 instantiations of AIContent
Microsoft.Extensions.AI.Abstractions.Tests (3)
Microsoft.Extensions.AI.OpenAI (4)
Microsoft.Extensions.AI.OpenAI.Tests (4)
282 references to AIContent
Aspire.Dashboard (1)
Microsoft.Extensions.AI (16)
Microsoft.Extensions.AI.Abstractions (87)
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)
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>);
Microsoft.Extensions.AI.Abstractions.Tests (36)
Microsoft.Extensions.AI.AzureAIInference (5)
Microsoft.Extensions.AI.AzureAIInference.Tests (4)
Microsoft.Extensions.AI.Evaluation (14)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Microsoft.Extensions.AI.Evaluation.Reporting (5)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (5)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (7)
Microsoft.Extensions.AI.Evaluation.Safety (5)
Microsoft.Extensions.AI.Integration.Tests (6)
Microsoft.Extensions.AI.OpenAI (48)
Microsoft.Extensions.AI.OpenAI.Tests (6)
Microsoft.Extensions.AI.Tests (35)
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")]),
Microsoft.Extensions.DataIngestion.Tests (1)