Class: Vapi::Analysis

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(summary: OMIT, structured_data: OMIT, success_evaluation: OMIT, additional_properties: nil) ⇒ Vapi::Analysis

Parameters:

  • summary (String) (defaults to: OMIT)

    This is the summary of the call. Customize by setting assistant.analysisPlan.summaryPrompt.

  • structured_data (Hash{String => Object}) (defaults to: OMIT)

    This is the structured data extracted from the call. Customize by setting assistant.analysisPlan.structuredDataPrompt and/or assistant.analysisPlan.structuredDataSchema.

  • success_evaluation (String) (defaults to: OMIT)

    This is the evaluation of the call. Customize by setting assistant.analysisPlan.successEvaluationPrompt and/or assistant.analysisPlan.successEvaluationRubric.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vapi_server_sdk/types/analysis.rb', line 37

def initialize(summary: OMIT, structured_data: OMIT, success_evaluation: OMIT, additional_properties: nil)
  @summary = summary if summary != OMIT
  @structured_data = structured_data if structured_data != OMIT
  @success_evaluation = success_evaluation if success_evaluation != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "summary": summary,
    "structuredData": structured_data,
    "successEvaluation": success_evaluation
  }.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



20
21
22
# File 'lib/vapi_server_sdk/types/analysis.rb', line 20

def additional_properties
  @additional_properties
end

#structured_dataHash{String => Object} (readonly)

Returns This is the structured data extracted from the call. Customize by setting assistant.analysisPlan.structuredDataPrompt and/or assistant.analysisPlan.structuredDataSchema.

Returns:

  • (Hash{String => Object})

    This is the structured data extracted from the call. Customize by setting assistant.analysisPlan.structuredDataPrompt and/or assistant.analysisPlan.structuredDataSchema.



14
15
16
# File 'lib/vapi_server_sdk/types/analysis.rb', line 14

def structured_data
  @structured_data
end

#success_evaluationString (readonly)

Returns This is the evaluation of the call. Customize by setting assistant.analysisPlan.successEvaluationPrompt and/or assistant.analysisPlan.successEvaluationRubric.

Returns:

  • (String)

    This is the evaluation of the call. Customize by setting assistant.analysisPlan.successEvaluationPrompt and/or assistant.analysisPlan.successEvaluationRubric.



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

def success_evaluation
  @success_evaluation
end

#summaryString (readonly)

Returns This is the summary of the call. Customize by setting assistant.analysisPlan.summaryPrompt.

Returns:

  • (String)

    This is the summary of the call. Customize by setting assistant.analysisPlan.summaryPrompt.



10
11
12
# File 'lib/vapi_server_sdk/types/analysis.rb', line 10

def summary
  @summary
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::Analysis

Deserialize a JSON object to an instance of Analysis

Parameters:

  • json_object (String)

Returns:



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vapi_server_sdk/types/analysis.rb', line 55

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  summary = parsed_json["summary"]
  structured_data = parsed_json["structuredData"]
  success_evaluation = parsed_json["successEvaluation"]
  new(
    summary: summary,
    structured_data: structured_data,
    success_evaluation: success_evaluation,
    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)


82
83
84
85
86
# File 'lib/vapi_server_sdk/types/analysis.rb', line 82

def self.validate_raw(obj:)
  obj.summary&.is_a?(String) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.")
  obj.structured_data&.is_a?(Hash) != false || raise("Passed value for field obj.structured_data is not the expected type, validation failed.")
  obj.success_evaluation&.is_a?(String) != false || raise("Passed value for field obj.success_evaluation is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Analysis to a JSON object

Returns:

  • (String)


72
73
74
# File 'lib/vapi_server_sdk/types/analysis.rb', line 72

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