AIIntegration.AbstractiveSummaryAsync(IAIExtensionsContainer, AbstractiveSummaryRequest, CancellationToken) Method
Generates a brief summary of long text by understanding the context of the original text and rephrasing it in a new, concise form.
Namespace: DevExpress.AIIntegration
Assembly: DevExpress.AIIntegration.v24.2.dll
NuGet Package: DevExpress.AIIntegration
#Declaration
public static Task<TextResponse> AbstractiveSummaryAsync(
this IAIExtensionsContainer container,
AbstractiveSummaryRequest request,
CancellationToken cancellationToken = default(CancellationToken)
)
#Parameters
Name | Type | Description |
---|---|---|
container | IAIExtensions |
The AI extensions container. |
request | Abstractive |
The request to generate a brief summary of long text. |
#Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
cancellation |
Cancellation |
null | The token that cancels the task. |
#Returns
Type | Description |
---|---|
Task<Text |
The response that contains AI-generated text. |
#Remarks
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.AbstractiveSummaryAsync(
new AbstractiveSummaryRequest(originalText) { Language = "de", SentenceCount = 3 }
);
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);
}