Class: Vapi::GoogleRealtimeConfig
- Inherits:
-
Object
- Object
- Vapi::GoogleRealtimeConfig
- Defined in:
- lib/vapi_server_sdk/types/google_realtime_config.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#frequency_penalty ⇒ Float
readonly
This is the frequency penalty parameter that influences the model’s likelihood to repeat tokens by penalizing them based on their frequency in the text.
-
#presence_penalty ⇒ Float
readonly
This is the presence penalty parameter that influences the model’s likelihood to repeat information by penalizing tokens based on their presence in the text.
-
#speech_config ⇒ Vapi::GeminiMultimodalLiveSpeechConfig
readonly
This is the speech configuration object that defines the voice settings to be used for the model’s speech output.
-
#top_k ⇒ Float
readonly
This is the top-k sampling parameter that limits the number of highest probability tokens considered during text generation.
-
#top_p ⇒ Float
readonly
This is the nucleus sampling parameter that controls the cumulative probability of tokens considered during text generation.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::GoogleRealtimeConfig
Deserialize a JSON object to an instance of GoogleRealtimeConfig.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(top_p: OMIT, top_k: OMIT, presence_penalty: OMIT, frequency_penalty: OMIT, speech_config: OMIT, additional_properties: nil) ⇒ Vapi::GoogleRealtimeConfig constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of GoogleRealtimeConfig to a JSON object.
Constructor Details
#initialize(top_p: OMIT, top_k: OMIT, presence_penalty: OMIT, frequency_penalty: OMIT, speech_config: OMIT, additional_properties: nil) ⇒ Vapi::GoogleRealtimeConfig
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 54 def initialize(top_p: OMIT, top_k: OMIT, presence_penalty: OMIT, frequency_penalty: OMIT, speech_config: OMIT, additional_properties: nil) @top_p = top_p if top_p != OMIT @top_k = top_k if top_k != OMIT @presence_penalty = presence_penalty if presence_penalty != OMIT @frequency_penalty = frequency_penalty if frequency_penalty != OMIT @speech_config = speech_config if speech_config != OMIT @additional_properties = additional_properties @_field_set = { "topP": top_p, "topK": top_k, "presencePenalty": presence_penalty, "frequencyPenalty": frequency_penalty, "speechConfig": speech_config }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
30 31 32 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 30 def additional_properties @additional_properties end |
#frequency_penalty ⇒ Float (readonly)
Returns This is the frequency penalty parameter that influences the model’s likelihood to repeat tokens by penalizing them based on their frequency in the text. Only applicable with the Gemini Flash 2.0 Multimodal Live API.
24 25 26 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 24 def frequency_penalty @frequency_penalty end |
#presence_penalty ⇒ Float (readonly)
Returns This is the presence penalty parameter that influences the model’s likelihood to repeat information by penalizing tokens based on their presence in the text. Only applicable with the Gemini Flash 2.0 Multimodal Live API.
20 21 22 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 20 def presence_penalty @presence_penalty end |
#speech_config ⇒ Vapi::GeminiMultimodalLiveSpeechConfig (readonly)
Returns This is the speech configuration object that defines the voice settings to be used for the model’s speech output. Only applicable with the Gemini Flash 2.0 Multimodal Live API.
28 29 30 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 28 def speech_config @speech_config end |
#top_k ⇒ Float (readonly)
Returns This is the top-k sampling parameter that limits the number of highest probability tokens considered during text generation. Only applicable with the Gemini Flash 2.0 Multimodal Live API.
16 17 18 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 16 def top_k @top_k end |
#top_p ⇒ Float (readonly)
Returns This is the nucleus sampling parameter that controls the cumulative probability of tokens considered during text generation. Only applicable with the Gemini Flash 2.0 Multimodal Live API.
12 13 14 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 12 def top_p @top_p end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::GoogleRealtimeConfig
Deserialize a JSON object to an instance of GoogleRealtimeConfig
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 77 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) top_p = parsed_json["topP"] top_k = parsed_json["topK"] presence_penalty = parsed_json["presencePenalty"] frequency_penalty = parsed_json["frequencyPenalty"] if parsed_json["speechConfig"].nil? speech_config = nil else speech_config = parsed_json["speechConfig"].to_json speech_config = Vapi::GeminiMultimodalLiveSpeechConfig.from_json(json_object: speech_config) end new( top_p: top_p, top_k: top_k, presence_penalty: presence_penalty, frequency_penalty: frequency_penalty, speech_config: speech_config, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
113 114 115 116 117 118 119 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 113 def self.validate_raw(obj:) obj.top_p&.is_a?(Float) != false || raise("Passed value for field obj.top_p is not the expected type, validation failed.") obj.top_k&.is_a?(Float) != false || raise("Passed value for field obj.top_k is not the expected type, validation failed.") obj.presence_penalty&.is_a?(Float) != false || raise("Passed value for field obj.presence_penalty is not the expected type, validation failed.") obj.frequency_penalty&.is_a?(Float) != false || raise("Passed value for field obj.frequency_penalty is not the expected type, validation failed.") obj.speech_config.nil? || Vapi::GeminiMultimodalLiveSpeechConfig.validate_raw(obj: obj.speech_config) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of GoogleRealtimeConfig to a JSON object
103 104 105 |
# File 'lib/vapi_server_sdk/types/google_realtime_config.rb', line 103 def to_json(*_args) @_field_set&.to_json end |