Table of Contents

Class GenerateContentRequest

Generates a response from the model given an input GenerateContentRequest. Input capabilities differ between models, including tuned models.See the model guide and tuning guide for details.

public class GenerateContentRequest : GoogleGeminiRequest, IValidatable
Inheritance
object
GenerateContentRequest
Implements
IValidatable
Inherited Members
Extension Methods

Properties

CachedContent

Optional. The name of the cached content used as context to serve the prediction.

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

Format: cachedContents/{cachedContent}

public string CachedContent { get; set; }

Property Value

string

Config

Optional. Configuration options for model generation and outputs.

public GeminiConfig Config { get; set; }

Property Value

GeminiConfig

Contents

Required. 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.

public List<GeminiContent> Contents { get; set; }

Property Value

List<GeminiContent>

SafetySettings

Optional.

A list of unique SafetySetting instances for blocking unsafe content.

This will be enforced on the Contents and Candidates. 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 Hate, SexuallyExplicit, DangerousContent, Harassment are supported.
public List<SafetySetting> SafetySettings { get; set; }

Property Value

List<SafetySetting>

SystemInstruction

Optional. (Beta) Developer set system instruction. Currently, text only.

public GeminiContent SystemInstruction { get; set; }

Property Value

GeminiContent

ToolConfig

Optional. Tool configuration for any Tool (Tools) specified in the request.

public ToolConfig ToolConfig { get; set; }

Property Value

ToolConfig

Tools

Optional. (Beta) A list of GeminiTool the model may use to generate the next response.

public List<GeminiTool> Tools { get; set; }

Property Value

List<GeminiTool>

Methods

Validate()

public void Validate()