Class: AssemblyAI::Lemur::LemurBaseParams
- Inherits:
-
Object
- Object
- AssemblyAI::Lemur::LemurBaseParams
- Defined in:
- lib/assemblyai/lemur/types/lemur_base_params.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#context ⇒ AssemblyAI::Lemur::LemurBaseParamsContext
readonly
Context to provide the model.
-
#final_model ⇒ AssemblyAI::Lemur::LemurModel
readonly
The model that is used for the final prompt after compression is performed.
-
#input_text ⇒ String
readonly
Custom formatted transcript data.
-
#max_output_size ⇒ Integer
readonly
Max output size in tokens, up to 4000.
-
#temperature ⇒ Float
readonly
The temperature to use for the model.
-
#transcript_ids ⇒ Array<String>
readonly
A list of completed transcripts with text.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ AssemblyAI::Lemur::LemurBaseParams
Deserialize a JSON object to an instance of LemurBaseParams.
-
.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(transcript_ids: OMIT, input_text: OMIT, context: OMIT, final_model: OMIT, max_output_size: OMIT, temperature: OMIT, additional_properties: nil) ⇒ AssemblyAI::Lemur::LemurBaseParams constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of LemurBaseParams to a JSON object.
Constructor Details
#initialize(transcript_ids: OMIT, input_text: OMIT, context: OMIT, final_model: OMIT, max_output_size: OMIT, temperature: OMIT, additional_properties: nil) ⇒ AssemblyAI::Lemur::LemurBaseParams
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 53 def initialize(transcript_ids: OMIT, input_text: OMIT, context: OMIT, final_model: OMIT, max_output_size: OMIT, temperature: OMIT, additional_properties: nil) @transcript_ids = transcript_ids if transcript_ids != OMIT @input_text = input_text if input_text != OMIT @context = context if context != OMIT @final_model = final_model if final_model != OMIT @max_output_size = max_output_size if max_output_size != OMIT @temperature = temperature if temperature != OMIT @additional_properties = additional_properties @_field_set = { "transcript_ids": transcript_ids, "input_text": input_text, "context": context, "final_model": final_model, "max_output_size": max_output_size, "temperature": temperature }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
31 32 33 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 31 def additional_properties @additional_properties end |
#context ⇒ AssemblyAI::Lemur::LemurBaseParamsContext (readonly)
Returns Context to provide the model. This can be a string or a free-form JSON value.
20 21 22 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 20 def context @context end |
#final_model ⇒ AssemblyAI::Lemur::LemurModel (readonly)
Returns The model that is used for the final prompt after compression is performed.
22 23 24 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 22 def final_model @final_model end |
#input_text ⇒ String (readonly)
Returns Custom formatted transcript data. Maximum size is the context limit of the selected model, which defaults to 100000. Use either transcript_ids or input_text as input into LeMUR.
18 19 20 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 18 def input_text @input_text end |
#max_output_size ⇒ Integer (readonly)
Returns Max output size in tokens, up to 4000.
24 25 26 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 24 def max_output_size @max_output_size end |
#temperature ⇒ Float (readonly)
Returns The temperature to use for the model. Higher values result in answers that are more creative, lower values are more conservative. Can be any value between 0.0 and 1.0 inclusive.
29 30 31 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 29 def temperature @temperature end |
#transcript_ids ⇒ Array<String> (readonly)
Returns A list of completed transcripts with text. Up to a maximum of 100 files or 100 hours, whichever is lower. Use either transcript_ids or input_text as input into LeMUR.
14 15 16 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 14 def transcript_ids @transcript_ids end |
Class Method Details
.from_json(json_object:) ⇒ AssemblyAI::Lemur::LemurBaseParams
Deserialize a JSON object to an instance of LemurBaseParams
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 78 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) transcript_ids = struct["transcript_ids"] input_text = struct["input_text"] if parsed_json["context"].nil? context = nil else context = parsed_json["context"].to_json context = AssemblyAI::Lemur::LemurBaseParamsContext.from_json(json_object: context) end final_model = struct["final_model"] max_output_size = struct["max_output_size"] temperature = struct["temperature"] new( transcript_ids: transcript_ids, input_text: input_text, context: context, final_model: final_model, max_output_size: max_output_size, temperature: temperature, 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.
116 117 118 119 120 121 122 123 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 116 def self.validate_raw(obj:) obj.transcript_ids&.is_a?(Array) != false || raise("Passed value for field obj.transcript_ids is not the expected type, validation failed.") obj.input_text&.is_a?(String) != false || raise("Passed value for field obj.input_text is not the expected type, validation failed.") obj.context.nil? || AssemblyAI::Lemur::LemurBaseParamsContext.validate_raw(obj: obj.context) obj.final_model&.is_a?(AssemblyAI::Lemur::LemurModel) != false || raise("Passed value for field obj.final_model is not the expected type, validation failed.") obj.max_output_size&.is_a?(Integer) != false || raise("Passed value for field obj.max_output_size 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of LemurBaseParams to a JSON object
106 107 108 |
# File 'lib/assemblyai/lemur/types/lemur_base_params.rb', line 106 def to_json(*_args) @_field_set&.to_json end |