Class: Vapi::SummaryPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(messages: OMIT, enabled: OMIT, timeout_seconds: OMIT, additional_properties: nil) ⇒ Vapi::SummaryPlan

Parameters:

  • messages (Array<Hash{String => Object}>) (defaults to: OMIT)

    These are the messages used to generate the summary. @default: ‘ [ { “role”: “system”, “content”: “You are an expert note-taker. You will be given a transcript of a call. Summarize the call in 2-3 sentences. DO NOT return anything except the summary.” }, { “role”: “user”, “content”: “Here is the transcript:nn{transcript}nn” } ]` You can customize by providing any messages you want. Here are the template variables available:

    • {transcript}: The transcript of the call from ‘call.artifact.transcript`-

    {systemPrompt}: The system prompt of the call from ‘assistant.model.messages.content`

  • enabled (Boolean) (defaults to: OMIT)

    This determines whether a summary is generated and stored in ‘call.analysis.summary`. Defaults to true. Usage:

    • If you want to disable the summary, set this to false.

    @default true

  • timeout_seconds (Float) (defaults to: OMIT)

    This is how long the request is tried before giving up. When request times out, ‘call.analysis.summary` will be empty. Usage:

    • To guarantee the summary is generated, set this value high. Note, this will

    delay the end of call report in cases where model is slow to respond. @default 5 seconds

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



63
64
65
66
67
68
69
70
71
# File 'lib/vapi_server_sdk/types/summary_plan.rb', line 63

def initialize(messages: OMIT, enabled: OMIT, timeout_seconds: OMIT, additional_properties: nil)
  @messages = messages if messages != OMIT
  @enabled = enabled if enabled != OMIT
  @timeout_seconds = timeout_seconds if timeout_seconds != OMIT
  @additional_properties = additional_properties
  @_field_set = { "messages": messages, "enabled": enabled, "timeoutSeconds": timeout_seconds }.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



33
34
35
# File 'lib/vapi_server_sdk/types/summary_plan.rb', line 33

def additional_properties
  @additional_properties
end

#enabledBoolean (readonly)

Returns This determines whether a summary is generated and stored in ‘call.analysis.summary`. Defaults to true. Usage:

  • If you want to disable the summary, set this to false.

@default true.

Returns:

  • (Boolean)

    This determines whether a summary is generated and stored in ‘call.analysis.summary`. Defaults to true. Usage:

    • If you want to disable the summary, set this to false.

    @default true



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

def enabled
  @enabled
end

#messagesArray<Hash{String => Object}> (readonly)

Returns These are the messages used to generate the summary. @default: ‘ [ { “role”: “system”, “content”: “You are an expert note-taker. You will be given a transcript of a call. Summarize the call in 2-3 sentences. DO NOT return anything except the summary.” }, { “role”: “user”, “content”: “Here is the transcript:nn{transcript}nn” } ]` You can customize by providing any messages you want. Here are the template variables available:

  • {transcript}: The transcript of the call from ‘call.artifact.transcript`-

{systemPrompt}: The system prompt of the call from ‘assistant.model.messages.content`.

Returns:

  • (Array<Hash{String => Object}>)

    These are the messages used to generate the summary. @default: ‘ [ { “role”: “system”, “content”: “You are an expert note-taker. You will be given a transcript of a call. Summarize the call in 2-3 sentences. DO NOT return anything except the summary.” }, { “role”: “user”, “content”: “Here is the transcript:nn{transcript}nn” } ]` You can customize by providing any messages you want. Here are the template variables available:

    • {transcript}: The transcript of the call from ‘call.artifact.transcript`-

    {systemPrompt}: The system prompt of the call from ‘assistant.model.messages.content`



18
19
20
# File 'lib/vapi_server_sdk/types/summary_plan.rb', line 18

def messages
  @messages
end

#timeout_secondsFloat (readonly)

Returns This is how long the request is tried before giving up. When request times out, ‘call.analysis.summary` will be empty. Usage:

  • To guarantee the summary is generated, set this value high. Note, this will

delay the end of call report in cases where model is slow to respond. @default 5 seconds.

Returns:

  • (Float)

    This is how long the request is tried before giving up. When request times out, ‘call.analysis.summary` will be empty. Usage:

    • To guarantee the summary is generated, set this value high. Note, this will

    delay the end of call report in cases where model is slow to respond. @default 5 seconds



31
32
33
# File 'lib/vapi_server_sdk/types/summary_plan.rb', line 31

def timeout_seconds
  @timeout_seconds
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::SummaryPlan

Deserialize a JSON object to an instance of SummaryPlan

Parameters:

  • json_object (String)

Returns:



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/vapi_server_sdk/types/summary_plan.rb', line 77

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


104
105
106
107
108
# File 'lib/vapi_server_sdk/types/summary_plan.rb', line 104

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of SummaryPlan to a JSON object

Returns:

  • (String)


94
95
96
# File 'lib/vapi_server_sdk/types/summary_plan.rb', line 94

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