corelibraries-devexpress-dot-aiintegration-dot-aiintegration-dot-extractivesummaryasync-x28-iaiextensionscontainer-extractivesummaryrequest-cancellationtoken-x29.md
Generates a brief summary of long text by selecting and extracting key sentences or phrases from the original text.
Namespace : DevExpress.AIIntegration
Assembly : DevExpress.AIIntegration.v25.2.dll
NuGet Package : DevExpress.AIIntegration
public static Task<TextResponse> ExtractiveSummaryAsync(
this IAIExtensionsContainer container,
ExtractiveSummaryRequest request,
CancellationToken cancellationToken = default(CancellationToken)
)
<ExtensionAttribute>
Public Shared Function ExtractiveSummaryAsync(
container As IAIExtensionsContainer,
request As ExtractiveSummaryRequest,
cancellationToken As CancellationToken = Nothing
) As Task(Of TextResponse)
| Name | Type | Description |
|---|---|---|
| container | IAIExtensionsContainer |
The AI extensions container.
| | request | ExtractiveSummaryRequest |
The request to generate a brief summary of long text by selecting and extracting key sentences or phrases from the original text.
|
| Name | Type | Default | Description |
|---|---|---|---|
| cancellationToken | CancellationToken | null |
The token that cancels the task.
|
| Type | Description |
|---|---|
| Task<TextResponse> |
The response that contains AI-generated text.
|
The following example registers an Azure Text Analytics client and uses the AI-powered extension to generate a summary for originalText:
using Azure;
using Azure.AI.TextAnalytics;
using DevExpress.AIIntegration;
using DevExpress.AIIntegration.Extensions;
AIExtensionsContainerDefault defaultAIExtensionsContainer;
RegisterTextAnalyticsService(
Environment.GetEnvironmentVariable("AZURE_TEXT_ANALYTICS_ENDPOINT"),
Environment.GetEnvironmentVariable("AZURE_TEXT_ANALYTICS_API_KEY")
);
string originalText = "This must be a long text...";
var response = await defaultAIExtensionsContainer.ExtractiveSummaryAsync(
new ExtractiveSummaryRequest(originalText) { Language = "de", MaxSentences = 5 }
);
Console.WriteLine(response);
void RegisterTextAnalyticsService(string azureTextAnalyticsEndpoint, string azureTextAnalyticsAIKey)
{
defaultAIExtensionsContainer = new AIExtensionsContainerDefault();
var textAnalyticsClient = new TextAnalyticsClient(
new Uri(azureTextAnalyticsEndpoint),
new AzureKeyCredential(azureTextAnalyticsAIKey)
);
defaultAIExtensionsContainer.RegisterTextAnalyticsAzureAIService(textAnalyticsClient);
}
See Also