Table of Contents

Class LiveConnectConfig

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Session config for the API connection.

public record LiveConnectConfig : IEquatable<LiveConnectConfig>
Inheritance
LiveConnectConfig
Implements
Inherited Members

Properties

AvatarConfig

Configures the avatar model behavior.

[JsonPropertyName("avatarConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AvatarConfig? AvatarConfig { get; set; }

Property Value

AvatarConfig

ContextWindowCompression

Configures context window compression mechanism. If included, server will compress context window to fit into given length.

[JsonPropertyName("contextWindowCompression")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ContextWindowCompressionConfig? ContextWindowCompression { get; set; }

Property Value

ContextWindowCompressionConfig

EnableAffectiveDialog

If enabled, the model will detect emotions and adapt its responses accordingly.

[JsonPropertyName("enableAffectiveDialog")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? EnableAffectiveDialog { get; set; }

Property Value

bool?

ExplicitVadSignal

Configures the explicit VAD signal. If enabled, the client will send vad_signal to indicate the start and end of speech. This allows the server to process the audio more efficiently.

[JsonPropertyName("explicitVadSignal")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public bool? ExplicitVadSignal { get; set; }

Property Value

bool?

GenerationConfig

The generation configuration for the session.

[JsonPropertyName("generationConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GenerationConfig? GenerationConfig { get; set; }

Property Value

GenerationConfig

HttpOptions

Used to override HTTP request options.

[JsonPropertyName("httpOptions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public HttpOptions? HttpOptions { get; set; }

Property Value

HttpOptions

InputAudioTranscription

The transcription of the input aligns with the input audio language.

[JsonPropertyName("inputAudioTranscription")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AudioTranscriptionConfig? InputAudioTranscription { get; set; }

Property Value

AudioTranscriptionConfig

MaxOutputTokens

Maximum number of tokens that can be generated in the response.

[JsonPropertyName("maxOutputTokens")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? MaxOutputTokens { get; set; }

Property Value

int?

MediaResolution

If specified, the media resolution specified will be used.

[JsonPropertyName("mediaResolution")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public MediaResolution? MediaResolution { get; set; }

Property Value

MediaResolution?

OutputAudioTranscription

The transcription of the output aligns with the language code specified for the output audio.

[JsonPropertyName("outputAudioTranscription")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public AudioTranscriptionConfig? OutputAudioTranscription { get; set; }

Property Value

AudioTranscriptionConfig

Proactivity

Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.

[JsonPropertyName("proactivity")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ProactivityConfig? Proactivity { get; set; }

Property Value

ProactivityConfig

RealtimeInputConfig

Configures the realtime input behavior in BidiGenerateContent.

[JsonPropertyName("realtimeInputConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public RealtimeInputConfig? RealtimeInputConfig { get; set; }

Property Value

RealtimeInputConfig

ResponseModalities

The requested modalities of the response. Represents the set of modalities that the model can return. Defaults to AUDIO if not specified.

[JsonPropertyName("responseModalities")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<Modality>? ResponseModalities { get; set; }

Property Value

List<Modality>

SafetySettings

Safety settings in the request to block unsafe content in the response.

[JsonPropertyName("safetySettings")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<SafetySetting>? SafetySettings { get; set; }

Property Value

List<SafetySetting>

Seed

When seed is fixed to a specific number, the model makes a best effort to provide the same response for repeated requests. By default, a random number is used.

[JsonPropertyName("seed")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Seed { get; set; }

Property Value

int?

SessionResumption

Configures session resumption mechanism. If included the server will send SessionResumptionUpdate messages.

[JsonPropertyName("sessionResumption")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SessionResumptionConfig? SessionResumption { get; set; }

Property Value

SessionResumptionConfig

SpeechConfig

The speech generation configuration.

[JsonPropertyName("speechConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SpeechConfig? SpeechConfig { get; set; }

Property Value

SpeechConfig

SystemInstruction

The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

[JsonPropertyName("systemInstruction")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Content? SystemInstruction { get; set; }

Property Value

Content

Temperature

Value that controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a less open-ended or creative response, while higher temperatures can lead to more diverse or creative results.

[JsonPropertyName("temperature")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Temperature { get; set; }

Property Value

double?

ThinkingConfig

Config for thinking features. An error will be returned if this field is set for models that don't support thinking.

[JsonPropertyName("thinkingConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ThinkingConfig? ThinkingConfig { get; set; }

Property Value

ThinkingConfig

Tools

A list of Tools the model may use to generate the next response. A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

[JsonPropertyName("tools")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<Tool>? Tools { get; set; }

Property Value

List<Tool>

TopK

For each token selection step, the top_k tokens with the highest probabilities are sampled. Then tokens are further filtered based on top_p with the final token selected using temperature sampling. Use a lower number for less random responses and a higher number for more random responses.

[JsonPropertyName("topK")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? TopK { get; set; }

Property Value

double?

TopP

Tokens are selected from the most to least probable until the sum of their probabilities equals this value. Use a lower value for less random responses and a higher value for more random responses.

[JsonPropertyName("topP")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? TopP { get; set; }

Property Value

double?

TranslationConfig

Config for translation.

[JsonPropertyName("translationConfig")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public TranslationConfig? TranslationConfig { get; set; }

Property Value

TranslationConfig

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a LiveConnectConfig object.

public static LiveConnectConfig? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

LiveConnectConfig

The deserialized LiveConnectConfig object, or null if deserialization fails.