Table of Contents

Class GenerateContentRequest.Builder

public class GenerateContentRequest.Builder : GenerativeAIRequest.GenerativeAIRequestBuilder<GenerateContentRequest.Builder, GenerateContentRequest>
Inheritance
object
RESTRequestBody.RequestBuilder<GenerateContentRequest.Builder, GenerateContentRequest>
GenerateContentRequest.Builder
Inherited Members

Methods

PushMessage(ChatMessage)

public GenerateContentRequest.Builder PushMessage(ChatMessage message)

Parameters

message ChatMessage

Returns

GenerateContentRequest.Builder

SetConfig(GenerationConfig)

public GenerateContentRequest.Builder SetConfig(GenerationConfig generationConfig)

Parameters

generationConfig GenerationConfig

Returns

GenerateContentRequest.Builder

SetFrequencyPenalty(float)

public GenerateContentRequest.Builder SetFrequencyPenalty(float frequencyPenalty)

Parameters

frequencyPenalty float

Returns

GenerateContentRequest.Builder

SetFunctions(params FunctionDeclaration[])

public GenerateContentRequest.Builder SetFunctions(params FunctionDeclaration[] functions)

Parameters

functions FunctionDeclaration[]

Returns

GenerateContentRequest.Builder

SetInlineAudioData(AudioClip)

Add STT (Speech to Text) audio prompt. The maximum request size is 20 MB, which includes text prompts, system instructions, and files provided inline.

If your file's size will make the total request size exceed 20 MB, then use the Files API to upload an audio file for use in the request. If you're using an audio sample multiple times, it's more efficient to upload an audio file.

public GenerateContentRequest.Builder SetInlineAudioData(AudioClip clip)

Parameters

clip AudioClip

Returns

GenerateContentRequest.Builder

SetInstruction(string)

Adds a system instruction to the beginning of the message list.

public GenerateContentRequest.Builder SetInstruction(string systemInstruction)

Parameters

systemInstruction string

Returns

GenerateContentRequest.Builder

SetJsonSchema(JsonSchema)

public GenerateContentRequest.Builder SetJsonSchema(JsonSchema jsonSchema)

Parameters

jsonSchema JsonSchema

Returns

GenerateContentRequest.Builder

SetJsonSchema(Type)

public GenerateContentRequest.Builder SetJsonSchema(Type type)

Parameters

type Type

Returns

GenerateContentRequest.Builder

SetMaxTokens(int)

public GenerateContentRequest.Builder SetMaxTokens(int maxTokens)

Parameters

maxTokens int

Returns

GenerateContentRequest.Builder

SetMessages(List<ChatMessage>)

public GenerateContentRequest.Builder SetMessages(List<ChatMessage> messages)

Parameters

messages List<ChatMessage>

Returns

GenerateContentRequest.Builder

SetPresencePenalty(float)

public GenerateContentRequest.Builder SetPresencePenalty(float presencePenalty)

Parameters

presencePenalty float

Returns

GenerateContentRequest.Builder

SetPrompt(InpaintPrompt)

public GenerateContentRequest.Builder SetPrompt(InpaintPrompt prompt)

Parameters

prompt InpaintPrompt

Returns

GenerateContentRequest.Builder

SetPrompt(string, List<IFile>)

public GenerateContentRequest.Builder SetPrompt(string prompt, List<IFile> attachedFiles = null)

Parameters

prompt string
attachedFiles List<IFile>

Returns

GenerateContentRequest.Builder

SetResponseCount(int)

public GenerateContentRequest.Builder SetResponseCount(int count)

Parameters

count int

Returns

GenerateContentRequest.Builder

SetResponseModalities(params Modality[])

public GenerateContentRequest.Builder SetResponseModalities(params Modality[] responseModalities)

Parameters

responseModalities Modality[]

Returns

GenerateContentRequest.Builder

SetSafetySettings(IEnumerable<SafetySetting>)

public GenerateContentRequest.Builder SetSafetySettings(IEnumerable<SafetySetting> safetySettings)

Parameters

safetySettings IEnumerable<SafetySetting>

Returns

GenerateContentRequest.Builder

SetSeed(int)

public GenerateContentRequest.Builder SetSeed(int seed)

Parameters

seed int

Returns

GenerateContentRequest.Builder

SetStartingMessage(string)

Adds a system instruction and an assistant message to the beginning of the message list.

public GenerateContentRequest.Builder SetStartingMessage(string startingMessage)

Parameters

startingMessage string

Returns

GenerateContentRequest.Builder

SetSystemInstruction(Content)

public GenerateContentRequest.Builder SetSystemInstruction(Content systemInstruction)

Parameters

systemInstruction Content

Returns

GenerateContentRequest.Builder

SetTemperature(float)

public GenerateContentRequest.Builder SetTemperature(float temperature)

Parameters

temperature float

Returns

GenerateContentRequest.Builder

SetTools(params Tool[])

public GenerateContentRequest.Builder SetTools(params Tool[] tools)

Parameters

tools Tool[]

Returns

GenerateContentRequest.Builder

SetTopK(int)

public GenerateContentRequest.Builder SetTopK(int topK)

Parameters

topK int

Returns

GenerateContentRequest.Builder

SetTopP(float)

public GenerateContentRequest.Builder SetTopP(float topP)

Parameters

topP float

Returns

GenerateContentRequest.Builder

SetVoice(string)

public GenerateContentRequest.Builder SetVoice(string voiceId)

Parameters

voiceId string

Returns

GenerateContentRequest.Builder