Class: Vapi::UpdateToolCallBlockDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, tool: OMIT, name: OMIT, tool_id: OMIT, additional_properties: nil) ⇒ Vapi::UpdateToolCallBlockDto

Parameters:

  • messages (Array<Vapi::UpdateToolCallBlockDtoMessagesItem>) (defaults to: OMIT)

    These are the pre-configured messages that will be spoken to the user while the block is running.

  • input_schema (Vapi::JsonSchema) (defaults to: OMIT)

    This is the input schema for the block. This is the input the block needs to run. It’s given to the block as steps[0].input These are accessible as variables:

    • (Vapi::UpdateToolCallBlockDto.{input{input.propertyName}) in context of the block execution (step)

    • (Vapi::UpdateToolCallBlockDto.{stepName{stepName.input{stepName.input.propertyName}) in context of the workflow

  • output_schema (Vapi::JsonSchema) (defaults to: OMIT)

    This is the output schema for the block. This is the output the block will return to the workflow (‘Vapi::UpdateToolCallBlockDto.{stepName{stepName.output}`). These are accessible as variables:

    • (Vapi::UpdateToolCallBlockDto.{output{output.propertyName}) in context of the block execution (step)

    • (Vapi::UpdateToolCallBlockDto.{stepName{stepName.output{stepName.output.propertyName}) in context of the workflow (read caveat #1)

    • (Vapi::UpdateToolCallBlockDto.{blockName{blockName.output{blockName.output.propertyName}) in context of the workflow (read caveat

    #2) Caveats:

    1. a workflow can execute a step multiple times. example, if a loop is used in

    the graph. Vapi::UpdateToolCallBlockDto.{stepName{stepName.output{stepName.output.propertyName} will reference the latest usage of the step.

    1. 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::UpdateToolCallBlockDto.{blockName{blockName.output{blockName.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.

  • tool (Vapi::UpdateToolCallBlockDtoTool) (defaults to: OMIT)

    This is the tool that the block will call. To use an existing tool, use toolId.

  • name (String) (defaults to: OMIT)

    This is the name of the block. This is just for your reference.

  • tool_id (String) (defaults to: OMIT)

    This is the id of the tool that the block will call. To use a transient tool, use tool.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 83

def initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, tool: OMIT, name: OMIT, tool_id: OMIT,
               additional_properties: nil)
  @messages = messages if messages != OMIT
  @input_schema = input_schema if input_schema != OMIT
  @output_schema = output_schema if output_schema != OMIT
  @tool = tool if tool != OMIT
  @name = name if name != OMIT
  @tool_id = tool_id if tool_id != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "messages": messages,
    "inputSchema": input_schema,
    "outputSchema": output_schema,
    "tool": tool,
    "name": name,
    "toolId": tool_id
  }.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



46
47
48
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 46

def additional_properties
  @additional_properties
end

#input_schemaVapi::JsonSchema (readonly)

Returns This is the input schema for the block. This is the input the block needs to run. It’s given to the block as steps[0].input These are accessible as variables:

  • (Vapi::UpdateToolCallBlockDto.{input{input.propertyName}) in context of the block execution (step)

  • (Vapi::UpdateToolCallBlockDto.{stepName{stepName.input{stepName.input.propertyName}) in context of the workflow.

Returns:

  • (Vapi::JsonSchema)

    This is the input schema for the block. This is the input the block needs to run. It’s given to the block as steps[0].input These are accessible as variables:

    • (Vapi::UpdateToolCallBlockDto.{input{input.propertyName}) in context of the block execution (step)

    • (Vapi::UpdateToolCallBlockDto.{stepName{stepName.input{stepName.input.propertyName}) in context of the workflow



19
20
21
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 19

def input_schema
  @input_schema
end

#messagesArray<Vapi::UpdateToolCallBlockDtoMessagesItem> (readonly)

Returns These are the pre-configured messages that will be spoken to the user while the block is running.

Returns:



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

def messages
  @messages
end

#nameString (readonly)

Returns This is the name of the block. This is just for your reference.

Returns:

  • (String)

    This is the name of the block. This is just for your reference.



41
42
43
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 41

def name
  @name
end

#output_schemaVapi::JsonSchema (readonly)

This is the output schema for the block. This is the output the block will return to the workflow (‘Vapi::UpdateToolCallBlockDto.{stepName{stepName.output}`). These are accessible as variables:

  • (Vapi::UpdateToolCallBlockDto.{output{output.propertyName}) in context of the block execution (step)

  • (Vapi::UpdateToolCallBlockDto.{stepName{stepName.output{stepName.output.propertyName}) in context of the workflow (read caveat #1)

  • (Vapi::UpdateToolCallBlockDto.{blockName{blockName.output{blockName.output.propertyName}) in context of the workflow (read caveat

#2) Caveats:

  1. a workflow can execute a step multiple times. example, if a loop is used in

the graph. Vapi::UpdateToolCallBlockDto.{stepName{stepName.output{stepName.output.propertyName} will reference the latest usage of the step.

  1. 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::UpdateToolCallBlockDto.{blockName{blockName.output{blockName.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.

Returns:

  • (Vapi::JsonSchema)

    This is the output schema for the block. This is the output the block will return to the workflow (‘Vapi::UpdateToolCallBlockDto.{stepName{stepName.output}`). These are accessible as variables:

    • (Vapi::UpdateToolCallBlockDto.{output{output.propertyName}) in context of the block execution (step)

    • (Vapi::UpdateToolCallBlockDto.{stepName{stepName.output{stepName.output.propertyName}) in context of the workflow (read caveat #1)

    • (Vapi::UpdateToolCallBlockDto.{blockName{blockName.output{blockName.output.propertyName}) in context of the workflow (read caveat

    #2) Caveats:

    1. a workflow can execute a step multiple times. example, if a loop is used in

    the graph. Vapi::UpdateToolCallBlockDto.{stepName{stepName.output{stepName.output.propertyName} will reference the latest usage of the step.

    1. 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::UpdateToolCallBlockDto.{blockName{blockName.output{blockName.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.



36
37
38
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 36

def output_schema
  @output_schema
end

#toolVapi::UpdateToolCallBlockDtoTool (readonly)

Returns This is the tool that the block will call. To use an existing tool, use toolId.

Returns:



39
40
41
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 39

def tool
  @tool
end

#tool_idString (readonly)

Returns This is the id of the tool that the block will call. To use a transient tool, use tool.

Returns:

  • (String)

    This is the id of the tool that the block will call. To use a transient tool, use tool.



44
45
46
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 44

def tool_id
  @tool_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::UpdateToolCallBlockDto

Deserialize a JSON object to an instance of UpdateToolCallBlockDto

Parameters:

  • json_object (String)

Returns:



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 108

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  messages = parsed_json["messages"]&.map do |item|
    item = item.to_json
    Vapi::UpdateToolCallBlockDtoMessagesItem.from_json(json_object: item)
  end
  if parsed_json["inputSchema"].nil?
    input_schema = nil
  else
    input_schema = parsed_json["inputSchema"].to_json
    input_schema = Vapi::JsonSchema.from_json(json_object: input_schema)
  end
  if parsed_json["outputSchema"].nil?
    output_schema = nil
  else
    output_schema = parsed_json["outputSchema"].to_json
    output_schema = Vapi::JsonSchema.from_json(json_object: output_schema)
  end
  if parsed_json["tool"].nil?
    tool = nil
  else
    tool = parsed_json["tool"].to_json
    tool = Vapi::UpdateToolCallBlockDtoTool.from_json(json_object: tool)
  end
  name = parsed_json["name"]
  tool_id = parsed_json["toolId"]
  new(
    messages: messages,
    input_schema: input_schema,
    output_schema: output_schema,
    tool: tool,
    name: name,
    tool_id: tool_id,
    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)


159
160
161
162
163
164
165
166
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 159

def self.validate_raw(obj:)
  obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
  obj.input_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.input_schema)
  obj.output_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.output_schema)
  obj.tool.nil? || Vapi::UpdateToolCallBlockDtoTool.validate_raw(obj: obj.tool)
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.tool_id&.is_a?(String) != false || raise("Passed value for field obj.tool_id is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of UpdateToolCallBlockDto to a JSON object

Returns:

  • (String)


149
150
151
# File 'lib/vapi_server_sdk/types/update_tool_call_block_dto.rb', line 149

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