GenerateAnswerRequest Class

Request to generate an answer.

Definition

Namespace: GenerativeAI.Types
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public class GenerateAnswerRequest : IContentsRequest
Inheritance
Object    GenerateAnswerRequest
Implements
IContentsRequest

Constructors

GenerateAnswerRequestInitializes a new instance of the GenerateAnswerRequest class

Properties

AnswerStyle Required. Style in which answers should be returned.
Contents Required. The content of the current conversation with the Model. For single-turn queries, this is a single question to answer. For multi-turn queries, this is a repeated field that contains conversation history and the last Content in the list containing the question. Note: models.generateAnswer only supports queries in English.
InlinePassages Passages provided inline with the request.
SafetySettings Optional. A list of unique SafetySetting instances for blocking unsafe content. This will be enforced on the Contents and GenerateAnswerResponse.candidate. There should not be more than one setting for each SafetyCategory type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each SafetyCategory specified in the safetySettings. If there is no SafetySetting for a given SafetyCategory provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. Refer to the guide for detailed information on available safety settings. Also refer to the Safety guidance to learn how to incorporate safety considerations in your AI applications.
SemanticRetriever Content retrieved from resources created via the Semantic Retriever API.
Temperature Optional. Controls the randomness of the output. Values can range from, inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. A low temperature (~0.2) is usually recommended for Attributed-Question-Answering use cases.

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)

Extension Methods

AddContent Adds a new Content object to the IContentsRequest.
(Defined by IContentRequest_Extensions)
AddInlineData Adds inline data such as an image or audio file into the latest Content in the IContentsRequest and associates it with the specified role.
(Defined by IContentRequest_Extensions)
AddInlineFile Adds a new Content that includes an inline file as a Part to the IContentsRequest.
(Defined by IContentRequest_Extensions)
AddPart Adds a specific Part to the latest Content in the IContentsRequest. If no Content exists, a new one is created with the provided Part.
(Defined by IContentRequest_Extensions)
AddParts Adds a collection of Part objects to the latest Content in the IContentsRequest with the specified role. If no Content exists, a new one is created with the provided Part collection.
(Defined by IContentRequest_Extensions)
AddRemoteFile Adds a remote file to the IContentsRequest using a RemoteFile object.
(Defined by IContentRequest_Extensions)
AddRemoteFile Adds a remote file to the IContentsRequest using a URL and MIME type.
(Defined by IContentRequest_Extensions)
AddText Adds a single text Part to the IContentsRequest with the specified role.
(Defined by IContentRequest_Extensions)

See Also