Class: Vapi::AnalysisPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(min_messages_threshold: OMIT, summary_plan: OMIT, structured_data_plan: OMIT, structured_data_multi_plan: OMIT, success_evaluation_plan: OMIT, additional_properties: nil) ⇒ Vapi::AnalysisPlan

Parameters:

  • min_messages_threshold (Float) (defaults to: OMIT)

    The minimum number of messages required to run the analysis plan. If the number of messages is less than this, analysis will be skipped. @default 2

  • summary_plan (Vapi::SummaryPlan) (defaults to: OMIT)

    This is the plan for generating the summary of the call. This outputs to ‘call.analysis.summary`.

  • structured_data_plan (Vapi::StructuredDataPlan) (defaults to: OMIT)

    This is the plan for generating the structured data from the call. This outputs to ‘call.analysis.structuredData`.

  • structured_data_multi_plan (Array<Vapi::StructuredDataMultiPlan>) (defaults to: OMIT)

    This is an array of structured data plan catalogs. Each entry includes a ‘key` and a `plan` for generating the structured data from the call. This outputs to `call.analysis.structuredDataMulti`.

  • success_evaluation_plan (Vapi::SuccessEvaluationPlan) (defaults to: OMIT)

    This is the plan for generating the success evaluation of the call. This outputs to ‘call.analysis.successEvaluation`.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 51

def initialize(min_messages_threshold: OMIT, summary_plan: OMIT, structured_data_plan: OMIT,
               structured_data_multi_plan: OMIT, success_evaluation_plan: OMIT, additional_properties: nil)
  @min_messages_threshold = min_messages_threshold if min_messages_threshold != OMIT
  @summary_plan = summary_plan if summary_plan != OMIT
  @structured_data_plan = structured_data_plan if structured_data_plan != OMIT
  @structured_data_multi_plan = structured_data_multi_plan if structured_data_multi_plan != OMIT
  @success_evaluation_plan = success_evaluation_plan if success_evaluation_plan != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "minMessagesThreshold": min_messages_threshold,
    "summaryPlan": summary_plan,
    "structuredDataPlan": structured_data_plan,
    "structuredDataMultiPlan": structured_data_multi_plan,
    "successEvaluationPlan": success_evaluation_plan
  }.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



30
31
32
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 30

def additional_properties
  @additional_properties
end

#min_messages_thresholdFloat (readonly)

Returns The minimum number of messages required to run the analysis plan. If the number of messages is less than this, analysis will be skipped. @default 2.

Returns:

  • (Float)

    The minimum number of messages required to run the analysis plan. If the number of messages is less than this, analysis will be skipped. @default 2



15
16
17
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 15

def min_messages_threshold
  @min_messages_threshold
end

#structured_data_multi_planArray<Vapi::StructuredDataMultiPlan> (readonly)

Returns This is an array of structured data plan catalogs. Each entry includes a ‘key` and a `plan` for generating the structured data from the call. This outputs to `call.analysis.structuredDataMulti`.

Returns:

  • (Array<Vapi::StructuredDataMultiPlan>)

    This is an array of structured data plan catalogs. Each entry includes a ‘key` and a `plan` for generating the structured data from the call. This outputs to `call.analysis.structuredDataMulti`.



25
26
27
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 25

def structured_data_multi_plan
  @structured_data_multi_plan
end

#structured_data_planVapi::StructuredDataPlan (readonly)

Returns This is the plan for generating the structured data from the call. This outputs to ‘call.analysis.structuredData`.

Returns:

  • (Vapi::StructuredDataPlan)

    This is the plan for generating the structured data from the call. This outputs to ‘call.analysis.structuredData`.



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

def structured_data_plan
  @structured_data_plan
end

#success_evaluation_planVapi::SuccessEvaluationPlan (readonly)

Returns This is the plan for generating the success evaluation of the call. This outputs to ‘call.analysis.successEvaluation`.

Returns:

  • (Vapi::SuccessEvaluationPlan)

    This is the plan for generating the success evaluation of the call. This outputs to ‘call.analysis.successEvaluation`.



28
29
30
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 28

def success_evaluation_plan
  @success_evaluation_plan
end

#summary_planVapi::SummaryPlan (readonly)

Returns This is the plan for generating the summary of the call. This outputs to ‘call.analysis.summary`.

Returns:

  • (Vapi::SummaryPlan)

    This is the plan for generating the summary of the call. This outputs to ‘call.analysis.summary`.



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

def summary_plan
  @summary_plan
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::AnalysisPlan

Deserialize a JSON object to an instance of AnalysisPlan

Parameters:

  • json_object (String)

Returns:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 74

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  min_messages_threshold = parsed_json["minMessagesThreshold"]
  if parsed_json["summaryPlan"].nil?
    summary_plan = nil
  else
    summary_plan = parsed_json["summaryPlan"].to_json
    summary_plan = Vapi::SummaryPlan.from_json(json_object: summary_plan)
  end
  if parsed_json["structuredDataPlan"].nil?
    structured_data_plan = nil
  else
    structured_data_plan = parsed_json["structuredDataPlan"].to_json
    structured_data_plan = Vapi::StructuredDataPlan.from_json(json_object: structured_data_plan)
  end
  structured_data_multi_plan = parsed_json["structuredDataMultiPlan"]&.map do |item|
    item = item.to_json
    Vapi::StructuredDataMultiPlan.from_json(json_object: item)
  end
  if parsed_json["successEvaluationPlan"].nil?
    success_evaluation_plan = nil
  else
    success_evaluation_plan = parsed_json["successEvaluationPlan"].to_json
    success_evaluation_plan = Vapi::SuccessEvaluationPlan.from_json(json_object: success_evaluation_plan)
  end
  new(
    min_messages_threshold: min_messages_threshold,
    summary_plan: summary_plan,
    structured_data_plan: structured_data_plan,
    structured_data_multi_plan: structured_data_multi_plan,
    success_evaluation_plan: success_evaluation_plan,
    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)


123
124
125
126
127
128
129
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 123

def self.validate_raw(obj:)
  obj.min_messages_threshold&.is_a?(Float) != false || raise("Passed value for field obj.min_messages_threshold is not the expected type, validation failed.")
  obj.summary_plan.nil? || Vapi::SummaryPlan.validate_raw(obj: obj.summary_plan)
  obj.structured_data_plan.nil? || Vapi::StructuredDataPlan.validate_raw(obj: obj.structured_data_plan)
  obj.structured_data_multi_plan&.is_a?(Array) != false || raise("Passed value for field obj.structured_data_multi_plan is not the expected type, validation failed.")
  obj.success_evaluation_plan.nil? || Vapi::SuccessEvaluationPlan.validate_raw(obj: obj.success_evaluation_plan)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AnalysisPlan to a JSON object

Returns:

  • (String)


113
114
115
# File 'lib/vapi_server_sdk/types/analysis_plan.rb', line 113

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