90 writes to Contents
Microsoft.AspNetCore.Components.AI (1)
Engine\UIAgent.cs (1)
116Contents = [.. message.Contents]
Microsoft.Extensions.AI (3)
ChatCompletion\FunctionInvokingChatClient.cs (2)
626updateToYield.Contents = updatedContents; 714Contents = message.Contents,
ChatCompletion\ImageGeneratingChatClient.cs (1)
115modifiedUpdate.Contents = newContents;
Microsoft.Extensions.AI.Abstractions (3)
ChatCompletion\ChatResponse.cs (1)
149Contents = message.Contents,
ChatCompletion\ChatResponseUpdate.cs (1)
73Contents = Contents,
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponseUpdate.g.cs (1)
122Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponseUpdate)obj).Contents = value!,
Microsoft.Extensions.AI.Abstractions.Tests (57)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (49)
35new() { Contents = [new UsageContent(new() { InputTokenCount = 1, OutputTokenCount = 2 })] }, 36new() { Contents = [new UsageContent(new() { InputTokenCount = 4, OutputTokenCount = 5 })] }, 662updates.Add(new() { Contents = [new DataContent("data:image/png;base64,aGVsbG8=")] }); 692new() { Contents = [new TextReasoningContent("D")] }, 693new() { Contents = [new TextReasoningContent("E")] }, 694new() { Contents = [new TextReasoningContent("F")] }, 697new() { Contents = [new TextReasoningContent("I")] }, 698new() { Contents = [new TextReasoningContent("J")] }, 700new() { Contents = [new TextReasoningContent("L")] }, 703new() { Contents = [new TextReasoningContent("O")] }, 704new() { Contents = [new TextReasoningContent("P")] }, 727new() { Contents = [new TextReasoningContent("A") { ProtectedData = "1" }] }, 728new() { Contents = [new TextReasoningContent("B") { ProtectedData = "2" }] }, 729new() { Contents = [new TextReasoningContent("C")] }, 730new() { Contents = [new TextReasoningContent("D")] }, 731new() { Contents = [new TextReasoningContent("E") { ProtectedData = "3" }] }, 732new() { Contents = [new TextReasoningContent("F") { ProtectedData = "4" }] }, 733new() { Contents = [new TextReasoningContent("G")] }, 734new() { Contents = [new TextReasoningContent("H")] }, 767new() { Contents = [new TextContent("D") { Annotations = [new()] }] }, 768new() { Contents = [new TextContent("E") { Annotations = [new()] }] }, 769new() { Contents = [new TextContent("F") { Annotations = [new()] }] }, 770new() { Contents = [new TextContent("G") { Annotations = [] }] }, 771new() { Contents = [new TextContent("H") { Annotations = [] }] }, 772new() { Contents = [new TextContent("I") { Annotations = [new()] }] }, 773new() { Contents = [new TextContent("J") { Annotations = [new()] }] }, 775new() { Contents = [new TextContent("L") { Annotations = [new()] }] }, 778new() { Contents = [new TextContent("O") { Annotations = [new()] }] }, 779new() { Contents = [new TextContent("P") { Annotations = [new()] }] }, 806new() { Contents = [new UsageContent(new() { TotalTokenCount = 42 })] }, 934new() { Contents = [new ImageGenerationToolResultContent("img1") { Outputs = [image1] }] }, 937new() { Contents = [new ImageGenerationToolResultContent("img2") { Outputs = [image2] }] }, 940new() { Contents = [new ImageGenerationToolResultContent("img1") { Outputs = [image3] }] }, 943new() { Contents = [new ImageGenerationToolResultContent("img2") { Outputs = [image4] }] }, 988new() { Contents = [new ImageGenerationToolResultContent("id-1") { Outputs = [image1] }] }, 991new() { Contents = [new ImageGenerationToolResultContent("id-2") { Outputs = [image2] }] }, 994new() { Contents = [new ImageGenerationToolResultContent("id-3") { Outputs = [image3] }] }, 1023new() { Contents = [new WebSearchToolCallContent("ws1") { Queries = ["first query"] }] }, 1029new() { Contents = [new WebSearchToolCallContent("ws1") { Queries = ["second query"], RawRepresentation = rawRepresentation, AdditionalProperties = additionalProps }] }, 1032new() { Contents = [new WebSearchToolCallContent("ws2") { Queries = ["AI safety"] }] }, 1035new() { Contents = [new WebSearchToolCallContent("ws1")] }, 1067new() { Contents = [new WebSearchToolCallContent("ws1")] }, 1068new() { Contents = [new WebSearchToolCallContent("ws1") { Queries = ["query from second"] }] }, 1086new() { Contents = [new WebSearchToolCallContent("ws1") { Queries = ["q1"] }] }, 1087new() { Contents = [new WebSearchToolCallContent("ws2") { Queries = ["q2"] }] }, 1088new() { Contents = [new WebSearchToolCallContent("ws3") { Queries = ["q3"] }] }, 1120new() { Contents = [inProgress] }, 1123new() { Contents = [new WebSearchToolCallContent("ws1") { Queries = ["dotnet extensions"] }] }, 1127new() { Contents = [new FunctionCallContent("fc1", "SearchTool", new Dictionary<string, object?> { ["q"] = "test" })] },
ChatCompletion\ChatResponseUpdateTests.cs (7)
49update.Contents = newList; 51update.Contents = null; 90Contents = 119Contents = 182Contents = 254Contents = originalContents, 381Contents = sharedContents
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponseUpdate.g.cs (1)
120Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponseUpdate)obj).Contents = value!,
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAIConversionTests.cs (1)
1744Contents =
Microsoft.Extensions.AI.Tests (25)
ChatCompletion\DistributedCachingChatClientTest.cs (8)
253Contents = 266Contents = [new FunctionCallContent("someCallId", "someFn", new Dictionary<string, object?> { ["arg1"] = "value1" })], 270Contents = [new UsageContent(new() { InputTokenCount = 123, OutputTokenCount = 456, TotalTokenCount = 99999 })], 316new() { Role = ChatRole.Assistant, Contents = [new FunctionCallContent("callId1", "separator")] }, 369new() { Role = ChatRole.Assistant, Contents = [new TextContent("Hello")] }, 370new() { Role = ChatRole.Assistant, Contents = [new TextContent(" world, ")] }, 374Contents = 385Contents =
ChatCompletion\FunctionInvokingChatClientTests.cs (3)
1192new() { Contents = [new FunctionCallContent("callId1", "Func1", new Dictionary<string, object?> { ["text"] = "Input 1" })] }, 1193new() { Contents = [new FunctionCallContent("callId2", "Func1", new Dictionary<string, object?> { ["text"] = "Input 2" })] } 1198updates = [new() { Contents = [new TextContent("OK bye")] }];
ChatCompletion\OpenTelemetryChatClientTests.cs (13)
87Contents = [new UsageContent(new() 423yield return new() { Contents = [new TextReasoningContent("This is reasoning")] }; 424yield return new() { Contents = [new FunctionCallContent("call-123", "GetWeather", new Dictionary<string, object?> { ["location"] = "Seattle" })] }; 425yield return new() { Contents = [new FunctionResultContent("call-123", "72°F and sunny")] }; 426yield return new() { Contents = [new DataContent(Convert.FromBase64String("aGVsbG8gd29ybGQ="), "image/png")] }; 427yield return new() { Contents = [new UriContent(new Uri("https://example.com/image.jpg"), "image/jpeg")] }; 428yield return new() { Contents = [new HostedFileContent("file-abc123")] }; 677yield return new() { Contents = [new CodeInterpreterToolCallContent("ci-call-1") { Inputs = [new TextContent("print('hello')")] }] }; 678yield return new() { Contents = [new CodeInterpreterToolResultContent("ci-call-1") { Outputs = [new TextContent("hello")] }] }; 679yield return new() { Contents = [new ImageGenerationToolCallContent("img-123")] }; 682Contents = 690yield return new() { Contents = [new McpServerToolCallContent("mcp-call-1", "myTool", "myServer") { Arguments = new Dictionary<string, object?> { ["param1"] = "value1" } }] }; 691yield return new() { Contents = [new McpServerToolResultContent("mcp-call-1") { Outputs = [new TextContent("Tool result")] }] };
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponseUpdate.g.cs (1)
120Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.ChatResponseUpdate)obj).Contents = value!,
186 references to Contents
Aspire.Dashboard (3)
Model\Assistant\AIHelpers.cs (3)
334foreach (var item in update.Contents.OfType<TextContent>()) 353var contentsList = filter is null ? update.Contents : update.Contents.Where(filter).ToList();
Microsoft.AspNetCore.Components.AI (8)
Engine\UIAgent.cs (1)
135var contentTypes = string.Join(", ", update.Contents.Select(c => c.GetType().Name));
Pipeline\BlockMappingContext.cs (5)
21_handled = new bool[update.Contents.Count]; 32public UnhandledContentsEnumerable UnhandledContents => new(Update.Contents, _handled); 40var contents = Update.Contents; 67_handledCount >= Update.Contents.Count && (Update.Contents.Count > 0 || _updateHandled);
Pipeline\BlockMappingPipeline.cs (2)
42var contentTypes = string.Join(", ", update.Contents.Select(c => c.GetType().Name)); 43BlockMappingPipelineLog.ProcessingUpdate(_logger, update.Role?.Value, update.Contents.Count, contentTypes);
Microsoft.Extensions.AI (6)
ChatCompletion\FunctionInvokingChatClient.cs (4)
551_ = CopyFunctionCalls(update.Contents, ref functionCallContents); 555IList<AIContent> contents = update.Contents; 624if (TryReplaceFunctionCallsWithApprovalRequests(updateToYield.Contents, approvalRequiredFunctions, out var updatedContents)) 980IList<AIContent> contents = updates[i].Contents;
ChatCompletion\ImageGeneratingChatClient.cs (2)
109var newContents = requestState.ReplaceImageGenerationFunctionResults(update.Contents); 111if (!ReferenceEquals(newContents, update.Contents))
Microsoft.Extensions.AI.Abstractions (7)
ChatCompletion\ChatResponse.cs (1)
134extra.Contents.Add(new UsageContent(usage));
ChatCompletion\ChatResponseExtensions.cs (3)
87var contentsList = filter is null ? update.Contents : update.Contents.Where(filter).ToList(); 620foreach (var content in update.Contents)
ChatCompletion\ChatResponseUpdate.cs (2)
73Contents = Contents, 96/// This property concatenates the text of all <see cref="TextContent"/> objects in <see cref="Contents"/>.
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.ChatResponseUpdate.g.cs (1)
121Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponseUpdate)obj).Contents,
Microsoft.Extensions.AI.Abstractions.Tests (46)
ChatCompletion\ChatResponseUpdateTests.cs (45)
20Assert.Empty(update.Contents); 43Assert.Empty(update.Contents); 44update.Contents.Add(new TextContent("text")); 45Assert.Single(update.Contents); 47Assert.Same(update.Contents, update.Contents); 50Assert.Same(newList, update.Contents); 52Assert.NotNull(update.Contents); 53Assert.Empty(update.Contents); 101TextContent textContent = Assert.IsType<TextContent>(update.Contents[3]); 106((TextContent)update.Contents[3]).Text = "text-3"; 108Assert.Same(textContent, update.Contents[3]); 142Assert.Equal(5, result.Contents.Count); 144Assert.IsType<TextContent>(result.Contents[0]); 145Assert.Equal("text-1", ((TextContent)result.Contents[0]).Text); 147Assert.IsType<DataContent>(result.Contents[1]); 148Assert.Equal("data:image/png;base64,aGVsbG8=", ((DataContent)result.Contents[1]).Uri); 150Assert.IsType<FunctionCallContent>(result.Contents[2]); 151Assert.Equal("fc1", ((FunctionCallContent)result.Contents[2]).Name); 153Assert.IsType<DataContent>(result.Contents[3]); 154Assert.Equal("data"u8.ToArray(), ((DataContent)result.Contents[3]).Data.ToArray()); 156Assert.IsType<TextContent>(result.Contents[4]); 157Assert.Equal("text-2", ((TextContent)result.Contents[4]).Text); 206Assert.Equal(5, result.Contents.Count); 208Assert.IsType<TextContent>(result.Contents[0]); 209Assert.Equal("text-1", ((TextContent)result.Contents[0]).Text); 211Assert.IsType<DataContent>(result.Contents[1]); 212Assert.Equal("data:image/png;base64,aGVsbG8=", ((DataContent)result.Contents[1]).Uri); 214Assert.IsType<FunctionCallContent>(result.Contents[2]); 215Assert.Equal("fc1", ((FunctionCallContent)result.Contents[2]).Name); 217Assert.IsType<DataContent>(result.Contents[3]); 218Assert.Equal("data"u8.ToArray(), ((DataContent)result.Contents[3]).Data.ToArray()); 220Assert.IsType<TextContent>(result.Contents[4]); 221Assert.Equal("text-2", ((TextContent)result.Contents[4]).Text); 283Assert.Same(original.Contents, clone.Contents); 312Assert.Empty(clone.Contents); // Contents property initializes to empty list 328Assert.Empty(clone.Contents); 393Assert.Same(original.Contents, clone.Contents); 396Assert.Equal(2, original.Contents.Count); 397Assert.Equal(2, clone.Contents.Count); 438Assert.Equal(2, result.Contents.Count); 439var textContent = Assert.IsType<TextContent>(result.Contents[0]); 441var dataContent = Assert.IsType<DataContent>(result.Contents[1]);
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponseUpdate.g.cs (1)
119Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponseUpdate)obj).Contents,
Microsoft.Extensions.AI.Integration.Tests (1)
ChatClientIntegrationTests.cs (1)
149UsageContent usage = chunks.SelectMany(c => c.Contents).OfType<UsageContent>().Single();
Microsoft.Extensions.AI.OpenAI (16)
MicrosoftExtensionsAIChatExtensions.cs (3)
148var usage = update.Contents.FirstOrDefault(c => c is UsageContent) is UsageContent usageContent ? 155var toolCallUpdates = update.Contents.OfType<FunctionCallContent>().Select((fcc, index) => 165new(OpenAIChatClient.ToOpenAIChatContent(update.Contents)),
OpenAIAssistantsChatClient.cs (5)
181ruUpdate.Contents.Add(new UsageContent(new() 196ruUpdate.Contents.Add(fcc); 282if (textUpdate.Contents.Count == 0) 285textUpdate.Contents.Add(new TextContent(string.Empty)); 288(((TextContent)textUpdate.Contents[0]).Annotations ??= []).Add(new CitationAnnotation
OpenAIChatClient.cs (6)
390ConvertContentParts(update.ContentUpdate, responseUpdate.Contents); 397responseUpdate.Contents.Add(new TextReasoningContent(reasoningText)); 402responseUpdate.Contents.Add(new DataContent(audioUpdate.AudioBytesUpdate.ToMemory(), GetOutputAudioMimeType(options)) 437responseUpdate.Contents.Add(new UsageContent(FromOpenAIUsage(tokenUsage)) 469responseUpdate.Contents.Add(callContent); 477responseUpdate.Contents.Add(new ErrorContent(refusal.ToString()) { ErrorCode = "Refusal" });
OpenAIResponsesChatClient.cs (2)
523AddMcpToolCallContent(mtci, mcpUpdate.Contents); 621toolCallUpdate.Contents.Add(new ToolResultContent(outputItemDoneUpdate.Item.Id) { RawRepresentation = outputItemDoneUpdate.Item });
Microsoft.Extensions.AI.OpenAI.Tests (81)
OpenAIChatClientTests.cs (5)
255Assert.Equal(i == 10 ? 0 : 1, updates[i].Contents.Count); 259UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 1348FunctionCallContent fcc = Assert.IsType<FunctionCallContent>(Assert.Single(updates[updates.Count - 1].Contents)); 1353UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 1967string reasoningText = string.Concat(updates.SelectMany(u => u.Contents).OfType<TextReasoningContent>().Select(r => r.Text));
OpenAIConversionTests.cs (15)
1019FunctionCallContent? fcc = updates[0].Contents.OfType<FunctionCallContent>().FirstOrDefault(); 1025McpServerToolCallContent? mcpToolCallContent = updates[1].Contents.OfType<McpServerToolCallContent>().FirstOrDefault(); 1032McpServerToolResultContent? mcpToolResultContent = updates[1].Contents.OfType<McpServerToolResultContent>().FirstOrDefault(); 1039ToolApprovalRequestContent? approvalRequest = updates[2].Contents.OfType<ToolApprovalRequestContent>().FirstOrDefault(); 1050ToolApprovalResponseContent? approvalResponse = updates[3].Contents.OfType<ToolApprovalResponseContent>().FirstOrDefault(); 1066WebSearchToolCallContent? wsToolCall = updates[4].Contents.OfType<WebSearchToolCallContent>().FirstOrDefault(); 1072WebSearchToolResultContent? wsToolResult = updates[5].Contents.OfType<WebSearchToolResultContent>().FirstOrDefault(); 1078ToolCallContent? fsToolCall = updates[6].Contents.OfType<ToolCallContent>().FirstOrDefault(); 1083ToolResultContent? fsToolResult = updates[6].Contents.OfType<ToolResultContent>().FirstOrDefault(); 1089ToolCallContent? cuToolCall = updates[7].Contents.OfType<ToolCallContent>().FirstOrDefault(); 1095ToolResultContent? cuToolResult = updates[8].Contents.OfType<ToolResultContent>().FirstOrDefault(); 1101AIContent? apCallContent = updates[9].Contents.FirstOrDefault(c => c.RawRepresentation == applyPatchItem); 1106AIContent? apOutputContent = updates[10].Contents.FirstOrDefault(c => c.RawRepresentation == applyPatchOutputItem); 1142Assert.Empty(updates[0].Contents.OfType<ToolApprovalResponseContent>()); 1145AIContent? genericContent = updates[0].Contents.FirstOrDefault(c => c.RawRepresentation == mcpApprovalResponse);
OpenAIResponseClientTests.cs (61)
325Assert.Single(updates[i].Contents); 328var reasoning = Assert.IsType<TextReasoningContent>(updates[i].Contents.Single()); 335Assert.Single(updates[i].Contents); 340Assert.Empty(updates[i].Contents); 346UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 458Assert.Single(u.Contents); 460var reasoning = Assert.IsType<TextReasoningContent>(u.Contents.Single()); 465var allReasoningText = string.Concat(reasoningUpdates.Select(u => u.Contents.OfType<TextReasoningContent>().First().Text)); 473UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 567var reasoningContents = updates.SelectMany(u => u.Contents).OfType<TextReasoningContent>().ToList(); 768Assert.Equal((i >= 4 && i <= 12) || i == 16 ? 1 : 0, updates[i].Contents.Count); 777UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 1008Assert.Equal(i >= 3 ? 1 : 0, updates[i].Contents.Count); 1013ToolCallContent content = Assert.IsType<ToolCallContent>(Assert.Single(updates[3].Contents)); 1019UsageContent usage = Assert.IsType<UsageContent>(Assert.Single(updates[4].Contents)); 3148Assert.Equal((i >= 5 && i <= 13) || i == 17 ? 1 : 0, updates[i].Contents.Count); 3232Assert.Single(updates[i].Contents); 3242Assert.Empty(updates[i].Contents); 3248Assert.Single(updates[i].Contents); 3702u.Contents != null && u.Contents.Any(c => c is CodeInterpreterToolCallContent)).ToList(); 3711var content = update.Contents.OfType<CodeInterpreterToolCallContent>().First(); 3730u.Contents != null && u.Contents.Any(c => c is CodeInterpreterToolResultContent)).ToList(); 5800var refusalUpdate = updates.FirstOrDefault(u => u.Contents.Any(c => c is ErrorContent ec && ec.ErrorCode == "Refusal")); 5803var errorContent = refusalUpdate.Contents.OfType<ErrorContent>().First(); 5858var errorUpdate = updates.FirstOrDefault(u => u.Contents.Any(c => c is ErrorContent)); 5861var errorContent = errorUpdate.Contents.OfType<ErrorContent>().First(); 5901var errorUpdate = updates.FirstOrDefault(u => u.Contents.Any(c => c is ErrorContent)); 5904var errorContent = errorUpdate.Contents.OfType<ErrorContent>().First(); 5944var errorUpdate = updates.FirstOrDefault(u => u.Contents.Any(c => c is ErrorContent)); 5947var errorContent = errorUpdate.Contents.OfType<ErrorContent>().First(); 5987var annotatedUpdate = updates.FirstOrDefault(u => u.Contents.Any(c => c.Annotations?.Count > 0)); 5989Assert.NotEmpty(annotatedUpdate.Contents.First().Annotations!); 6063var functionCallUpdate = updates.FirstOrDefault(u => u.Contents.OfType<FunctionCallContent>().Any()); 6066var fcc = functionCallUpdate.Contents.OfType<FunctionCallContent>().Single(); 6071var functionResultUpdate = updates.FirstOrDefault(u => u.Contents.OfType<FunctionResultContent>().Any()); 6074var frc = functionResultUpdate.Contents.OfType<FunctionResultContent>().Single(); 6097UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 6486u.Contents != null && u.Contents.Any(c => c is ImageGenerationToolCallContent)); 6488var toolCall = toolCallUpdate.Contents.OfType<ImageGenerationToolCallContent>().First(); 6493u.Contents != null && u.Contents.Any(c => c is ImageGenerationToolResultContent result && 6499u.Contents != null && u.Contents.Any(c => c is UsageContent)); 6501var usage = completionUpdate.Contents.OfType<UsageContent>().First(); 6599u.Contents != null && u.Contents.Any(c => c is ImageGenerationToolResultContent result && 6608u.Contents.OfType<ImageGenerationToolResultContent>().Any(result => 6645u.Contents != null && u.Contents.Any(c => c is ImageGenerationToolCallContent)); 6647var toolCall = toolCallUpdate.Contents.OfType<ImageGenerationToolCallContent>().First(); 7268var wsCallUpdates = updates.Where(u => u.Contents.OfType<WebSearchToolCallContent>().Any()).ToList(); 7271var wsCallInProgress = wsCallUpdates[0].Contents.OfType<WebSearchToolCallContent>().Single(); 7276var wsCallDone = wsCallUpdates[1].Contents.OfType<WebSearchToolCallContent>().Single(); 7282var wsResultUpdate = updates.FirstOrDefault(u => u.Contents.OfType<WebSearchToolResultContent>().Any()); 7284var wsResult = wsResultUpdate.Contents.OfType<WebSearchToolResultContent>().First(); 7294var textUpdates = updates.Where(u => u.Contents.OfType<TextContent>().Any()).ToList(); 8937var functionCallUpdate = updates.FirstOrDefault(u => u.Contents.OfType<FunctionCallContent>().Any()); 8939var call = functionCallUpdate.Contents.OfType<FunctionCallContent>().Single();
Microsoft.Extensions.AI.Tests (18)
ChatCompletion\DistributedCachingChatClientTest.cs (8)
346Assert.Collection(update.Contents, 356c => Assert.IsType<FunctionCallContent>(Assert.Single(c.Contents)), 425var content = Assert.IsType<TextContent>(Assert.Single(item.Contents)); 842Assert.Equal(expectedItem.Contents.Count, actualItem.Contents.Count); 844for (var itemIndex = 0; itemIndex < expectedItem.Contents.Count; itemIndex++) 846var expectedItemItem = expectedItem.Contents[itemIndex]; 847var actualItemItem = actualItem.Contents[itemIndex];
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (6)
1503var functionCall = update.Contents.OfType<FunctionCallContent>().First(); 1585Assert.Equal("Text 1", update.Contents.OfType<TextContent>().First().Text); 1591Assert.Equal("Text 2", update.Contents.OfType<TextContent>().First().Text); 1597var approvalRequest1 = update.Contents.OfType<ToolApprovalRequestContent>().First(); 1605var approvalRequest2 = update.Contents.OfType<ToolApprovalRequestContent>().First(); 1613var approvalRequest3 = update.Contents.OfType<ToolApprovalRequestContent>().First();
ChatCompletion\ImageGeneratingChatClientTests.cs (3)
381Assert.Single(update.Contents); 383var imageToolCallContent = Assert.IsType<ImageGenerationToolCallContent>(update.Contents[0]); 508var contents = updates[0].Contents;
Generated\361d1da7f942c932\TestJsonSerializerContext.ChatResponseUpdate.g.cs (1)
119Getter = static obj => ((global::Microsoft.Extensions.AI.ChatResponseUpdate)obj).Contents,