IGenerativeModelGenerateAnswerAsync(String, AnswerStyle, ICollectionSafetySetting, CancellationToken) Method
Generates an answer asynchronously based on the given prompt and specified parameters.
Namespace: GenerativeAIAssembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
Task<GenerateAnswerResponse> GenerateAnswerAsync(
string prompt,
AnswerStyle answerStyle = AnswerStyle.ABSTRACTIVE,
ICollection<SafetySetting>? safetySettings = null,
CancellationToken cancellationToken = default
)
- prompt String
- The text input that serves as the basis for generating a response.
- answerStyle AnswerStyle (Optional)
- An optional parameter indicating the stylistic approach to be used when generating the answer.
- safetySettings ICollectionSafetySetting (Optional)
- An optional collection of rules or configurations applied to ensure safety during the answer generation process.
- cancellationToken CancellationToken (Optional)
- A token to monitor for cancellation requests during the asynchronous operation.
TaskGenerateAnswerResponseReturns a
GenerateAnswerResponse object containing the generated response and associated metadata.