UGemini 2.0.1
A C# wrapper for the Google Gemini API.
Loading...
Searching...
No Matches
Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest Class Reference

Generates a grounded answer from the model. More...

Inheritance diagram for Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest:
Uralstech.UGemini.IGeminiPostRequest Uralstech.UGemini.IGeminiRequest

Public Member Functions

string GetEndpointUri (GeminiRequestMetadata metadata)
 Gets the URI to the API endpoint.
Parameters
metadataThe metadata of the request to be carried out on the URI.
Returns
The URI.

 
 GeminiAnswerRequest (GeminiModelId model, bool useBetaApi=true)
 Creates a new GeminiAnswerRequest.
 
string GetUtf8EncodedData ()
 Converts the request object to a UTF-8 encoded string.
Returns
The string data.

 

Public Attributes

GeminiContent[] Contents
 The content of the current conversation with the model.
 
GeminiAnswerStyle AnswerStyle
 Style in which answers should be returned.
 
GeminiSafetySettings[] SafetySettings = null
 A list of unique GeminiSafetySettings instances for blocking unsafe content.
 
GeminiGroundingPassages InlinePassages = null
 Passages provided inline with the request.
 
GeminiSemanticRetrieverConfig SemanticRetriever = null
 Content retrieved from resources created via the Semantic Retriever API.
 
float Temperature = -1f
 Controls the randomness of the output.
 
GeminiModelId Model
 The model to use.
 
string ApiVersion
 The API version to use.
 

Properties

string ContentType [get]
 The MIME type of the request content.
 
- Properties inherited from Uralstech.UGemini.IGeminiPostRequest

Detailed Description

Generates a grounded answer from the model.

Only available in the beta API.

Constructor & Destructor Documentation

◆ GeminiAnswerRequest()

Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.GeminiAnswerRequest ( GeminiModelId model,
bool useBetaApi = true )

Creates a new GeminiAnswerRequest.

Only available in the beta API.

Parameters
modelThe model to use.
useBetaApiShould the request use the Beta API?

Member Function Documentation

◆ GetEndpointUri()

string Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.GetEndpointUri ( GeminiRequestMetadata metadata)

Gets the URI to the API endpoint.

Parameters
metadataThe metadata of the request to be carried out on the URI.
Returns
The URI.

Implements Uralstech.UGemini.IGeminiRequest.

◆ GetUtf8EncodedData()

string Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.GetUtf8EncodedData ( )

Converts the request object to a UTF-8 encoded string.

Returns
The string data.

Implements Uralstech.UGemini.IGeminiPostRequest.

Member Data Documentation

◆ Contents

GeminiContent [] Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.Contents

The content of the current conversation with the model.

For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.

generateAnswer currently only supports queries in English.

◆ InlinePassages

GeminiGroundingPassages Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.InlinePassages = null

Passages provided inline with the request.

This or SemanticRetriever are must be provided at a time.

◆ SafetySettings

GeminiSafetySettings [] Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.SafetySettings = null

A list of unique GeminiSafetySettings instances for blocking unsafe content.

This will be enforced on Contents and GeminiAnswerResponse.Answer.
There should not be more than one setting for each GeminiSafetyHarmCategory 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 GeminiSafetyHarmCategory specified in the SafetySettings. If there is
no GeminiSafetySettings for a given GeminiSafetyHarmCategory provided in the list, the API will use the
default safety setting for that category. Harm categories GeminiSafetyHarmCategory.HateSpeech,
GeminiSafetyHarmCategory.SexuallyExplicit, GeminiSafetyHarmCategory.DangerousContent and
GeminiSafetyHarmCategory.Harassment are supported.

◆ SemanticRetriever

GeminiSemanticRetrieverConfig Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.SemanticRetriever = null

Content retrieved from resources created via the Semantic Retriever API.

This or InlinePassages are must be provided at a time.

◆ Temperature

float Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.Temperature = -1f

Controls the randomness of the output.

Values can range from [0.0,1.0], 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.

Property Documentation

◆ ContentType

string Uralstech.UGemini.Models.Generation.QuestionAnswering.GeminiAnswerRequest.ContentType
get

The MIME type of the request content.

Implements Uralstech.UGemini.IGeminiPostRequest.


The documentation for this class was generated from the following file: