Class GenerateContentRequest.Builder
Inheritance
object
GenerateContentRequest.Builder
Assembly: .dll
Syntax
public class GenerateContentRequest.Builder : GenerativeAIRequest.GenerativeAIRequestBuilder<GenerateContentRequest.Builder, GenerateContentRequest>
Methods
PushMessage(ChatMessage)
Declaration
public GenerateContentRequest.Builder PushMessage(ChatMessage message)
Parameters
Returns
SetConfig(GenerationConfig)
Declaration
public GenerateContentRequest.Builder SetConfig(GenerationConfig generationConfig)
Parameters
Returns
SetFrequencyPenalty(float)
Declaration
public GenerateContentRequest.Builder SetFrequencyPenalty(float frequencyPenalty)
Parameters
Type |
Name |
Description |
float |
frequencyPenalty |
|
Returns
SetFunctions(params FunctionDeclaration[])
Declaration
public GenerateContentRequest.Builder SetFunctions(params FunctionDeclaration[] functions)
Parameters
Returns
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.
Declaration
public GenerateContentRequest.Builder SetInlineAudioData(AudioClip clip)
Parameters
Type |
Name |
Description |
AudioClip |
clip |
|
Returns
SetInstruction(string)
Adds a system instruction to the beginning of the message list.
Declaration
public GenerateContentRequest.Builder SetInstruction(string systemInstruction)
Parameters
Type |
Name |
Description |
string |
systemInstruction |
|
Returns
SetJsonSchema(JsonSchema)
Declaration
public GenerateContentRequest.Builder SetJsonSchema(JsonSchema jsonSchema)
Parameters
Type |
Name |
Description |
JsonSchema |
jsonSchema |
|
Returns
SetJsonSchema(Type)
Declaration
public GenerateContentRequest.Builder SetJsonSchema(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
Returns
SetMaxTokens(int)
Declaration
public GenerateContentRequest.Builder SetMaxTokens(int maxTokens)
Parameters
Type |
Name |
Description |
int |
maxTokens |
|
Returns
SetMessages(List<ChatMessage>)
Declaration
public GenerateContentRequest.Builder SetMessages(List<ChatMessage> messages)
Parameters
Returns
SetPresencePenalty(float)
Declaration
public GenerateContentRequest.Builder SetPresencePenalty(float presencePenalty)
Parameters
Type |
Name |
Description |
float |
presencePenalty |
|
Returns
SetPrompt(InpaintPrompt)
Declaration
public GenerateContentRequest.Builder SetPrompt(InpaintPrompt prompt)
Parameters
Returns
SetPrompt(string, List<IFile>)
Declaration
public GenerateContentRequest.Builder SetPrompt(string prompt, List<IFile> attachedFiles = null)
Parameters
Type |
Name |
Description |
string |
prompt |
|
List<IFile> |
attachedFiles |
|
Returns
SetResponseCount(int)
Declaration
public GenerateContentRequest.Builder SetResponseCount(int count)
Parameters
Type |
Name |
Description |
int |
count |
|
Returns
SetResponseModalities(params Modality[])
Declaration
public GenerateContentRequest.Builder SetResponseModalities(params Modality[] responseModalities)
Parameters
Type |
Name |
Description |
Modality[] |
responseModalities |
|
Returns
SetSafetySettings(IEnumerable<SafetySetting>)
Declaration
public GenerateContentRequest.Builder SetSafetySettings(IEnumerable<SafetySetting> safetySettings)
Parameters
Returns
SetSeed(int)
Declaration
public GenerateContentRequest.Builder SetSeed(int seed)
Parameters
Type |
Name |
Description |
int |
seed |
|
Returns
SetStartingMessage(string)
Adds a system instruction and an assistant message to the beginning of the message list.
Declaration
public GenerateContentRequest.Builder SetStartingMessage(string startingMessage)
Parameters
Type |
Name |
Description |
string |
startingMessage |
|
Returns
SetSystemInstruction(Content)
Declaration
public GenerateContentRequest.Builder SetSystemInstruction(Content systemInstruction)
Parameters
Type |
Name |
Description |
Content |
systemInstruction |
|
Returns
SetTemperature(float)
Declaration
public GenerateContentRequest.Builder SetTemperature(float temperature)
Parameters
Type |
Name |
Description |
float |
temperature |
|
Returns
SetTools(params Tool[])
Declaration
public GenerateContentRequest.Builder SetTools(params Tool[] tools)
Parameters
Type |
Name |
Description |
Tool[] |
tools |
|
Returns
SetTopK(int)
Declaration
public GenerateContentRequest.Builder SetTopK(int topK)
Parameters
Type |
Name |
Description |
int |
topK |
|
Returns
SetTopP(float)
Declaration
public GenerateContentRequest.Builder SetTopP(float topP)
Parameters
Type |
Name |
Description |
float |
topP |
|
Returns
SetVoice(string)
Declaration
public GenerateContentRequest.Builder SetVoice(string voiceId)
Parameters
Type |
Name |
Description |
string |
voiceId |
|
Returns