Class: Vapi::TesterPlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assistant: OMIT, assistant_id: OMIT, assistant_overrides: OMIT, additional_properties: nil) ⇒ Vapi::TesterPlan

Parameters:

  • assistant (Vapi::CreateAssistantDto) (defaults to: OMIT)

    Pass a transient assistant to use for the test assistant. Make sure to write a detailed system prompt for a test assistant, and use the Vapi::TesterPlan.{test{test.script} variable to access the test script.

  • assistant_id (String) (defaults to: OMIT)

    Pass an assistant id that can be access Make sure to write a detailed system prompt for the test assistant, and use the Vapi::TesterPlan.{test{test.script} variable to access the test script.

  • assistant_overrides (Vapi::AssistantOverrides) (defaults to: OMIT)

    Add any assistant overrides to the test assistant. One use case is if you want to pass custom variables into the test using variableValues, that you can then access in the script and rubric using {varName}.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(assistant: OMIT, assistant_id: OMIT, assistant_overrides: OMIT, additional_properties: nil)
  @assistant = assistant if assistant != OMIT
  @assistant_id = assistant_id if assistant_id != OMIT
  @assistant_overrides = assistant_overrides if assistant_overrides != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "assistant": assistant,
    "assistantId": assistant_id,
    "assistantOverrides": assistant_overrides
  }.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



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

def additional_properties
  @additional_properties
end

#assistantVapi::CreateAssistantDto (readonly)

Returns Pass a transient assistant to use for the test assistant. Make sure to write a detailed system prompt for a test assistant, and use the Vapi::TesterPlan.{test{test.script} variable to access the test script.

Returns:

  • (Vapi::CreateAssistantDto)

    Pass a transient assistant to use for the test assistant. Make sure to write a detailed system prompt for a test assistant, and use the Vapi::TesterPlan.{test{test.script} variable to access the test script.



13
14
15
# File 'lib/vapi_server_sdk/types/tester_plan.rb', line 13

def assistant
  @assistant
end

#assistant_idString (readonly)

Returns Pass an assistant id that can be access Make sure to write a detailed system prompt for the test assistant, and use the Vapi::TesterPlan.{test{test.script} variable to access the test script.

Returns:

  • (String)

    Pass an assistant id that can be access Make sure to write a detailed system prompt for the test assistant, and use the Vapi::TesterPlan.{test{test.script} variable to access the test script.



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

def assistant_id
  @assistant_id
end

#assistant_overridesVapi::AssistantOverrides (readonly)

Returns Add any assistant overrides to the test assistant. One use case is if you want to pass custom variables into the test using variableValues, that you can then access in the script and rubric using {varName}.

Returns:

  • (Vapi::AssistantOverrides)

    Add any assistant overrides to the test assistant. One use case is if you want to pass custom variables into the test using variableValues, that you can then access in the script and rubric using {varName}.



22
23
24
# File 'lib/vapi_server_sdk/types/tester_plan.rb', line 22

def assistant_overrides
  @assistant_overrides
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::TesterPlan

Deserialize a JSON object to an instance of TesterPlan

Parameters:

  • json_object (String)

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/vapi_server_sdk/types/tester_plan.rb', line 61

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["assistant"].nil?
    assistant = nil
  else
    assistant = parsed_json["assistant"].to_json
    assistant = Vapi::CreateAssistantDto.from_json(json_object: assistant)
  end
  assistant_id = parsed_json["assistantId"]
  if parsed_json["assistantOverrides"].nil?
    assistant_overrides = nil
  else
    assistant_overrides = parsed_json["assistantOverrides"].to_json
    assistant_overrides = Vapi::AssistantOverrides.from_json(json_object: assistant_overrides)
  end
  new(
    assistant: assistant,
    assistant_id: assistant_id,
    assistant_overrides: assistant_overrides,
    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)


98
99
100
101
102
# File 'lib/vapi_server_sdk/types/tester_plan.rb', line 98

def self.validate_raw(obj:)
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
  obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.")
  obj.assistant_overrides.nil? || Vapi::AssistantOverrides.validate_raw(obj: obj.assistant_overrides)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TesterPlan to a JSON object

Returns:

  • (String)


88
89
90
# File 'lib/vapi_server_sdk/types/tester_plan.rb', line 88

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