Class: Vapi::WorkflowCustomModel
- Inherits:
-
Object
- Object
- Vapi::WorkflowCustomModel
- Defined in:
- lib/vapi_server_sdk/types/workflow_custom_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.
-
#metadata_send_mode ⇒ Vapi::WorkflowCustomModelMetadataSendMode
readonly
This determines whether metadata is sent in requests to the custom provider.
-
#model ⇒ String
readonly
This is the name of the model.
-
#temperature ⇒ Float
readonly
This is the temperature of the model.
-
#timeout_seconds ⇒ Float
readonly
This sets the timeout for the connection to the custom provider without needing to stream any tokens back.
-
#url ⇒ String
readonly
These is the URL we’ll use for the OpenAI client’s ‘baseURL`.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::WorkflowCustomModel
Deserialize a JSON object to an instance of WorkflowCustomModel.
-
.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(url:, model:, metadata_send_mode: OMIT, timeout_seconds: OMIT, temperature: OMIT, max_tokens: OMIT, additional_properties: nil) ⇒ Vapi::WorkflowCustomModel constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of WorkflowCustomModel to a JSON object.
Constructor Details
#initialize(url:, model:, metadata_send_mode: OMIT, timeout_seconds: OMIT, temperature: OMIT, max_tokens: OMIT, additional_properties: nil) ⇒ Vapi::WorkflowCustomModel
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 57 def initialize(url:, model:, metadata_send_mode: OMIT, timeout_seconds: OMIT, temperature: OMIT, max_tokens: OMIT, additional_properties: nil) @metadata_send_mode = if != OMIT @url = url @timeout_seconds = timeout_seconds if timeout_seconds != OMIT @model = model @temperature = temperature if temperature != OMIT @max_tokens = max_tokens if max_tokens != OMIT @additional_properties = additional_properties @_field_set = { "metadataSendMode": , "url": url, "timeoutSeconds": timeout_seconds, "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.
32 33 34 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 32 def additional_properties @additional_properties end |
#max_tokens ⇒ Float (readonly)
Returns This is the max tokens of the model.
30 31 32 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 30 def max_tokens @max_tokens end |
#metadata_send_mode ⇒ Vapi::WorkflowCustomModelMetadataSendMode (readonly)
Returns This determines whether metadata is sent in requests to the custom provider.
-
‘off` will not send any metadata. payload will look like `{ messages }`
-
‘variable` will send `assistant.metadata` as a variable on the payload.
payload will look like ‘{ messages, metadata }`
-
‘destructured` will send `assistant.metadata` fields directly on the payload.
payload will look like ‘{ messages, …metadata }` Further, `variable` and `destructured` will send `call`, `phoneNumber`, and `customer` objects in the payload. Default is `variable`.
18 19 20 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 18 def @metadata_send_mode end |
#model ⇒ String (readonly)
Returns This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b.
26 27 28 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 26 def model @model end |
#temperature ⇒ Float (readonly)
Returns This is the temperature of the model.
28 29 30 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 28 def temperature @temperature end |
#timeout_seconds ⇒ Float (readonly)
Returns This sets the timeout for the connection to the custom provider without needing to stream any tokens back. Default is 20 seconds.
24 25 26 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 24 def timeout_seconds @timeout_seconds end |
#url ⇒ String (readonly)
Returns These is the URL we’ll use for the OpenAI client’s ‘baseURL`. Ex. openrouter.ai/api/v1.
21 22 23 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 21 def url @url end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::WorkflowCustomModel
Deserialize a JSON object to an instance of WorkflowCustomModel
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 82 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["metadataSendMode"] url = parsed_json["url"] timeout_seconds = parsed_json["timeoutSeconds"] model = parsed_json["model"] temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] new( metadata_send_mode: , url: url, timeout_seconds: timeout_seconds, 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.
115 116 117 118 119 120 121 122 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 115 def self.validate_raw(obj:) obj.&.is_a?(Vapi::WorkflowCustomModelMetadataSendMode) != false || raise("Passed value for field obj.metadata_send_mode is not the expected type, validation failed.") obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.timeout_seconds is not the expected type, validation failed.") obj.model.is_a?(String) != 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 WorkflowCustomModel to a JSON object
105 106 107 |
# File 'lib/vapi_server_sdk/types/workflow_custom_model.rb', line 105 def to_json(*_args) @_field_set&.to_json end |