Class: Vapi::ModelBasedCondition
- Inherits:
-
Object
- Object
- Vapi::ModelBasedCondition
- Defined in:
- lib/vapi_server_sdk/types/model_based_condition.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#instruction ⇒ String
readonly
This is the instruction which should output a boolean value when passed to a model.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ModelBasedCondition
Deserialize a JSON object to an instance of ModelBasedCondition.
-
.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.
Instance Method Summary collapse
- #initialize(instruction:, additional_properties: nil) ⇒ Vapi::ModelBasedCondition constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ModelBasedCondition to a JSON object.
Constructor Details
#initialize(instruction:, additional_properties: nil) ⇒ Vapi::ModelBasedCondition
83 84 85 86 87 |
# File 'lib/vapi_server_sdk/types/model_based_condition.rb', line 83 def initialize(instruction:, additional_properties: nil) @instruction = instruction @additional_properties = additional_properties @_field_set = { "instruction": instruction } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
42 43 44 |
# File 'lib/vapi_server_sdk/types/model_based_condition.rb', line 42 def additional_properties @additional_properties end |
#instruction ⇒ String (readonly)
Returns This is the instruction which should output a boolean value when passed to a model. You can reference any variable in the context of the current block execution (step):
-
“Vapi::ModelBasedCondition.{output{output.your-property-name}” for current step’s output
-
“Vapi::ModelBasedCondition.{input{input.your-property-name}” for current step’s input
-
“Vapi::ModelBasedCondition.{your-step-name{your-step-name.output{your-step-name.output.your-property-name}” for another step’s output (in
the same workflow; read caveat #1)
-
“Vapi::ModelBasedCondition.{your-step-name{your-step-name.input{your-step-name.input.your-property-name}” for another step’s input (in the
same workflow; read caveat #1)
-
“Vapi::ModelBasedCondition.{your-block-name{your-block-name.output{your-block-name.output.your-property-name}” for another block’s output (in
the same workflow; read caveat #2)
-
“Vapi::ModelBasedCondition.{your-block-name{your-block-name.input{your-block-name.input.your-property-name}” for another block’s input (in
the same workflow; read caveat #2)
-
“Vapi::ModelBasedCondition.{workflow{workflow.input{workflow.input.your-property-name}” for the current workflow’s input
-
“Vapi::ModelBasedCondition.{global{global.your-property-name}” for the global context
You can also talk about the current step’s output or input directly:
-
“Vapi::ModelBasedCondition.{output{output.your-property-name} is greater than 10”
-
“Vapi::ModelBasedCondition.{input{input.your-property-name} is greater than 10”
Examples:
-
“Vapi::ModelBasedCondition.{input{input.age} is greater than 10”
-
“Vapi::ModelBasedCondition.{input{input.age} is greater than Vapi::ModelBasedCondition.{input{input.age2}”
-
“Vapi::ModelBasedCondition.{output{output.age} is greater than 10”
Caveats:
-
a workflow can execute a step multiple times. example, if a loop is used in
the graph. Vapi::ModelBasedCondition.{stepName{stepName.input/output{stepName.input/output.propertyName} will reference the latest usage of the step.
-
a workflow can execute a block multiple times. example, if a step is called
multiple times or if a block is used in multiple steps. Vapi::ModelBasedCondition.{blockName{blockName.input/output{blockName.input/output.propertyName} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
40 41 42 |
# File 'lib/vapi_server_sdk/types/model_based_condition.rb', line 40 def instruction @instruction end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ModelBasedCondition
Deserialize a JSON object to an instance of ModelBasedCondition
93 94 95 96 97 98 |
# File 'lib/vapi_server_sdk/types/model_based_condition.rb', line 93 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) instruction = parsed_json["instruction"] new(instruction: instruction, 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.
113 114 115 |
# File 'lib/vapi_server_sdk/types/model_based_condition.rb', line 113 def self.validate_raw(obj:) obj.instruction.is_a?(String) != false || raise("Passed value for field obj.instruction is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ModelBasedCondition to a JSON object
103 104 105 |
# File 'lib/vapi_server_sdk/types/model_based_condition.rb', line 103 def to_json(*_args) @_field_set&.to_json end |