Class GenerateContentRequest.Builder
public class GenerateContentRequest.Builder : GenerativeAIRequest.GenerativeAIRequestBuilder<GenerateContentRequest.Builder, GenerateContentRequest>
- Inheritance
-
objectGenerativeAIRequest.GenerativeAIRequestBuilder<GenerateContentRequest.Builder, GenerateContentRequest>GenerateContentRequest.Builder
- Inherited Members
Methods
PushMessage(ChatMessage)
public GenerateContentRequest.Builder PushMessage(ChatMessage message)
Parameters
messageChatMessage
Returns
SetConfig(GenerationConfig)
public GenerateContentRequest.Builder SetConfig(GenerationConfig generationConfig)
Parameters
generationConfigGenerationConfig
Returns
SetFrequencyPenalty(float)
public GenerateContentRequest.Builder SetFrequencyPenalty(float frequencyPenalty)
Parameters
frequencyPenaltyfloat
Returns
SetFunctions(params FunctionDeclaration[])
public GenerateContentRequest.Builder SetFunctions(params FunctionDeclaration[] functions)
Parameters
functionsFunctionDeclaration[]
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.
public GenerateContentRequest.Builder SetInlineAudioData(AudioClip clip)
Parameters
clipAudioClip
Returns
SetInstruction(string)
Adds a system instruction to the beginning of the message list.
public GenerateContentRequest.Builder SetInstruction(string systemInstruction)
Parameters
systemInstructionstring
Returns
SetJsonSchema(JsonSchema)
public GenerateContentRequest.Builder SetJsonSchema(JsonSchema jsonSchema)
Parameters
jsonSchemaJsonSchema
Returns
SetJsonSchema(Type)
public GenerateContentRequest.Builder SetJsonSchema(Type type)
Parameters
typeType
Returns
SetMaxTokens(int)
public GenerateContentRequest.Builder SetMaxTokens(int maxTokens)
Parameters
maxTokensint
Returns
SetMessages(List<ChatMessage>)
public GenerateContentRequest.Builder SetMessages(List<ChatMessage> messages)
Parameters
messagesList<ChatMessage>
Returns
SetPresencePenalty(float)
public GenerateContentRequest.Builder SetPresencePenalty(float presencePenalty)
Parameters
presencePenaltyfloat
Returns
SetPrompt(InpaintPrompt)
public GenerateContentRequest.Builder SetPrompt(InpaintPrompt prompt)
Parameters
promptInpaintPrompt
Returns
SetPrompt(string, List<IFile>)
public GenerateContentRequest.Builder SetPrompt(string prompt, List<IFile> attachedFiles = null)
Parameters
promptstringattachedFilesList<IFile>
Returns
SetResponseCount(int)
public GenerateContentRequest.Builder SetResponseCount(int count)
Parameters
countint
Returns
SetResponseModalities(params Modality[])
public GenerateContentRequest.Builder SetResponseModalities(params Modality[] responseModalities)
Parameters
responseModalitiesModality[]
Returns
SetSafetySettings(IEnumerable<SafetySetting>)
public GenerateContentRequest.Builder SetSafetySettings(IEnumerable<SafetySetting> safetySettings)
Parameters
safetySettingsIEnumerable<SafetySetting>
Returns
SetSeed(int)
public GenerateContentRequest.Builder SetSeed(int seed)
Parameters
seedint
Returns
SetStartingMessage(string)
Adds a system instruction and an assistant message to the beginning of the message list.
public GenerateContentRequest.Builder SetStartingMessage(string startingMessage)
Parameters
startingMessagestring
Returns
SetSystemInstruction(Content)
public GenerateContentRequest.Builder SetSystemInstruction(Content systemInstruction)
Parameters
systemInstructionContent
Returns
SetTemperature(float)
public GenerateContentRequest.Builder SetTemperature(float temperature)
Parameters
temperaturefloat
Returns
SetTools(params Tool[])
public GenerateContentRequest.Builder SetTools(params Tool[] tools)
Parameters
toolsTool[]
Returns
SetTopK(int)
public GenerateContentRequest.Builder SetTopK(int topK)
Parameters
topKint
Returns
SetTopP(float)
public GenerateContentRequest.Builder SetTopP(float topP)
Parameters
topPfloat
Returns
SetVoice(string)
public GenerateContentRequest.Builder SetVoice(string voiceId)
Parameters
voiceIdstring