You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove the abstraction for token counting from the main evaluation API (#6320)
This change is being made because there is still some uncertainty around what a general-purpose token counting abstraction (that supports all kinds of future models, and all kinds of input modalities) should look like at the moment. We do not want to bake in an API that only supports text-based inputs for the models and use cases that are prevalent today, since it would be a potential breaking change to change this API after we release a stable version of the evaluation APIs.
We can always reintroduce the token counting support in a non-breaking fashion in the future if and when there is more clarity on what a general-purpose token counting abstraction should look like, or if and when a general-purpose token counting abstraction is introduced in a lower layer (Microsoft.Extensions.AI) in the future.
In the meanwhile, callers should still be able to use the `Microsoft.ML.Tokenizers` library directly to count tokens in text-based content and trim down the conversation history before calling `EvaluateAsync()` if needed.
Fixes#6234
#pragma warning disable S103// Lines should not be too long
178
-
result.AddDiagnosticsToAllMetrics(
179
-
EvaluationDiagnostic.Warning(
180
-
$"The evaluation may be inconclusive because the oldest {ignoredMessagesCount} messages in the supplied conversation history were ignored in order to stay under the specified limit of {inputTokenLimit} input tokens."));
181
-
#pragma warning restore S103
182
-
}
183
-
184
83
returnresult;
185
84
}
186
85
187
-
/// <summary>
188
-
/// Determines if there is sufficient <paramref name="tokenBudget"/> remaining to render the
189
-
/// supplied <paramref name="message"/> as part of the evaluation prompt that this <see cref="IEvaluator"/> uses.
190
-
/// </summary>
191
-
/// <param name="message">
192
-
/// A message that is part of the conversation history for the response being evaluated and that is to be rendered
193
-
/// as part of the evaluation prompt.
194
-
/// </param>
195
-
/// <param name="tokenBudget">
196
-
/// The number of tokens available for the rendering additional content as part of the evaluation prompt.
197
-
/// </param>
198
-
/// <param name="chatConfiguration">
199
-
/// A <see cref="ChatConfiguration"/> that specifies the <see cref="IChatClient"/> and the
200
-
/// <see cref="IEvaluationTokenCounter"/> that this <see cref="IEvaluator"/> uses to perform the evaluation.
201
-
/// </param>
202
-
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can cancel the operation.</param>
203
-
/// <returns>
204
-
/// A tuple containing a <see langword="bool"/> indicating whether there is sufficient
205
-
/// <paramref name="tokenBudget"/> remaining to render the supplied <paramref name="message"/> as part of the
206
-
/// evaluation prompt, and an <see langword="int"/> containing the remaining token budget that would be available
207
-
/// once this <paramref name="message"/> is rendered.
Copy file name to clipboardExpand all lines: src/Libraries/Microsoft.Extensions.AI.Evaluation.Reporting.Azure/Storage/AzureStorageReportingConfiguration.cs
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -29,10 +29,9 @@ public static class AzureStorageReportingConfiguration
29
29
/// survive in the cache before they are considered expired and evicted.
30
30
/// </param>
31
31
/// <param name="chatConfiguration">
32
-
/// A <see cref="ChatConfiguration"/> that specifies the <see cref="IChatClient"/> and the
33
-
/// <see cref="IEvaluationTokenCounter"/> that are used by AI-based <paramref name="evaluators"/> included in the
34
-
/// returned <see cref="ReportingConfiguration"/>. Can be omitted if none of the included
35
-
/// <paramref name="evaluators"/> are AI-based.
32
+
/// A <see cref="ChatConfiguration"/> that specifies the <see cref="IChatClient"/> that is used by AI-based
33
+
/// <paramref name="evaluators"/> included in the returned <see cref="ReportingConfiguration"/>. Can be omitted if
34
+
/// none of the included <paramref name="evaluators"/> are AI-based.
36
35
/// </param>
37
36
/// <param name="enableResponseCaching">
38
37
/// <see langword="true"/> to enable caching of AI responses; <see langword="false"/> otherwise.
0 commit comments