17 writes to Text
Microsoft.Extensions.AI.Abstractions (2)
Contents\TextContent.cs (1)
21Text = text;
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.TextContent.g.cs (1)
61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.TextContent)obj).Text = value!,
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatMessageTests.cs (2)
159((TextContent)message.Contents[3]).Text = "text-3"; 281((TextContent)chatMessage.Contents[0]).Text = "content-1-override"; // Override the content of the first text content item that has the "content-1" content
ChatCompletion\ChatResponseUpdateTests.cs (1)
106((TextContent)update.Contents[3]).Text = "text-3";
Contents\TextContentTests.cs (3)
39c.Text = "text"; 43c.Text = null; 47c.Text = string.Empty;
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.TextContent.g.cs (1)
59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.TextContent)obj).Text = value!,
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.TextContent.g.cs (1)
61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.TextContent)obj).Text = value!,
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.TextContent.g.cs (1)
61Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.TextContent)obj).Text = value!,
Microsoft.Extensions.AI.Integration.Tests (2)
ChatClientIntegrationTests.cs (2)
667((TextContent)message.Contents[0]).Text += "!"; 701((TextContent)message.Contents[0]).Text += "!";
Microsoft.Extensions.AI.Stabilization.Tests (1)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.TextContent.g.cs (1)
59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.TextContent)obj).Text = value!,
Microsoft.Extensions.AI.Tests (3)
ChatCompletion\UseDelegateChatClientTests.cs (2)
103cc.Messages.SelectMany(c => c.Contents).OfType<TextContent>().Last().Text += " world"; 206cc.Messages.SelectMany(c => c.Contents).OfType<TextContent>().Last().Text += " world (non-streaming)";
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.TextContent.g.cs (1)
59Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.TextContent)obj).Text = value!,
122 references to Text
Aspire.Dashboard (3)
Model\Assistant\AIHelpers.cs (3)
336if (!string.IsNullOrEmpty(item.Text)) 338responseLength += item.Text.Length; 345await textUpdateCallback(item.Text).ConfigureAwait(false);
Microsoft.AspNetCore.Components.AI (1)
Pipeline\TextBlockHandler.cs (1)
36state.AppendText(textContent.Text ?? string.Empty);
Microsoft.Extensions.AI (6)
Common\OtelMessageSerializer.cs (4)
69case TextContent tc when !string.IsNullOrWhiteSpace(tc.Text): 70m.Parts.Add(new OtelGenericPart { Content = tc.Text }); 297if (input is TextContent tc && !string.IsNullOrEmpty(tc.Text)) 299return tc.Text;
Realtime\OpenTelemetryRealtimeClientSession.cs (2)
530case TextContent tc when !string.IsNullOrEmpty(tc.Text): 531message.Parts.Add(new OtelGenericPart { Content = tc.Text });
Microsoft.Extensions.AI.Abstractions (5)
Contents\AIContentExtensions.cs (2)
30return (list[0] as TextContent)?.Text ?? string.Empty; 39builder.AppendLiteral(text.Text);
Contents\TextContent.cs (2)
35public override string ToString() => Text; 38private string DebuggerDisplay => $"Text = \"{Text}\"";
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.TextContent.g.cs (1)
60Getter = static obj => ((global::Microsoft.Extensions.AI.TextContent)obj).Text,
Microsoft.Extensions.AI.Abstractions.Tests (57)
ChatCompletion\ChatMessageTests.cs (7)
49Assert.Equal(text, tc.Text); 109Assert.Equal($"text-{i}", tc.Text); 155Assert.Equal("text-1", textContent.Text); 160Assert.Equal("text-3", textContent.Text); 298Assert.Equal("content-1-override", textContent.Text); 321Assert.Equal("content-4", textContent.Text); 385Assert.Equal("Hello, world!", textContent.Text);
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (19)
678Assert.Equal(expected[i], contents[i].Text); 710Assert.Equal("ABC", Assert.IsType<TextContent>(message.Contents[0]).Text); 712Assert.Equal("GH", Assert.IsType<TextContent>(message.Contents[2]).Text); 714Assert.Equal("K", Assert.IsType<TextContent>(message.Contents[4]).Text); 716Assert.Equal("MN", Assert.IsType<TextContent>(message.Contents[6]).Text); 785Assert.Equal("ABC", Assert.IsType<TextContent>(message.Contents[0]).Text); 786Assert.Equal("D", Assert.IsType<TextContent>(message.Contents[1]).Text); 787Assert.Equal("E", Assert.IsType<TextContent>(message.Contents[2]).Text); 788Assert.Equal("F", Assert.IsType<TextContent>(message.Contents[3]).Text); 789Assert.Equal("GH", Assert.IsType<TextContent>(message.Contents[4]).Text); 790Assert.Equal("I", Assert.IsType<TextContent>(message.Contents[5]).Text); 791Assert.Equal("J", Assert.IsType<TextContent>(message.Contents[6]).Text); 792Assert.Equal("K", Assert.IsType<TextContent>(message.Contents[7]).Text); 793Assert.Equal("L", Assert.IsType<TextContent>(message.Contents[8]).Text); 794Assert.Equal("MN", Assert.IsType<TextContent>(message.Contents[9]).Text); 795Assert.Equal("O", Assert.IsType<TextContent>(message.Contents[10]).Text); 796Assert.Equal("P", Assert.IsType<TextContent>(message.Contents[11]).Text); 816Assert.Equal("Hello, world!", Assert.IsType<TextContent>(Assert.Single(Assert.Single(response.Messages).Contents)).Text); 957Assert.IsType<TextContent>(message.Contents[0]).Text);
ChatCompletion\ChatResponseUpdateTests.cs (6)
102Assert.Equal("text-1", textContent.Text); 145Assert.Equal("text-1", ((TextContent)result.Contents[0]).Text); 157Assert.Equal("text-2", ((TextContent)result.Contents[4]).Text); 209Assert.Equal("text-1", ((TextContent)result.Contents[0]).Text); 221Assert.Equal("text-2", ((TextContent)result.Contents[4]).Text); 440Assert.Equal("text-1", textContent.Text);
Contents\CodeInterpreterToolCallContentTests.cs (2)
85Assert.Equal("print('hello')", ((TextContent)deserializedSut.Inputs[0]).Text); 117Assert.Equal("print('hello')", textInput.Text);
Contents\CodeInterpreterToolResultContentTests.cs (2)
87Assert.Equal("Hello, World!", ((TextContent)deserializedSut.Outputs[0]).Text); 119Assert.Equal("hello", textOutput.Text);
Contents\McpServerToolResultContentTests.cs (2)
75Assert.Equal("result", Assert.IsType<TextContent>(Assert.Single(deserializedContent.Outputs)).Text); 106Assert.Equal("output text", textOutput.Text);
Contents\TextContentTests.cs (8)
20Assert.Equal(text ?? string.Empty, c.Text); 38Assert.Equal(string.Empty, c.Text); 40Assert.Equal("text", c.Text); 44Assert.Equal(string.Empty, c.Text); 48Assert.Equal(string.Empty, c.Text); 61Assert.Equal(content.Text, deserializedContent.Text); 81Assert.Equal("Hello, world!", textContent.Text);
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.TextContent.g.cs (1)
58Getter = static obj => ((global::Microsoft.Extensions.AI.TextContent)obj).Text,
SpeechToText\SpeechToTextResponseTests.cs (6)
53Assert.Equal(text, tc.Text); 93Assert.Equal($"text-{i}", tc.Text); 173Assert.Equal($"Text{i + 1}", ((TextContent)result.Contents[i]).Text); 236Assert.Equal("Hello, ", Assert.IsType<TextContent>(update.Contents[0]).Text); 238Assert.Equal("world!", Assert.IsType<TextContent>(update.Contents[2]).Text); 287Assert.Equal("Hello world", textContent.Text);
SpeechToText\SpeechToTextResponseUpdateExtensionsTests.cs (2)
130Assert.Equal(expected[i], contents[i].Text); 153Assert.Equal("Hello, world!", Assert.IsType<TextContent>(Assert.Single(response.Contents)).Text);
SpeechToText\SpeechToTextResponseUpdateTests.cs (2)
72Assert.Equal("text-1", textContent.Text); 146Assert.Equal("Hello world", textContent.Text);
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.TextContent.g.cs (1)
60Getter = static obj => ((global::Microsoft.Extensions.AI.TextContent)obj).Text,
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.TextContent.g.cs (1)
60Getter = static obj => ((global::Microsoft.Extensions.AI.TextContent)obj).Text,
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (2)
ScenarioRunResultTests.cs (2)
485return xText.Text == yText.Text;
Microsoft.Extensions.AI.Evaluation.Safety (2)
ContentSafetyEvaluator.cs (1)
114string.Join(Environment.NewLine, textContents.Select(c => c.Text)) is string contextString &&
ContentSafetyServicePayloadUtilities.cs (1)
325["text"] = textContent.Text
Microsoft.Extensions.AI.Integration.Tests (7)
ChatClientIntegrationTests.cs (2)
170Assert.NotEmpty(singleTextContent.Text); 171Assert.Equal(history[1].Text, singleTextContent.Text);
ImageGeneratingChatClientIntegrationTests.cs (4)
101Assert.DoesNotContain(ImageKey, textContent.Text, StringComparison.OrdinalIgnoreCase); 105Assert.DoesNotContain(imageId, textContent.Text, StringComparison.OrdinalIgnoreCase); 395Assert.Contains(textContents, tc => tc.Text.Contains(ImageKey) && tc.Text.Contains("] available for edit"));
ReducingChatClientTests.cs (1)
102sum += _tokenizer.CountTokens(text.Text);
Microsoft.Extensions.AI.OpenAI (7)
OpenAIAssistantsChatClient.cs (2)
524AppendSystemInstructions(textContent.Text); 539messageContents.Add(MessageContent.FromText(text.Text));
OpenAIChatClient.cs (1)
296return ChatMessageContentPart.CreateTextPart(textContent.Text);
OpenAIRealtimeClientSession.cs (1)
670contentParts.Add(new Sdk.RealtimeInputTextMessageContentPart(textContent.Text ?? string.Empty));
OpenAIResponsesChatClient.cs (3)
1348(parts ??= []).Add(ResponseContentPart.CreateInputTextPart(textContent.Text)); 1427Text = tc.Text 1545yield return ResponseItem.CreateAssistantMessageItem(textContent.Text);
Microsoft.Extensions.AI.OpenAI.Tests (18)
OpenAIAssistantChatClientIntegrationTests.cs (1)
97Assert.NotEmpty(resultOutput.Text);
OpenAIChatClientTests.cs (1)
1918Assert.Equal("9.8 is larger.", text.Text);
OpenAIConversionTests.cs (4)
908Assert.Equal("Hello, world!", Assert.IsType<TextContent>(message.Contents[0], exactMatch: false).Text); 939Assert.Equal("Hello, world!", Assert.IsType<TextContent>(message.Contents[0], exactMatch: false).Text); 1236Assert.Equal("I'll call a function.", textContent.Text); 1306Assert.Equal("Hello from the assistant!", textContent.Text);
OpenAIResponseClientIntegrationTests.cs (2)
72Assert.NotEmpty(resultOutput.Text); 556Assert.Equal(@"{""events"": [], ""next_page_token"": null}", content.Text);
OpenAIResponseClientTests.cs (10)
1644Assert.StartsWith("The `README.md` file for `Microsoft.Extensions.AI.Abstractions` is located at", Assert.IsType<TextContent>(Assert.Single(result.Outputs!)).Text); 2020Assert.StartsWith("Available pages for dotnet/extensions", Assert.IsType<TextContent>(Assert.Single(firstResult.Outputs!)).Text); 2032Assert.StartsWith("The `README.md` file for `Microsoft.Extensions.AI.Abstractions` is located at", Assert.IsType<TextContent>(Assert.Single(secondResult.Outputs!)).Text); 2431Assert.StartsWith("Available pages for dotnet/extensions", Assert.IsType<TextContent>(Assert.Single(firstResult.Outputs!)).Text); 2443Assert.StartsWith("The path to the `README.md` file", Assert.IsType<TextContent>(Assert.Single(secondResult.Outputs!)).Text); 3406Assert.Equal("15", textContent.Text); 3626Assert.Equal("The sum of numbers from 1 to 10 is 55.", textContent.Text); 6094Assert.Equal("It's 25°C and sunny in Paris.", textContent.Text); 7160Assert.Equal(".NET 10 was officially released in November 2025 as an LTS release.", textContent.Text); 7312Assert.Equal(".NET 10 was officially released.", textContent.Text);
Microsoft.Extensions.AI.Stabilization.Tests (5)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.TextContent.g.cs (1)
58Getter = static obj => ((global::Microsoft.Extensions.AI.TextContent)obj).Text,
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolCallContentTests.cs (2)
85Assert.Equal("print('hello')", ((TextContent)deserializedSut.Inputs[0]).Text); 117Assert.Equal("print('hello')", textInput.Text);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolResultContentTests.cs (2)
87Assert.Equal("Hello, World!", ((TextContent)deserializedSut.Outputs[0]).Text); 119Assert.Equal("hello", textOutput.Text);
Microsoft.Extensions.AI.Tests (7)
ChatCompletion\DistributedCachingChatClientTest.cs (3)
347c => Assert.Equal("This becomes one chunk", Assert.IsType<TextContent>(c).Text), 349c => Assert.Equal("... and this becomes another one.", Assert.IsType<TextContent>(c).Text)); 426Assert.Equal("Hello world, how are you?", content.Text);
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (2)
1585Assert.Equal("Text 1", update.Contents.OfType<TextContent>().First().Text); 1591Assert.Equal("Text 2", update.Contents.OfType<TextContent>().First().Text);
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
1222m => Assert.Equal("OK bye", Assert.IsType<TextContent>(Assert.Single(m.Contents)).Text));
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.TextContent.g.cs (1)
58Getter = static obj => ((global::Microsoft.Extensions.AI.TextContent)obj).Text,