175 references to Text
DotNetInvocationHostedAgent (1)
EchoAIAgent.cs (1)
69
return message.
Text
?? string.Empty;
Microsoft.Extensions.AI (2)
ChatCompletion\ChatResponse{T}.cs (1)
126
var json = Messages.Count > 0 ? Messages[Messages.Count - 1].
Text
: string.Empty;
ChatRouting\SemanticRoutingChatClient.cs (1)
178
static message => message.Role == ChatRole.User)?.
Text
;
Microsoft.Extensions.AI.Abstractions (6)
ChatCompletion\ChatMessage.cs (2)
106
public override string ToString() =>
Text
;
114
string text =
Text
;
ChatCompletion\ChatResponse.cs (1)
57
/// This property concatenates the <see cref="ChatMessage.
Text
"/> of all <see cref="ChatMessage"/>
Contents\AIContentExtensions.cs (3)
62
/// <summary>Concatenates the <see cref="ChatMessage.
Text
"/> of all <see cref="ChatMessage"/> instances in the list.</summary>
73
return messages[0].
Text
;
81
string text = messages[i].
Text
;
Microsoft.Extensions.AI.Abstractions.Tests (54)
AssertExtensions.cs (2)
27
Assert.Equal(expectedMessage.
Text
, chatMessage.
Text
);
ChatCompletion\ChatClientExtensionsTests.cs (2)
113
Assert.Equal("hello", m.
Text
);
140
Assert.Equal("hello", m.
Text
);
ChatCompletion\ChatMessageTests.cs (9)
22
Assert.Empty(message.
Text
);
65
Assert.Empty(message.
Text
);
69
Assert.Empty(message.
Text
);
73
Assert.Empty(message.
Text
);
77
Assert.Empty(message.
Text
);
101
Assert.Empty(message.
Text
);
112
Assert.Equal(string.Concat(Enumerable.Range(0, messageCount).Select(i => $"text-{i}")), message.
Text
);
156
Assert.Equal("text-1text-2", message.
Text
);
161
Assert.Equal("text-3text-2", message.
Text
);
ChatCompletion\ChatResponseTests.cs (3)
105
Assert.Equal("the message", result.Messages.Single().
Text
);
143
Assert.Equal("the message", result.Messages.Single().
Text
);
205
Assert.Equal("the message", result.Messages[0].
Text
);
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (38)
96
Assert.Equal("!a", response.Messages[0].
Text
);
99
Assert.Equal("b", response.Messages[1].
Text
);
102
Assert.Equal("cd", response.Messages[2].
Text
);
105
Assert.Equal("e", response.Messages[3].
Text
);
108
Assert.Equal("fg", response.Messages[4].
Text
);
111
Assert.Equal("h", response.Messages[5].
Text
);
114
Assert.Equal("i", response.Messages[6].
Text
);
117
Assert.Equal("jkl", response.Messages[7].
Text
);
120
Assert.Equal("m", response.Messages[8].
Text
);
160
Assert.Equal("Hello from Alice!", response.Messages[0].
Text
);
164
Assert.Equal("Hi from Bob!", response.Messages[1].
Text
);
168
Assert.Equal("Greetings from Charlie!", response.Messages[2].
Text
);
172
Assert.Equal("Alice again! Still Alice. And more.", response.Messages[3].
Text
);
210
Assert.Equal("AB", response.Messages[0].
Text
);
215
Assert.Equal("C", response.Messages[1].
Text
);
220
Assert.Equal("DE", response.Messages[2].
Text
);
225
Assert.Equal("F", response.Messages[3].
Text
);
230
Assert.Equal("GH", response.Messages[4].
Text
);
266
Assert.Equal("Hello world! How are you?", message.
Text
);
297
Assert.Equal("Hello there I'm Bob speaking", response.Messages[0].
Text
);
301
Assert.Equal("Now Alice", response.Messages[1].
Text
);
332
Assert.Equal("Hello there from AI", response.Messages[0].
Text
);
336
Assert.Equal("Next message", response.Messages[1].
Text
);
369
Assert.Equal("Hello world! How are you?", message.
Text
);
400
Assert.Equal("Hello there from AI", response.Messages[0].
Text
);
404
Assert.Equal("User message", response.Messages[1].
Text
);
437
Assert.Equal("Hello from agent1", response.Messages[0].
Text
);
440
Assert.Equal("Hi from agent2", response.Messages[1].
Text
);
443
Assert.Equal("Assistant here", response.Messages[2].
Text
);
476
Assert.Equal("First message part 2", msg1.
Text
);
484
Assert.Equal("Second message part 2", msg2.
Text
);
492
Assert.Equal("Third message", msg3.
Text
);
575
Assert.Equal("Hi! Hello from AI", message1.
Text
);
583
Assert.Equal("More text", message2.
Text
);
591
Assert.Equal("How are you?", message3.
Text
);
599
Assert.Equal("I'm doing well, thank you! How can I help?", message4.
Text
);
863
Assert.Equal("abcdefgh", response.Messages[0].
Text
);
912
Assert.Equal("ab", response.Messages[0].
Text
);
Microsoft.Extensions.AI.Evaluation (3)
ChatMessageExtensions.cs (3)
99
/// This function only considers the <see cref="ChatMessage.
Text
"/> and ignores any <see cref="AIContent"/>s
124
string? content = message.
Text
;
138
/// This function only considers the <see cref="ChatMessage.
Text
"/> and ignores any <see cref="AIContent"/>s
Microsoft.Extensions.AI.Evaluation.Quality (3)
RelevanceEvaluator.cs (1)
79
if (!messages.TryGetUserRequest(out ChatMessage? userRequest) || string.IsNullOrWhiteSpace(userRequest.
Text
))
RelevanceTruthAndCompletenessEvaluator.cs (1)
100
string.IsNullOrWhiteSpace(userRequest.
Text
))
RetrievalEvaluator.cs (1)
84
if (!messages.TryGetUserRequest(out ChatMessage? userRequest) || string.IsNullOrWhiteSpace(userRequest.
Text
))
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (4)
ScenarioRunResultTests.cs (3)
414
=> x?.AuthorName == y?.AuthorName && x?.Role == y?.Role && x?.
Text
== y?.
Text
;
417
=> obj.
Text
.GetHashCode();
SerializationChainingTests.cs (1)
47
Assert.Equal("A user message", resp.ModelResponse.Messages[0].
Text
);
Microsoft.Extensions.AI.Evaluation.Safety (6)
ContentSafetyChatClient.cs (2)
58
string payload = messages.Single().
Text
;
91
string payload = messages.Single().
Text
;
ContentSafetyServicePayloadUtilities.cs (4)
112
item.Add(new XElement(questionElementName, question.
Text
));
117
item.Add(new XElement(answerElementName, answer.
Text
));
204
item[questionPropertyName] = question.
Text
;
209
item[answerPropertyName] = answer.
Text
;
Microsoft.Extensions.AI.Integration.Tests (20)
ChatClientIntegrationTests.cs (18)
171
Assert.Equal(history[1].
Text
, singleTextContent.Text);
663
Assert.Equal(firstResponse.Messages.Select(m => m.
Text
), secondResponse.Messages.Select(m => m.
Text
));
1156
Assert.Contains("Alice", m.
Text
);
1158
m => Assert.StartsWith("I hiked the section", m.
Text
, StringComparison.Ordinal),
1159
m => Assert.StartsWith("The Sierra Nevada section", m.
Text
, StringComparison.Ordinal),
1160
m => Assert.StartsWith("What's my name", m.
Text
, StringComparison.Ordinal));
1199
Assert.Equal("You are a pirate. Always respond in pirate speak.", m.
Text
);
1202
m => Assert.StartsWith("Aye, ye best be bringin'", m.
Text
, StringComparison.Ordinal),
1203
m => Assert.Equal("What's 2 + 2?", m.
Text
));
1297
Assert.Contains("Bob", m.
Text
);
1299
m => Assert.StartsWith("Personalized learning", m.
Text
, StringComparison.Ordinal),
1300
m => Assert.Equal("Was anyone named in the conversation? Provide their name and job.", m.
Text
));
1340
summaryMessage.
Text
.IndexOf("3", StringComparison.Ordinal) >= 0 ||
1341
summaryMessage.
Text
.IndexOf("5", StringComparison.Ordinal) >= 0 ||
1342
summaryMessage.
Text
.IndexOf("200", StringComparison.Ordinal) >= 0 ||
1343
summaryMessage.
Text
.IndexOf("10", StringComparison.Ordinal) >= 0,
1344
$"Expected numbers in summary: {summaryMessage.
Text
}");
ReducingChatClientTests.cs (2)
32
m => Assert.StartsWith("Golden retrievers are quite active", m.
Text
, StringComparison.Ordinal),
33
m => Assert.StartsWith("Are they good with kids?", m.
Text
, StringComparison.Ordinal));
Microsoft.Extensions.AI.OpenAI (1)
OpenAIResponsesChatClient.cs (1)
1306
string text = input.
Text
;
Microsoft.Extensions.AI.OpenAI.Tests (21)
OpenAIChatClientTests.cs (4)
1791
Assert.Equal("You are a helpful assistant", extMessages[0].
Text
);
1802
Assert.Equal("Hello", extMessages[0].
Text
);
1813
Assert.Equal("Hi there!", extMessages[0].
Text
);
1824
Assert.Equal("Developer instructions", extMessages[0].
Text
);
OpenAIConversionTests.cs (4)
1174
Assert.Equal("You are a helpful assistant.", convertedMessages[0].
Text
);
1175
Assert.Equal("Hello", convertedMessages[1].
Text
);
1176
Assert.Equal("Hi there!", convertedMessages[2].
Text
);
1202
Assert.Equal("Hi there!", message.
Text
);
OpenAIResponseClientIntegrationTests.cs (1)
46
Assert.Equal("6", message.
Text
);
OpenAIResponseClientTests.cs (10)
1482
Assert.Equal("Hello!", response.Messages[0].
Text
);
1484
Assert.Equal(" How can I assist you today?", response.Messages[1].
Text
);
1735
Assert.Equal("The `README.md` file for `Microsoft.Extensions.AI.Abstractions` is located at:\n\n```\nsrc/Libraries/Microsoft.Extensions.AI.Abstractions/README.md\n```\n\nThis file provides an overview of the `Microsoft.Extensions.AI.Abstractions` package, including installation instructions and usage examples for its core interfaces like `IChatClient` and `IEmbeddingGenerator`.", response.Messages[0].
Text
);
1879
Assert.Equal("Hello! How can I help?", message.
Text
);
2112
Assert.Equal("The `README.md` file for `Microsoft.Extensions.AI.Abstractions` is located at:\n\n```\nsrc/Libraries/Microsoft.Extensions.AI.Abstractions/README.md\n```\n\nThis file includes an overview, installation instructions, and usage examples related to the package.", response.Messages[0].
Text
);
2523
Assert.StartsWith("The path to the `README.md` file", response.Messages[0].
Text
);
2732
Assert.Equal("The tool encountered an error during execution.", response.Messages[0].
Text
);
2835
Assert.Equal("Hi!", message.
Text
);
6389
Assert.Equal("This is a cat.", assistantMessage.
Text
);
6452
Assert.Equal("This is a red pixel.", assistantMessage.
Text
);
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
27
Assert.Equal(expectedMessage.
Text
, chatMessage.
Text
);
Microsoft.Extensions.AI.Tests (54)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (9)
69
message => Assert.Equal("Hello", message.
Text
));
93
Assert.Equal("Hello", Assert.Single(chatHistory).
Text
);
120
message => Assert.Equal("Hello", message.
Text
),
124
Assert.Contains("Respond with a JSON value", message.
Text
);
125
Assert.Contains("https://json-schema.org/draft/2020-12/schema", message.
Text
);
128
Assert.Contains(v.ToString(), message.
Text
); // All enum values are described as strings
154
Assert.Equal("Hello", Assert.Single(chatHistory).
Text
);
324
Assert.Equal("Hello", Assert.Single(chatHistory).
Text
);
352
Assert.Equal("Hello", Assert.Single(chatHistory).
Text
);
ChatCompletion\DistributedCachingChatClientTest.cs (2)
807
Assert.Equal(expectedMessage.
Text
, actualMessage.
Text
);
ChatCompletion\FunctionInvokingChatClientTests.cs (1)
1188
if (chatContents.Last().
Text
== "Hello")
ChatCompletion\ImageGeneratingChatClientTests.cs (1)
56
Assert.Equal("test response", response.Messages[0].
Text
);
ChatReduction\MessageCountingChatReducerTests.cs (12)
67
Assert.Equal("You are a helpful assistant.", m.
Text
);
72
Assert.Equal("How are you?", m.
Text
);
77
Assert.Equal("I'm doing well, thanks!", m.
Text
);
103
Assert.Equal("First system message", m.
Text
);
108
Assert.Equal("How are you?", m.
Text
);
113
Assert.Equal("I'm fine!", m.
Text
);
142
Assert.Equal("Thanks!", m.
Text
);
149
Assert.Equal("You're welcome!", m.
Text
);
187
Assert.Equal($"Message {expectedIndex}", m.
Text
);
212
Assert.Equal("System prompt", m.
Text
);
255
Assert.Equal("System", m.
Text
);
260
Assert.Equal("Fourth", m.
Text
);
ChatReduction\SummarizingChatReducerTests.cs (27)
83
Assert.Equal("You are a helpful assistant.", resultList[0].
Text
);
119
m => Assert.Contains("Asked about time", m.
Text
),
127
m => Assert.Contains("sunny", m.
Text
));
166
Assert.Contains("Summary", resultList[0].
Text
);
170
m => Assert.Contains("Second question", m.
Text
),
171
m => Assert.Contains("Second answer", m.
Text
),
172
m => Assert.Contains("Third question", m.
Text
),
173
m => Assert.Contains("Third answer", m.
Text
));
204
Assert.Contains(msgList, m => m.
Text
.Contains("What's the weather in Seattle?"));
205
Assert.Contains(msgList, m => m.
Text
.Contains("sunny and 72°F in Seattle"));
206
Assert.Contains(msgList, m => m.
Text
.Contains("What about New York?"));
218
Assert.Contains("User asked about weather", resultList[0].
Text
);
225
Assert.DoesNotContain(resultList, m => m.
Text
.Contains("sunny and 72°F in Seattle"));
260
Assert.StartsWith("Summary", resultList[0].
Text
, StringComparison.Ordinal);
316
Assert.Equal("First system message", resultList[0].
Text
);
341
m => Assert.StartsWith("Hi there!", m.
Text
, StringComparison.Ordinal),
342
m => Assert.StartsWith("Of course!", m.
Text
, StringComparison.Ordinal),
343
m => Assert.StartsWith("What kind of exercise", m.
Text
, StringComparison.Ordinal),
357
m => Assert.StartsWith("The user asked for information", m.
Text
, StringComparison.Ordinal),
358
m => Assert.StartsWith("Golden retrievers are quite", m.
Text
, StringComparison.Ordinal),
359
m => Assert.StartsWith("Are they good with kids", m.
Text
, StringComparison.Ordinal));
368
m => Assert.StartsWith("The user asked", m.
Text
, StringComparison.Ordinal),
369
m => Assert.StartsWith("Golden retrievers are quite active", m.
Text
, StringComparison.Ordinal),
370
m => Assert.StartsWith("Are they good with kids", m.
Text
, StringComparison.Ordinal),
383
m => Assert.StartsWith("The user and assistant are discussing", m.
Text
, StringComparison.Ordinal),
384
m => Assert.StartsWith("Golden retrievers get along", m.
Text
, StringComparison.Ordinal),
385
m => Assert.StartsWith("Do they make good lap dogs", m.
Text
, StringComparison.Ordinal));
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (2)
27
Assert.Equal(expectedMessage.
Text
, chatMessage.
Text
);