Class: Vapi::WorkflowOpenAiModel

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, temperature: OMIT, max_tokens: OMIT, additional_properties: nil) ⇒ Vapi::WorkflowOpenAiModel

Parameters:

  • model (Vapi::WorkflowOpenAiModelModel)

    This is the OpenAI model that will be used. When using Vapi OpenAI or your own Azure Credentials, you have the option to specify the region for the selected model. This shouldn’t be specified unless you have a specific reason to do so. Vapi will automatically find the fastest region that make sense. This is helpful when you are required to comply with Data Residency rules. Learn more about Azure regions here azure.microsoft.com/en-us/explore/global-infrastructure/data-residency/.

  • temperature (Float) (defaults to: OMIT)

    This is the temperature of the model.

  • max_tokens (Float) (defaults to: OMIT)

    This is the max tokens of the model.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



42
43
44
45
46
47
48
49
50
# File 'lib/vapi_server_sdk/types/workflow_open_ai_model.rb', line 42

def initialize(model:, temperature: OMIT, max_tokens: OMIT, additional_properties: nil)
  @model = model
  @temperature = temperature if temperature != OMIT
  @max_tokens = max_tokens if max_tokens != OMIT
  @additional_properties = additional_properties
  @_field_set = { "model": model, "temperature": temperature, "maxTokens": max_tokens }.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/workflow_open_ai_model.rb', line 23

def additional_properties
  @additional_properties
end

#max_tokensFloat (readonly)

Returns This is the max tokens of the model.

Returns:

  • (Float)

    This is the max tokens of the model.



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

def max_tokens
  @max_tokens
end

#modelVapi::WorkflowOpenAiModelModel (readonly)

Returns This is the OpenAI model that will be used. When using Vapi OpenAI or your own Azure Credentials, you have the option to specify the region for the selected model. This shouldn’t be specified unless you have a specific reason to do so. Vapi will automatically find the fastest region that make sense. This is helpful when you are required to comply with Data Residency rules. Learn more about Azure regions here azure.microsoft.com/en-us/explore/global-infrastructure/data-residency/.

Returns:

  • (Vapi::WorkflowOpenAiModelModel)

    This is the OpenAI model that will be used. When using Vapi OpenAI or your own Azure Credentials, you have the option to specify the region for the selected model. This shouldn’t be specified unless you have a specific reason to do so. Vapi will automatically find the fastest region that make sense. This is helpful when you are required to comply with Data Residency rules. Learn more about Azure regions here azure.microsoft.com/en-us/explore/global-infrastructure/data-residency/.



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

def model
  @model
end

#temperatureFloat (readonly)

Returns This is the temperature of the model.

Returns:

  • (Float)

    This is the temperature of the model.



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

def temperature
  @temperature
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::WorkflowOpenAiModel

Deserialize a JSON object to an instance of WorkflowOpenAiModel

Parameters:

  • json_object (String)

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/vapi_server_sdk/types/workflow_open_ai_model.rb', line 56

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  model = parsed_json["model"]
  temperature = parsed_json["temperature"]
  max_tokens = parsed_json["maxTokens"]
  new(
    model: model,
    temperature: temperature,
    max_tokens: max_tokens,
    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)


83
84
85
86
87
# File 'lib/vapi_server_sdk/types/workflow_open_ai_model.rb', line 83

def self.validate_raw(obj:)
  obj.model.is_a?(Vapi::WorkflowOpenAiModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.")
  obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of WorkflowOpenAiModel to a JSON object

Returns:

  • (String)


73
74
75
# File 'lib/vapi_server_sdk/types/workflow_open_ai_model.rb', line 73

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