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, structured_data_multi: 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`.

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

    This is the structured data catalog of the call. Customize by setting ‘assistant.analysisPlan.structuredDataMultiPlan`.

  • 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



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vapi_server_sdk/types/analysis.rb', line 42

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



23
24
25
# File 'lib/vapi_server_sdk/types/analysis.rb', line 23

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

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

Returns This is the structured data catalog of the call. Customize by setting ‘assistant.analysisPlan.structuredDataMultiPlan`.

Returns:

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

    This is the structured data catalog of the call. Customize by setting ‘assistant.analysisPlan.structuredDataMultiPlan`.



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

def structured_data_multi
  @structured_data_multi
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`.



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

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:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/vapi_server_sdk/types/analysis.rb', line 63

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"]
  structured_data_multi = parsed_json["structuredDataMulti"]
  success_evaluation = parsed_json["successEvaluation"]
  new(
    summary: summary,
    structured_data: structured_data,
    structured_data_multi: structured_data_multi,
    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)


92
93
94
95
96
97
# File 'lib/vapi_server_sdk/types/analysis.rb', line 92

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.structured_data_multi&.is_a?(Array) != false || raise("Passed value for field obj.structured_data_multi 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)


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

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