Class: Vapi::AssistantsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/assistants/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ Vapi::AssistantsClient

Parameters:



39
40
41
# File 'lib/vapi_server_sdk/assistants/client.rb', line 39

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientVapi::RequestClient (readonly)

Returns:



35
36
37
# File 'lib/vapi_server_sdk/assistants/client.rb', line 35

def request_client
  @request_client
end

Instance Method Details

#create(request:, request_options: nil) ⇒ Vapi::Assistant

Parameters:

  • request (Hash)

    Request of type Vapi::CreateAssistantDto, as a Hash

    • :transcriber (Hash)

    • :model (Hash)

    • :voice (Hash)

    • :first_message (String)

    • :first_message_interruptions_enabled (Boolean)

    • :first_message_mode (Vapi::CreateAssistantDtoFirstMessageMode)

    • :voicemail_detection (Hash)

    • :client_messages (Array<Vapi::CreateAssistantDtoClientMessagesItem>)

    • :server_messages (Array<Vapi::CreateAssistantDtoServerMessagesItem>)

    • :silence_timeout_seconds (Float)

    • :max_duration_seconds (Float)

    • :background_sound (Hash)

    • :background_denoising_enabled (Boolean)

    • :model_output_in_messages_enabled (Boolean)

    • :transport_configurations (Array<Vapi::TransportConfigurationTwilio>)

    • :observability_plan (Hash)

      • :provider (String)

      • :tags (Array<String>)

      • :metadata (Hash=> Object)

    • :credentials (Array<Vapi::CreateAssistantDtoCredentialsItem>)

    • :hooks (Array<Vapi::CreateAssistantDtoHooksItem>)

    • :name (String)

    • :voicemail_message (String)

    • :end_call_message (String)

    • :end_call_phrases (Array<String>)

    • :compliance_plan (Hash)

      • :hipaa_enabled (Boolean)

      • :pci_enabled (Boolean)

    • :metadata (Hash=> Object)

    • :background_speech_denoising_plan (Hash)

      • :smart_denoising_plan (Hash)

        • :enabled (Boolean)

      • :fourier_denoising_plan (Hash)

        • :enabled (Boolean)

        • :media_detection_enabled (Boolean)

        • :static_threshold (Float)

        • :baseline_offset_db (Float)

        • :window_size_ms (Float)

        • :baseline_percentile (Float)

    • :analysis_plan (Hash)

      • :min_messages_threshold (Float)

      • :summary_plan (Hash)

        • :messages (Array<Hash=> Object>)

        • :enabled (Boolean)

        • :timeout_seconds (Float)

      • :structured_data_plan (Hash)

        • :messages (Array<Hash=> Object>)

        • :enabled (Boolean)

        • :schema (Hash)

          • :type (Vapi::JsonSchemaType)

          • :items (Hash=> Object)

          • :properties (Hash=> Object)

          • :description (String)

          • :pattern (String)

          • :format (Vapi::JsonSchemaFormat)

          • :required (Array<String>)

          • :enum (Array<String>)

          • :title (String)

        • :timeout_seconds (Float)

      • :structured_data_multi_plan (Array<Vapi::StructuredDataMultiPlan>)

      • :success_evaluation_plan (Hash)

        • :rubric (Vapi::SuccessEvaluationPlanRubric)

        • :messages (Array<Hash=> Object>)

        • :enabled (Boolean)

        • :timeout_seconds (Float)

    • :artifact_plan (Hash)

      • :recording_enabled (Boolean)

      • :recording_format (Vapi::ArtifactPlanRecordingFormat)

      • :video_recording_enabled (Boolean)

      • :pcap_enabled (Boolean)

      • :pcap_s_3_path_prefix (String)

      • :transcript_plan (Hash)

        • :enabled (Boolean)

        • :assistant_name (String)

        • :user_name (String)

      • :recording_path (String)

    • :message_plan (Hash)

      • :idle_messages (Array<String>)

      • :idle_message_max_spoken_count (Float)

      • :idle_message_reset_count_on_user_speech_enabled (Boolean)

      • :idle_timeout_seconds (Float)

      • :silence_timeout_message (String)

    • :start_speaking_plan (Hash)

      • :wait_seconds (Float)

      • :smart_endpointing_enabled (Hash)

      • :smart_endpointing_plan (Hash)

      • :custom_endpointing_rules (Array<Vapi::StartSpeakingPlanCustomEndpointingRulesItem>)

      • :transcription_endpointing_plan (Hash)

        • :on_punctuation_seconds (Float)

        • :on_no_punctuation_seconds (Float)

        • :on_number_seconds (Float)

    • :stop_speaking_plan (Hash)

      • :num_words (Float)

      • :voice_seconds (Float)

      • :backoff_seconds (Float)

      • :acknowledgement_phrases (Array<String>)

      • :interruption_phrases (Array<String>)

    • :monitor_plan (Hash)

      • :listen_enabled (Boolean)

      • :listen_authentication_enabled (Boolean)

      • :control_enabled (Boolean)

      • :control_authentication_enabled (Boolean)

    • :credential_ids (Array<String>)

    • :server (Hash)

      • :timeout_seconds (Float)

      • :url (String)

      • :headers (Hash=> Object)

      • :backoff_plan (Hash)

        • :type (Hash=> Object)

        • :max_retries (Float)

        • :base_delay_seconds (Float)

    • :keypad_input_plan (Hash)

      • :enabled (Boolean)

      • :timeout_seconds (Float)

      • :delimiters (Vapi::KeypadInputPlanDelimiters)

  • request_options (Vapi::RequestOptions) (defaults to: nil)

Returns:



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/vapi_server_sdk/assistants/client.rb', line 210

def create(request:, request_options: nil)
  response = @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/assistant"
  end
  Vapi::Assistant.from_json(json_object: response.body)
end

#delete(id:, request_options: nil) ⇒ Vapi::Assistant

Parameters:

Returns:



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/vapi_server_sdk/assistants/client.rb', line 254

def delete(id:, request_options: nil)
  response = @request_client.conn.delete do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/assistant/#{id}"
  end
  Vapi::Assistant.from_json(json_object: response.body)
end

#get(id:, request_options: nil) ⇒ Vapi::Assistant

Parameters:

Returns:



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/vapi_server_sdk/assistants/client.rb', line 231

def get(id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/assistant/#{id}"
  end
  Vapi::Assistant.from_json(json_object: response.body)
end

#list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil, updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil) ⇒ Array<Vapi::Assistant>

Parameters:

  • limit (Float) (defaults to: nil)

    This is the maximum number of items to return. Defaults to 100.

  • created_at_gt (DateTime) (defaults to: nil)

    This will return items where the createdAt is greater than the specified value.

  • created_at_lt (DateTime) (defaults to: nil)

    This will return items where the createdAt is less than the specified value.

  • created_at_ge (DateTime) (defaults to: nil)

    This will return items where the createdAt is greater than or equal to the specified value.

  • created_at_le (DateTime) (defaults to: nil)

    This will return items where the createdAt is less than or equal to the specified value.

  • updated_at_gt (DateTime) (defaults to: nil)

    This will return items where the updatedAt is greater than the specified value.

  • updated_at_lt (DateTime) (defaults to: nil)

    This will return items where the updatedAt is less than the specified value.

  • updated_at_ge (DateTime) (defaults to: nil)

    This will return items where the updatedAt is greater than or equal to the specified value.

  • updated_at_le (DateTime) (defaults to: nil)

    This will return items where the updatedAt is less than or equal to the specified value.

  • request_options (Vapi::RequestOptions) (defaults to: nil)

Returns:



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
# File 'lib/vapi_server_sdk/assistants/client.rb', line 58

def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil,
         updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "limit": limit,
      "createdAtGt": created_at_gt,
      "createdAtLt": created_at_lt,
      "createdAtGe": created_at_ge,
      "createdAtLe": created_at_le,
      "updatedAtGt": updated_at_gt,
      "updatedAtLt": updated_at_lt,
      "updatedAtGe": updated_at_ge,
      "updatedAtLe": updated_at_le
    }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/assistant"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    Vapi::Assistant.from_json(json_object: item)
  end
end

#update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil, first_message_interruptions_enabled: nil, first_message_mode: nil, voicemail_detection: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, observability_plan: nil, credentials: nil, hooks: nil, name: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, compliance_plan: nil, metadata: nil, background_speech_denoising_plan: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, keypad_input_plan: nil, request_options: nil) ⇒ Vapi::Assistant

Parameters:

  • id (String)
  • transcriber (Vapi::Assistants::UpdateAssistantDtoTranscriber) (defaults to: nil)

    These are the options for the assistant’s transcriber.

  • model (Vapi::Assistants::UpdateAssistantDtoModel) (defaults to: nil)

    These are the options for the assistant’s LLM.

  • voice (Vapi::Assistants::UpdateAssistantDtoVoice) (defaults to: nil)

    These are the options for the assistant’s voice.

  • first_message (String) (defaults to: nil)

    This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

  • first_message_interruptions_enabled (Boolean) (defaults to: nil)
  • first_message_mode (Vapi::Assistants::UpdateAssistantDtoFirstMessageMode) (defaults to: nil)

    This is the mode for the first message. Default is ‘assistant-speaks-first’. Use:

    • ‘assistant-speaks-first’ to have the assistant speak first.

    • ‘assistant-waits-for-user’ to have the assistant wait for the user to speak

    first.

    • ‘assistant-speaks-first-with-model-generated-message’ to have the assistant

    speak first with a message generated by the model based on the conversation state. (‘assistant.model.messages` at call start, `call.messages` at squad transfer points). @default ’assistant-speaks-first’

  • voicemail_detection (Vapi::Assistants::UpdateAssistantDtoVoicemailDetection) (defaults to: nil)

    These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=. This uses Twilio’s built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.

  • client_messages (Array<Vapi::Assistants::UpdateAssistantDtoClientMessagesItem>) (defaults to: nil)

    These are the messages that will be sent to your Client SDKs. Default is update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started. You can check the shape of the messages in ClientMessage schema.

  • server_messages (Array<Vapi::Assistants::UpdateAssistantDtoServerMessagesItem>) (defaults to: nil)

    These are the messages that will be sent to your Server URL. Default is h-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.

  • silence_timeout_seconds (Float) (defaults to: nil)

    How many seconds of silence to wait before ending the call. Defaults to 30. @default 30

  • max_duration_seconds (Float) (defaults to: nil)

    This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. @default 600 (10 minutes)

  • background_sound (Vapi::Assistants::UpdateAssistantDtoBackgroundSoundZero, String) (defaults to: nil)

    This is the background sound in the call. Default for phone calls is ‘office’ and default for web calls is ‘off’. You can also provide a custom sound by providing a URL to an audio file.

  • background_denoising_enabled (Boolean) (defaults to: nil)

    This enables filtering of noise and background speech while the user is talking. Default ‘false` while in beta. @default false

  • model_output_in_messages_enabled (Boolean) (defaults to: nil)

    This determines whether the model’s output is used in conversation history rather than the transcription of assistant’s speech. Default ‘false` while in beta. @default false

  • transport_configurations (Array<Hash>) (defaults to: nil)

    These are the configurations to be passed to the transport providers of assistant’s calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.Request of type Array<Vapi::TransportConfigurationTwilio>, as a Hash

    * :provider (String)
    * :timeout (Float)
    * :record (Boolean)
    * :recording_channels (Vapi::TransportConfigurationTwilioRecordingChannels)
    
  • observability_plan (Hash) (defaults to: nil)

    This is the plan for observability of assistant’s calls. Currently, only Langfuse is supported.Request of type Vapi::LangfuseObservabilityPlan, as a Hash

    * :provider (String)
    * :tags (Array<String>)
    * :metadata (Hash{String => Object})
    
  • credentials (Array<Hash>) (defaults to: nil)

    These are dynamic credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can supplement an additional credentials using this. Dynamic credentials override existing credentials.Request of type Array<Vapi::Assistants::UpdateAssistantDtoCredentialsItem>, as a Hash

  • hooks (Array<Hash>) (defaults to: nil)

    This is a set of actions that will be performed on certain events.Request of type Array<Vapi::Assistants::UpdateAssistantDtoHooksItem>, as a Hash

  • name (String) (defaults to: nil)

    This is the name of the assistant. This is required when you want to transfer between assistants in a call.

  • voicemail_message (String) (defaults to: nil)

    This is the message that the assistant will say if the call is forwarded to voicemail. If unspecified, it will hang up.

  • end_call_message (String) (defaults to: nil)

    This is the message that the assistant will say if it ends the call. If unspecified, it will hang up without saying anything.

  • end_call_phrases (Array<String>) (defaults to: nil)

    This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.

  • compliance_plan (Hash) (defaults to: nil)

    Request of type Vapi::CompliancePlan, as a Hash

    • :hipaa_enabled (Boolean)

    • :pci_enabled (Boolean)

  • metadata (Hash{String => Object}) (defaults to: nil)

    This is for metadata you want to store on the assistant.

  • background_speech_denoising_plan (Hash) (defaults to: nil)

    This enables filtering of noise and background speech while the user is talking. Features:

    • Smart denoising using Krisp

    • Fourier denoising

    Smart denoising can be combined with or used independently of Fourier denoising. Order of precedence:

    • Smart denoising

    • Fourier denoisingRequest of type Vapi::BackgroundSpeechDenoisingPlan, as a Hash

    • :smart_denoising_plan (Hash)

      • :enabled (Boolean)

    • :fourier_denoising_plan (Hash)

      • :enabled (Boolean)

      • :media_detection_enabled (Boolean)

      • :static_threshold (Float)

      • :baseline_offset_db (Float)

      • :window_size_ms (Float)

      • :baseline_percentile (Float)

  • analysis_plan (Hash) (defaults to: nil)

    This is the plan for analysis of assistant’s calls. Stored in ‘call.analysis`.Request of type Vapi::AnalysisPlan, as a Hash

    • :min_messages_threshold (Float)

    • :summary_plan (Hash)

      • :messages (Array<Hash=> Object>)

      • :enabled (Boolean)

      • :timeout_seconds (Float)

    • :structured_data_plan (Hash)

      • :messages (Array<Hash=> Object>)

      • :enabled (Boolean)

      • :schema (Hash)

        • :type (Vapi::JsonSchemaType)

        • :items (Hash=> Object)

        • :properties (Hash=> Object)

        • :description (String)

        • :pattern (String)

        • :format (Vapi::JsonSchemaFormat)

        • :required (Array<String>)

        • :enum (Array<String>)

        • :title (String)

      • :timeout_seconds (Float)

    • :structured_data_multi_plan (Array<Vapi::StructuredDataMultiPlan>)

    • :success_evaluation_plan (Hash)

      • :rubric (Vapi::SuccessEvaluationPlanRubric)

      • :messages (Array<Hash=> Object>)

      • :enabled (Boolean)

      • :timeout_seconds (Float)

  • artifact_plan (Hash) (defaults to: nil)

    This is the plan for artifacts generated during assistant’s calls. Stored in ‘call.artifact`.Request of type Vapi::ArtifactPlan, as a Hash

    * :recording_enabled (Boolean)
    * :recording_format (Vapi::ArtifactPlanRecordingFormat)
    * :video_recording_enabled (Boolean)
    * :pcap_enabled (Boolean)
    * :pcap_s_3_path_prefix (String)
    * :transcript_plan (Hash)
      * :enabled (Boolean)
      * :assistant_name (String)
      * :user_name (String)
    * :recording_path (String)
    
  • message_plan (Hash) (defaults to: nil)

    This is the plan for static predefined messages that can be spoken by the assistant during the call, like ‘idleMessages`. Note: `firstMessage`, `voicemailMessage`, and `endCallMessage` are currently at the root level. They will be moved to `messagePlan` in the future, but will remain backwards compatible.Request of type Vapi::MessagePlan, as a Hash

    * :idle_messages (Array<String>)
    * :idle_message_max_spoken_count (Float)
    * :idle_message_reset_count_on_user_speech_enabled (Boolean)
    * :idle_timeout_seconds (Float)
    * :silence_timeout_message (String)
    
  • start_speaking_plan (Hash) (defaults to: nil)

    This is the plan for when the assistant should start talking. You should configure this if you’re running into these issues:

    • The assistant is too slow to start talking after the customer is done

    speaking.

    • The assistant is too fast to start talking after the customer is done

    speaking.

    • The assistant is so fast that it’s actually interrupting the customer.Request of type Vapi::StartSpeakingPlan, as a Hash

    • :wait_seconds (Float)

    • :smart_endpointing_enabled (Hash)

    • :smart_endpointing_plan (Hash)

    • :custom_endpointing_rules (Array<Vapi::StartSpeakingPlanCustomEndpointingRulesItem>)

    • :transcription_endpointing_plan (Hash)

      • :on_punctuation_seconds (Float)

      • :on_no_punctuation_seconds (Float)

      • :on_number_seconds (Float)

  • stop_speaking_plan (Hash) (defaults to: nil)

    This is the plan for when assistant should stop talking on customer interruption. You should configure this if you’re running into these issues:

    • The assistant is too slow to recognize customer’s interruption.

    • The assistant is too fast to recognize customer’s interruption.

    • The assistant is getting interrupted by phrases that are just acknowledgments.

    • The assistant is getting interrupted by background noises.

    • The assistant is not properly stopping – it starts talking right after

    getting interrupted.Request of type Vapi::StopSpeakingPlan, as a Hash

    * :num_words (Float)
    * :voice_seconds (Float)
    * :backoff_seconds (Float)
    * :acknowledgement_phrases (Array<String>)
    * :interruption_phrases (Array<String>)
    
  • monitor_plan (Hash) (defaults to: nil)

    This is the plan for real-time monitoring of the assistant’s calls. Usage:

    • To enable live listening of the assistant’s calls, set

    ‘monitorPlan.listenEnabled` to `true`.

    • To enable live control of the assistant’s calls, set

    ‘monitorPlan.controlEnabled` to `true`.Request of type Vapi::MonitorPlan, as a Hash

    * :listen_enabled (Boolean)
    * :listen_authentication_enabled (Boolean)
    * :control_enabled (Boolean)
    * :control_authentication_enabled (Boolean)
    
  • credential_ids (Array<String>) (defaults to: nil)

    These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.

  • server (Hash) (defaults to: nil)

    This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema. The order of precedence is:

    1. assistant.server.url

    2. phoneNumber.serverUrl

    3. org.serverUrlRequest of type Vapi::Server, as a Hash

    * :timeout_seconds (Float)
    * :url (String)
    * :headers (Hash{String => Object})
    * :backoff_plan (Hash)
      * :type (Hash{String => Object})
      * :max_retries (Float)
      * :base_delay_seconds (Float)
    
  • keypad_input_plan (Hash) (defaults to: nil)

    Request of type Vapi::KeypadInputPlan, as a Hash

    • :enabled (Boolean)

    • :timeout_seconds (Float)

    • :delimiters (Vapi::KeypadInputPlanDelimiters)

  • request_options (Vapi::RequestOptions) (defaults to: nil)

Returns:



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/vapi_server_sdk/assistants/client.rb', line 478

def update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil,
           first_message_interruptions_enabled: nil, first_message_mode: nil, voicemail_detection: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, observability_plan: nil, credentials: nil, hooks: nil, name: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, compliance_plan: nil, metadata: nil, background_speech_denoising_plan: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, keypad_input_plan: nil, request_options: nil)
  response = @request_client.conn.patch do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      transcriber: transcriber,
      model: model,
      voice: voice,
      firstMessage: first_message,
      firstMessageInterruptionsEnabled: first_message_interruptions_enabled,
      firstMessageMode: first_message_mode,
      voicemailDetection: voicemail_detection,
      clientMessages: client_messages,
      serverMessages: server_messages,
      silenceTimeoutSeconds: silence_timeout_seconds,
      maxDurationSeconds: max_duration_seconds,
      backgroundSound: background_sound,
      backgroundDenoisingEnabled: background_denoising_enabled,
      modelOutputInMessagesEnabled: model_output_in_messages_enabled,
      transportConfigurations: transport_configurations,
      observabilityPlan: observability_plan,
      credentials: credentials,
      hooks: hooks,
      name: name,
      voicemailMessage: voicemail_message,
      endCallMessage: end_call_message,
      endCallPhrases: end_call_phrases,
      compliancePlan: compliance_plan,
      metadata: ,
      backgroundSpeechDenoisingPlan: background_speech_denoising_plan,
      analysisPlan: analysis_plan,
      artifactPlan: artifact_plan,
      messagePlan: message_plan,
      startSpeakingPlan: start_speaking_plan,
      stopSpeakingPlan: stop_speaking_plan,
      monitorPlan: monitor_plan,
      credentialIds: credential_ids,
      server: server,
      keypadInputPlan: keypad_input_plan
    }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/assistant/#{id}"
  end
  Vapi::Assistant.from_json(json_object: response.body)
end