11 writes to Text
Microsoft.Extensions.AI.Abstractions (1)
Contents\TextContent.cs (1)
21Text = text;
Microsoft.Extensions.AI.Abstractions.Tests (6)
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;
Microsoft.Extensions.AI.Integration.Tests (2)
ChatClientIntegrationTests.cs (2)
676((TextContent)message.Contents[0]).Text += "!"; 710((TextContent)message.Contents[0]).Text += "!";
Microsoft.Extensions.AI.Tests (2)
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)";
86 references to Text
Aspire.Dashboard (3)
Model\Assistant\AIHelpers.cs (3)
483if (!string.IsNullOrEmpty(item.Text)) 485responseLength += item.Text.Length; 492await textUpdateCallback(item.Text).ConfigureAwait(false);
Microsoft.Extensions.AI (3)
ChatCompletion\OpenTelemetryChatClient.cs (2)
253case TextContent tc when !string.IsNullOrWhiteSpace(tc.Text): 254m.Parts.Add(new OtelGenericPart { Content = tc.Text });
ToolReduction\EmbeddingToolReductionStrategy.cs (1)
61text = content.Text;
Microsoft.Extensions.AI.Abstractions (4)
Contents\AIContentExtensions.cs (2)
30return (list[0] as TextContent)?.Text ?? string.Empty; 50builder.Append(text.Text);
Contents\TextContent.cs (2)
35public override string ToString() => Text; 38private string DebuggerDisplay => $"Text = \"{Text}\"";
Microsoft.Extensions.AI.Abstractions.Tests (44)
ChatCompletion\ChatMessageTests.cs (6)
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);
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (18)
592Assert.Equal(expected[i], contents[i].Text); 624Assert.Equal("ABC", Assert.IsType<TextContent>(message.Contents[0]).Text); 626Assert.Equal("GH", Assert.IsType<TextContent>(message.Contents[2]).Text); 628Assert.Equal("K", Assert.IsType<TextContent>(message.Contents[4]).Text); 630Assert.Equal("MN", Assert.IsType<TextContent>(message.Contents[6]).Text); 699Assert.Equal("ABC", Assert.IsType<TextContent>(message.Contents[0]).Text); 700Assert.Equal("D", Assert.IsType<TextContent>(message.Contents[1]).Text); 701Assert.Equal("E", Assert.IsType<TextContent>(message.Contents[2]).Text); 702Assert.Equal("F", Assert.IsType<TextContent>(message.Contents[3]).Text); 703Assert.Equal("GH", Assert.IsType<TextContent>(message.Contents[4]).Text); 704Assert.Equal("I", Assert.IsType<TextContent>(message.Contents[5]).Text); 705Assert.Equal("J", Assert.IsType<TextContent>(message.Contents[6]).Text); 706Assert.Equal("K", Assert.IsType<TextContent>(message.Contents[7]).Text); 707Assert.Equal("L", Assert.IsType<TextContent>(message.Contents[8]).Text); 708Assert.Equal("MN", Assert.IsType<TextContent>(message.Contents[9]).Text); 709Assert.Equal("O", Assert.IsType<TextContent>(message.Contents[10]).Text); 710Assert.Equal("P", Assert.IsType<TextContent>(message.Contents[11]).Text); 730Assert.Equal("Hello, world!", Assert.IsType<TextContent>(Assert.Single(Assert.Single(response.Messages).Contents)).Text);
ChatCompletion\ChatResponseUpdateTests.cs (3)
102Assert.Equal("text-1", textContent.Text); 143Assert.Equal("text-1", ((TextContent)result.Contents[0]).Text); 155Assert.Equal("text-2", ((TextContent)result.Contents[4]).Text);
Contents\CodeInterpreterToolCallContentTests.cs (1)
89Assert.Equal("print('hello')", ((TextContent)deserializedSut.Inputs[0]).Text);
Contents\CodeInterpreterToolResultContentTests.cs (1)
91Assert.Equal("Hello, World!", ((TextContent)deserializedSut.Outputs[0]).Text);
Contents\TextContentTests.cs (7)
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);
SpeechToText\SpeechToTextResponseTests.cs (5)
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);
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 (1)
72Assert.Equal("text-1", textContent.Text);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
510parts.Add(new ChatMessageTextContentItem(textContent.Text));
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (2)
ScenarioRunResultTests.cs (2)
369return 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 (3)
ChatClientIntegrationTests.cs (2)
180Assert.NotEmpty(singleTextContent.Text); 181Assert.Equal(history[1].Text, singleTextContent.Text);
ReducingChatClientTests.cs (1)
102sum += _tokenizer.CountTokens(text.Text);
Microsoft.Extensions.AI.OpenAI (5)
OpenAIAssistantsChatClient.cs (2)
520AppendSystemInstructions(textContent.Text); 535messageContents.Add(MessageContent.FromText(text.Text));
OpenAIChatClient.cs (1)
279return ChatMessageContentPart.CreateTextPart(textContent.Text);
OpenAIResponsesChatClient.cs (2)
813(parts ??= []).Add(ResponseContentPart.CreateInputTextPart(textContent.Text)); 916yield return ResponseItem.CreateAssistantMessageItem(textContent.Text);
Microsoft.Extensions.AI.OpenAI.Tests (13)
OpenAIAssistantChatClientIntegrationTests.cs (1)
96Assert.NotEmpty(resultOutput.Text);
OpenAIConversionTests.cs (3)
620Assert.Equal("Hello, world!", Assert.IsType<TextContent>(message.Contents[0], exactMatch: false).Text); 651Assert.Equal("Hello, world!", Assert.IsType<TextContent>(message.Contents[0], exactMatch: false).Text); 768Assert.Equal("I'll call a function.", textContent.Text);
OpenAIResponseClientIntegrationTests.cs (2)
64Assert.NotEmpty(resultOutput.Text); 425Assert.Equal(@"{""events"": [], ""next_page_token"": null}", content.Text);
OpenAIResponseClientTests.cs (7)
1093Assert.StartsWith("The `README.md` file for `Microsoft.Extensions.AI.Abstractions` is located at", Assert.IsType<TextContent>(Assert.Single(result.Output)).Text); 1348Assert.StartsWith("Available pages for dotnet/extensions", Assert.IsType<TextContent>(Assert.Single(firstResult.Output)).Text); 1361Assert.StartsWith("The `README.md` file for `Microsoft.Extensions.AI.Abstractions` is located at", Assert.IsType<TextContent>(Assert.Single(secondResult.Output)).Text); 1762Assert.StartsWith("Available pages for dotnet/extensions", Assert.IsType<TextContent>(Assert.Single(firstResult.Output)).Text); 1775Assert.StartsWith("The path to the `README.md` file", Assert.IsType<TextContent>(Assert.Single(secondResult.Output)).Text); 2369Assert.Equal("15", textContent.Text); 2590Assert.Equal("The sum of numbers from 1 to 10 is 55.", textContent.Text);
Microsoft.Extensions.AI.Tests (6)
ChatCompletion\DistributedCachingChatClientTest.cs (3)
346c => Assert.Equal("This becomes one chunk", Assert.IsType<TextContent>(c).Text), 348c => Assert.Equal("... and this becomes another one.", Assert.IsType<TextContent>(c).Text)); 425Assert.Equal("Hello world, how are you?", content.Text);
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (2)
806Assert.Equal("Text 1", update.Contents.OfType<TextContent>().First().Text); 812Assert.Equal("Text 2", update.Contents.OfType<TextContent>().First().Text);
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
790m => Assert.Equal("OK bye", Assert.IsType<TextContent>(Assert.Single(m.Contents)).Text));