LiveGenerationConfig
@available(iOS 15.0, macOS 12.0, tvOS 15.0, *)
@available(watchOS, unavailable)
public struct LiveGenerationConfig : SendableConfiguration options for live content generation.
-
init(temperature:topP:topK:candidateCount:maxOutputTokens:presencePenalty:frequencyPenalty:responseModalities:speech:inputAudioTranscription:outputAudioTranscription:)
Creates a new
LiveGenerationConfigvalue.See the Configure model parameters guide and the Cloud documentation for more details.
Declaration
Swift
public init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil, candidateCount: Int? = nil, maxOutputTokens: Int? = nil, presencePenalty: Float? = nil, frequencyPenalty: Float? = nil, responseModalities: [ResponseModality]? = nil, speech: SpeechConfig? = nil, inputAudioTranscription: AudioTranscriptionConfig? = nil, outputAudioTranscription: AudioTranscriptionConfig? = nil)Parameters
temperatureControls the randomness of the language model’s output. Higher values (for example, 1.0) make the text more random and creative, while lower values (for example, 0.1) make it more focused and deterministic.
topPControls diversity of generated text. Higher values (e.g., 0.9) produce more diverse text, while lower values (e.g., 0.5) make the output more focused.
topKLimits the number of highest probability words the model considers when generating text. For example, a topK of 40 means only the 40 most likely words are considered for the next token. A higher value increases diversity, while a lower value makes the output more deterministic.
candidateCountThe number of response variations to return; defaults to 1 if not set. Support for multiple candidates depends on the model; see the Cloud documentation for more details.
maxOutputTokensMaximum number of tokens that can be generated in the response. See the configure model parameters documentation for more details.
presencePenaltyControls the likelihood of repeating the same words or phrases already generated in the text. Higher values increase the penalty of repetition, resulting in more diverse output.
frequencyPenaltyControls the likelihood of repeating words or phrases, with the penalty increasing for each repetition. Higher values increase the penalty of repetition, resulting in more diverse output.
responseModalitiesThe data types (modalities) that may be returned in model responses.
speechControls the voice of the model, when streaming
audioviaResponseModality.inputAudioTranscriptionConfigures (and enables) input transcriptions when streaming to the model.
outputAudioTranscriptionConfigures (and enables) output transcriptions when streaming to the model.