Class: Retell::SDK::Unofficial::API::Agent
- Inherits:
-
Object
- Object
- Retell::SDK::Unofficial::API::Agent
- Defined in:
- lib/retell/sdk/unofficial/api/agent.rb
Instance Method Summary collapse
- #create(llm_websocket_url:, voice_id:, agent_name: nil, ambient_sound: nil, ambient_sound_volume: nil, backchannel_frequency: nil, backchannel_words: nil, boosted_keywords: nil, enable_backchannel: nil, enable_voicemail_detection: nil, end_call_after_silence_ms: nil, fallback_voice_ids: nil, fallback_voices: nil, interruption_sensitivity: nil, language: nil, max_call_duration_ms: nil, name: nil, normalize_for_speech: nil, opt_out_sensitive_data_storage: nil, post_call_analysis_data: nil, pronunciation_dictionary: nil, reminder_max_count: nil, reminder_trigger_ms: nil, responsiveness: nil, voice: nil, voice_model: nil, voice_speed: nil, voice_temperature: nil, voicemail_detection_timeout_ms: nil, voicemail_message: nil, volume: nil, webhook_url: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
- #delete(agent_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
-
#initialize(client) ⇒ Agent
constructor
A new instance of Agent.
- #list(extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
- #retrieve(agent_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
- #update(agent_or_id, llm_websocket_url: nil, voice_id: nil, agent_name: nil, ambient_sound: nil, ambient_sound_volume: nil, backchannel_frequency: nil, backchannel_words: nil, boosted_keywords: nil, enable_backchannel: nil, enable_voicemail_detection: nil, end_call_after_silence_ms: nil, fallback_voices: nil, fallback_voice_ids: nil, interruption_sensitivity: nil, language: nil, max_call_duration_ms: nil, name: nil, normalize_for_speech: nil, opt_out_sensitive_data_storage: nil, post_call_analysis_data: nil, pronunciation_dictionary: nil, reminder_max_count: nil, reminder_trigger_ms: nil, responsiveness: nil, voice: nil, voice_model: nil, voice_speed: nil, voice_temperature: nil, voicemail_detection_timeout_ms: nil, voicemail_message: nil, volume: nil, webhook_url: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ Agent
Returns a new instance of Agent.
6 7 8 |
# File 'lib/retell/sdk/unofficial/api/agent.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create(llm_websocket_url:, voice_id:, agent_name: nil, ambient_sound: nil, ambient_sound_volume: nil, backchannel_frequency: nil, backchannel_words: nil, boosted_keywords: nil, enable_backchannel: nil, enable_voicemail_detection: nil, end_call_after_silence_ms: nil, fallback_voice_ids: nil, fallback_voices: nil, interruption_sensitivity: nil, language: nil, max_call_duration_ms: nil, name: nil, normalize_for_speech: nil, opt_out_sensitive_data_storage: nil, post_call_analysis_data: nil, pronunciation_dictionary: nil, reminder_max_count: nil, reminder_trigger_ms: nil, responsiveness: nil, voice: nil, voice_model: nil, voice_speed: nil, voice_temperature: nil, voicemail_detection_timeout_ms: nil, voicemail_message: nil, volume: nil, webhook_url: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/retell/sdk/unofficial/api/agent.rb', line 10 def create( llm_websocket_url:, voice_id:, agent_name: nil, ambient_sound: nil, ambient_sound_volume: nil, backchannel_frequency: nil, backchannel_words: nil, boosted_keywords: nil, enable_backchannel: nil, enable_voicemail_detection: nil, end_call_after_silence_ms: nil, fallback_voice_ids: nil, fallback_voices: nil, interruption_sensitivity: nil, language: nil, max_call_duration_ms: nil, name: nil, normalize_for_speech: nil, opt_out_sensitive_data_storage: nil, post_call_analysis_data: nil, pronunciation_dictionary: nil, reminder_max_count: nil, reminder_trigger_ms: nil, responsiveness: nil, voice: nil, voice_model: nil, voice_speed: nil, voice_temperature: nil, voicemail_detection_timeout_ms: nil, voicemail_message: nil, volume: nil, webhook_url: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) agent_name = agent_name || name voice_id = voice_id || voice fallback_voice_ids = fallback_voice_ids || fallback_voices voice_id = voice_id.is_a?(Retell::SDK::Unofficial::Voice) ? voice_id.voice_id : voice_id fallback_voice_ids = fallback_voice_ids.is_a?(Array) ? verify_fallback_voice_ids(fallback_voice_ids) : fallback_voice_ids validate_voice_model(voice_model) validate_ambient_sound(ambient_sound) validate_language(language) validate_numeric_range(ambient_sound_volume, 'ambient_sound_volume', 0, 1) validate_numeric_range(backchannel_frequency, 'backchannel_frequency', 0, 1) validate_numeric_range(interruption_sensitivity, 'interruption_sensitivity', 0, 1) validate_numeric_range(responsiveness, 'responsiveness', 0, 1) validate_numeric_range(voice_speed, 'voice_speed', 0.5, 2) validate_numeric_range(voice_temperature, 'voice_temperature', 0, 2) validate_numeric_range(volume, 'volume', 0, 2) payload = { llm_websocket_url: llm_websocket_url, voice_id: voice_id, agent_name: agent_name, ambient_sound: ambient_sound, ambient_sound_volume: ambient_sound_volume&.to_f, backchannel_frequency: backchannel_frequency&.to_f, backchannel_words: backchannel_words, boosted_keywords: boosted_keywords, enable_backchannel: enable_backchannel, enable_voicemail_detection: enable_voicemail_detection, end_call_after_silence_ms: end_call_after_silence_ms, fallback_voice_ids: fallback_voice_ids, interruption_sensitivity: interruption_sensitivity&.to_f, language: language, max_call_duration_ms: max_call_duration_ms, normalize_for_speech: normalize_for_speech, opt_out_sensitive_data_storage: opt_out_sensitive_data_storage, post_call_analysis_data: post_call_analysis_data, pronunciation_dictionary: pronunciation_dictionary, reminder_max_count: reminder_max_count, reminder_trigger_ms: reminder_trigger_ms, responsiveness: responsiveness&.to_f, voice_model: voice_model, voice_speed: voice_speed&.to_f, voice_temperature: voice_temperature&.to_f, voicemail_detection_timeout_ms: voicemail_detection_timeout_ms, voicemail_message: , volume: volume&.to_f, webhook_url: webhook_url }.compact = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.post('/create-agent', payload, **) end |
#delete(agent_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/retell/sdk/unofficial/api/agent.rb', line 243 def delete( agent_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) agent_id = agent_or_id.is_a?(Retell::SDK::Unofficial::Agent) ? agent_or_id.agent_id : agent_or_id = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.delete("/delete-agent/#{agent_id}", **) nil end |
#list(extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/retell/sdk/unofficial/api/agent.rb', line 228 def list( extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.get('/list-agents', **) end |
#retrieve(agent_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/retell/sdk/unofficial/api/agent.rb', line 108 def retrieve( agent_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) agent_id = agent_or_id.is_a?(Retell::SDK::Unofficial::Agent) ? agent_or_id.agent_id : agent_or_id = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.get("/get-agent/#{agent_id}", **) end |
#update(agent_or_id, llm_websocket_url: nil, voice_id: nil, agent_name: nil, ambient_sound: nil, ambient_sound_volume: nil, backchannel_frequency: nil, backchannel_words: nil, boosted_keywords: nil, enable_backchannel: nil, enable_voicemail_detection: nil, end_call_after_silence_ms: nil, fallback_voices: nil, fallback_voice_ids: nil, interruption_sensitivity: nil, language: nil, max_call_duration_ms: nil, name: nil, normalize_for_speech: nil, opt_out_sensitive_data_storage: nil, post_call_analysis_data: nil, pronunciation_dictionary: nil, reminder_max_count: nil, reminder_trigger_ms: nil, responsiveness: nil, voice: nil, voice_model: nil, voice_speed: nil, voice_temperature: nil, voicemail_detection_timeout_ms: nil, voicemail_message: nil, volume: nil, webhook_url: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/retell/sdk/unofficial/api/agent.rb', line 127 def update( agent_or_id, llm_websocket_url: nil, voice_id: nil, agent_name: nil, ambient_sound: nil, ambient_sound_volume: nil, backchannel_frequency: nil, backchannel_words: nil, boosted_keywords: nil, enable_backchannel: nil, enable_voicemail_detection: nil, end_call_after_silence_ms: nil, fallback_voices: nil, fallback_voice_ids: nil, interruption_sensitivity: nil, language: nil, max_call_duration_ms: nil, name: nil, normalize_for_speech: nil, opt_out_sensitive_data_storage: nil, post_call_analysis_data: nil, pronunciation_dictionary: nil, reminder_max_count: nil, reminder_trigger_ms: nil, responsiveness: nil, voice: nil, voice_model: nil, voice_speed: nil, voice_temperature: nil, voicemail_detection_timeout_ms: nil, voicemail_message: nil, volume: nil, webhook_url: nil, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil ) agent_name = agent_name || name voice_id = voice_id || voice fallback_voice_ids = fallback_voice_ids || fallback_voices agent_id = agent_or_id.is_a?(Retell::SDK::Unofficial::Agent) ? agent_or_id.agent_id : agent_or_id voice_id = voice_id.is_a?(Retell::SDK::Unofficial::Voice) ? voice_id.voice_id : voice_id fallback_voice_ids = fallback_voice_ids.is_a?(Array) ? verify_fallback_voice_ids(fallback_voice_ids) : fallback_voice_ids validate_voice_model(voice_model) if voice_model validate_ambient_sound(ambient_sound) if ambient_sound validate_language(language) if language validate_numeric_range(ambient_sound_volume, 'ambient_sound_volume', 0, 1) if ambient_sound_volume validate_numeric_range(backchannel_frequency, 'backchannel_frequency', 0, 1) if backchannel_frequency validate_numeric_range(interruption_sensitivity, 'interruption_sensitivity', 0, 1) if interruption_sensitivity validate_numeric_range(responsiveness, 'responsiveness', 0, 1) if responsiveness validate_numeric_range(voice_speed, 'voice_speed', 0.5, 2) if voice_speed validate_numeric_range(voice_temperature, 'voice_temperature', 0, 2) if voice_temperature validate_numeric_range(volume, 'volume', 0, 2) if volume validate_pronunciation_dictionary(pronunciation_dictionary) if pronunciation_dictionary validate_post_call_analysis_data(post_call_analysis_data) if post_call_analysis_data payload = { llm_websocket_url: llm_websocket_url, voice_id: voice_id, agent_name: agent_name, ambient_sound: ambient_sound, ambient_sound_volume: ambient_sound_volume&.to_f, backchannel_frequency: backchannel_frequency&.to_f, backchannel_words: backchannel_words, boosted_keywords: boosted_keywords, enable_backchannel: enable_backchannel, enable_voicemail_detection: enable_voicemail_detection, end_call_after_silence_ms: end_call_after_silence_ms, fallback_voice_ids: fallback_voice_ids, interruption_sensitivity: interruption_sensitivity&.to_f, language: language, max_call_duration_ms: max_call_duration_ms, normalize_for_speech: normalize_for_speech, opt_out_sensitive_data_storage: opt_out_sensitive_data_storage, post_call_analysis_data: post_call_analysis_data, pronunciation_dictionary: pronunciation_dictionary, reminder_max_count: reminder_max_count, reminder_trigger_ms: reminder_trigger_ms, responsiveness: responsiveness&.to_f, voice_model: voice_model, voice_speed: voice_speed&.to_f, voice_temperature: voice_temperature&.to_f, voicemail_detection_timeout_ms: voicemail_detection_timeout_ms, voicemail_message: , webhook_url: webhook_url }.compact = @client.( extra_headers: extra_headers, extra_query: extra_query, extra_body: extra_body, timeout: timeout ) @client.patch("/update-agent/#{agent_id}", payload, **) end |