Class: Vapi::WorkflowOpenAiModel
- Inherits:
-
Object
- Object
- Vapi::WorkflowOpenAiModel
- Defined in:
- lib/vapi_server_sdk/types/workflow_open_ai_model.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#max_tokens ⇒ Float
readonly
This is the max tokens of the model.
-
#model ⇒ Vapi::WorkflowOpenAiModelModel
readonly
This is the OpenAI model that will be used.
-
#temperature ⇒ Float
readonly
This is the temperature of the model.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::WorkflowOpenAiModel
Deserialize a JSON object to an instance of WorkflowOpenAiModel.
-
.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(model:, temperature: OMIT, max_tokens: OMIT, additional_properties: nil) ⇒ Vapi::WorkflowOpenAiModel constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of WorkflowOpenAiModel to a JSON object.
Constructor Details
#initialize(model:, temperature: OMIT, max_tokens: OMIT, additional_properties: nil) ⇒ Vapi::WorkflowOpenAiModel
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_properties ⇒ OpenStruct (readonly)
Returns 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_tokens ⇒ Float (readonly)
Returns 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 |
#model ⇒ Vapi::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/.
17 18 19 |
# File 'lib/vapi_server_sdk/types/workflow_open_ai_model.rb', line 17 def model @model end |
#temperature ⇒ Float (readonly)
Returns 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
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.
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
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 |