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

Request to generate a response from the model. More...

Inheritance diagram for Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest:
Uralstech.UGemini.IGeminiStreamablePostRequest< GeminiChatResponse >

Public Member Functions

string GetEndpointUri (GeminiRequestMetadata metadata)
 
 GeminiChatRequest (GeminiModelId model, bool useBetaApi=false)
 Creates a new GeminiChatRequest.
 
string GetUtf8EncodedData ()
 
async Task ProcessStreamedData (List< JToken > allEvents, JToken lastEvent)
 
- Public Member Functions inherited from Uralstech.UGemini.IGeminiStreamablePostRequest< GeminiChatResponse >
Task ProcessStreamedData (List< JToken > allEvents, JToken lastEvent)
 Callback to process Server Sent Events (SSEs).
 

Public Attributes

GeminiContent[] Contents
 The content of the current conversation with the model.
 
GeminiTool[] Tools = null
 A list of Tools the model may use to generate the next response.
 
GeminiToolConfiguration ToolConfig = null
 Tool configuration for any Tool specified in the request.
 
GeminiSafetySettings[] SafetySettings = null
 A list of unique GeminiSafetySettings instances for blocking unsafe content.
 
GeminiContent SystemInstruction = null
 Developer set system instruction. Currently, text only.
 
GeminiGenerationConfiguration GenerationConfig = null
 Configuration options for model generation and outputs.
 
string CachedContent = null
 The name of the cached content used as context to serve the prediction. Format: cachedContents/{cachedContent}.
 
GeminiModelId Model
 The model to use.
 
string ApiVersion
 The API version to use.
 
Func< GeminiChatResponse, Task > OnPartialResponseReceived
 Callback for receiving streamed responses.
 

Properties

string ContentType [get]
 
GeminiChatResponse StreamedResponse [get]
 The streamed response.
 
- Properties inherited from Uralstech.UGemini.IGeminiStreamablePostRequest< GeminiChatResponse >
TResponse StreamedResponse [get]
 The response being streamed.
 

Detailed Description

Request to generate a response from the model.

Constructor & Destructor Documentation

◆ GeminiChatRequest()

Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest.GeminiChatRequest ( GeminiModelId model,
bool useBetaApi = false )

Creates a new GeminiChatRequest.

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

Member Data Documentation

◆ CachedContent

string Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest.CachedContent = null

The name of the cached content used as context to serve the prediction. Format: cachedContents/{cachedContent}.

Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings.

Only available in the beta API.

◆ Contents

GeminiContent [] Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest.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.

◆ SafetySettings

GeminiSafetySettings [] Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest.SafetySettings = null

A list of unique GeminiSafetySettings instances for blocking unsafe content.

This will be enforced on Contents and GeminiChatResponse.Candidates.
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.

◆ SystemInstruction

GeminiContent Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest.SystemInstruction = null

Developer set system instruction. Currently, text only.

Only available in the beta API.

◆ ToolConfig

GeminiToolConfiguration Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest.ToolConfig = null

Tool configuration for any Tool specified in the request.

Only available in the beta API.

◆ Tools

GeminiTool [] Uralstech.UGemini.Models.Generation.Chat.GeminiChatRequest.Tools = null

A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions,
outside of knowledge and scope of the model.The only supported tool is currently Function.

Only available in the beta API.


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