Partager via


TextGenerationExtensions.GetTextContentAsync Method

Definition

Get a single text generation result for the prompt and settings.

public static System.Threading.Tasks.Task<Microsoft.SemanticKernel.TextContent> GetTextContentAsync (this Microsoft.SemanticKernel.TextGeneration.ITextGenerationService textGenerationService, string prompt, Microsoft.SemanticKernel.PromptExecutionSettings? executionSettings = default, Microsoft.SemanticKernel.Kernel? kernel = default, System.Threading.CancellationToken cancellationToken = default);
static member GetTextContentAsync : Microsoft.SemanticKernel.TextGeneration.ITextGenerationService * string * Microsoft.SemanticKernel.PromptExecutionSettings * Microsoft.SemanticKernel.Kernel * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.SemanticKernel.TextContent>
<Extension()>
Public Function GetTextContentAsync (textGenerationService As ITextGenerationService, prompt As String, Optional executionSettings As PromptExecutionSettings = Nothing, Optional kernel As Kernel = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TextContent)

Parameters

textGenerationService
ITextGenerationService

Text generation service

prompt
String

The standardized prompt input.

executionSettings
PromptExecutionSettings

The AI execution settings (optional).

kernel
Kernel

The Kernel containing services, plugins, and other state for use throughout the operation.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

Single text content generated by the remote model.

Applies to