Class: Vapi::TranscriptPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/transcript_plan.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled: OMIT, assistant_name: OMIT, user_name: OMIT, additional_properties: nil) ⇒ Vapi::TranscriptPlan

Parameters:

  • enabled (Boolean) (defaults to: OMIT)

    This determines whether the transcript is stored in ‘call.artifact.transcript`. Defaults to true. @default true

  • assistant_name (String) (defaults to: OMIT)

    This is the name of the assistant in the transcript. Defaults to ‘AI’. Usage:

    • If you want to change the name of the assistant in the transcript, set this.

    Example, here is what the transcript would look like with ‘assistantName` set to ’Buyer’: “‘ User: Hello, how are you? Buyer: I’m fine. User: Do you want to buy a car? Buyer: No. “‘ @default ’AI’

  • user_name (String) (defaults to: OMIT)

    This is the name of the user in the transcript. Defaults to ‘User’. Usage:

    • If you want to change the name of the user in the transcript, set this.

    Example, here is what the transcript would look like with ‘userName` set to ’Seller’: “‘ Seller: Hello, how are you? AI: I’m fine. Seller: Do you want to buy a car? AI: No. “‘ @default ’User’

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



75
76
77
78
79
80
81
82
83
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 75

def initialize(enabled: OMIT, assistant_name: OMIT, user_name: OMIT, additional_properties: nil)
  @enabled = enabled if enabled != OMIT
  @assistant_name = assistant_name if assistant_name != OMIT
  @user_name = user_name if user_name != OMIT
  @additional_properties = additional_properties
  @_field_set = { "enabled": enabled, "assistantName": assistant_name, "userName": user_name }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



39
40
41
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 39

def additional_properties
  @additional_properties
end

#assistant_nameString (readonly)

Returns This is the name of the assistant in the transcript. Defaults to ‘AI’. Usage:

  • If you want to change the name of the assistant in the transcript, set this.

Example, here is what the transcript would look like with ‘assistantName` set to ’Buyer’: “‘ User: Hello, how are you? Buyer: I’m fine. User: Do you want to buy a car? Buyer: No. “‘ @default ’AI’.

Returns:

  • (String)

    This is the name of the assistant in the transcript. Defaults to ‘AI’. Usage:

    • If you want to change the name of the assistant in the transcript, set this.

    Example, here is what the transcript would look like with ‘assistantName` set to ’Buyer’: “‘ User: Hello, how are you? Buyer: I’m fine. User: Do you want to buy a car? Buyer: No. “‘ @default ’AI’



24
25
26
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 24

def assistant_name
  @assistant_name
end

#enabledBoolean (readonly)

Returns This determines whether the transcript is stored in ‘call.artifact.transcript`. Defaults to true. @default true.

Returns:

  • (Boolean)

    This determines whether the transcript is stored in ‘call.artifact.transcript`. Defaults to true. @default true



11
12
13
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 11

def enabled
  @enabled
end

#user_nameString (readonly)

Returns This is the name of the user in the transcript. Defaults to ‘User’. Usage:

  • If you want to change the name of the user in the transcript, set this.

Example, here is what the transcript would look like with ‘userName` set to ’Seller’: “‘ Seller: Hello, how are you? AI: I’m fine. Seller: Do you want to buy a car? AI: No. “‘ @default ’User’.

Returns:

  • (String)

    This is the name of the user in the transcript. Defaults to ‘User’. Usage:

    • If you want to change the name of the user in the transcript, set this.

    Example, here is what the transcript would look like with ‘userName` set to ’Seller’: “‘ Seller: Hello, how are you? AI: I’m fine. Seller: Do you want to buy a car? AI: No. “‘ @default ’User’



37
38
39
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 37

def user_name
  @user_name
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TranscriptPlan

Deserialize a JSON object to an instance of TranscriptPlan

Parameters:

  • json_object (String)

Returns:



89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 89

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  enabled = parsed_json["enabled"]
  assistant_name = parsed_json["assistantName"]
  user_name = parsed_json["userName"]
  new(
    enabled: enabled,
    assistant_name: assistant_name,
    user_name: user_name,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


116
117
118
119
120
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 116

def self.validate_raw(obj:)
  obj.enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.enabled is not the expected type, validation failed.")
  obj.assistant_name&.is_a?(String) != false || raise("Passed value for field obj.assistant_name is not the expected type, validation failed.")
  obj.user_name&.is_a?(String) != false || raise("Passed value for field obj.user_name is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TranscriptPlan to a JSON object

Returns:

  • (String)


106
107
108
# File 'lib/vapi_server_sdk/types/transcript_plan.rb', line 106

def to_json(*_args)
  @_field_set&.to_json
end