assemblyai 1.0.0.pre.beta.10 → 1.0.0.pre.beta.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 267dae8c6c4c9cd73c6b547bb0aaf560f283a7f483437f5edddbfc8fc091edde
4
- data.tar.gz: 6a8b1f420988acbce05a04d78e5114241a6fc5abef6c6ed0b3549979c868b9ec
3
+ metadata.gz: 157742ad6decb8b828c23cf549a4e700d4cb0b2fdd9435bef9ca5e44424fdbda
4
+ data.tar.gz: a97d6acfec405cb63d78c6388602ede6ff6c885053feb054f82044ea17658a92
5
5
  SHA512:
6
- metadata.gz: b25c9bc1531c0c97c5bef27c5067575afb3722d6aa826024e5e3d2b9cae03f24902a1787977436a3cd19cb9f1edcea51de42c656eb939b817b8e4aacb63c364e
7
- data.tar.gz: edef4f4676465a37222e4c559b2179cfecd3a479c0181b3b947539fd1aef5e04d457b5ff7fd92fefb20d34ba57874ff34db87b9ca416c1faf0222501a5f56b16
6
+ metadata.gz: 3136c68cf8ebeefb44cde0e3e55f968726bbf1d748a414d727ea6e0d73f244ac6a51f4edd688d4343ba857d2db28475fdcd4786f911ab2ce854d9206a3945b8a
7
+ data.tar.gz: 8f28783285bea24b5bd283f4385d748d81b0187276f6fedb4923df3be63493191391a99adcc478fd15d9b551186ca054a7822f76d16eae690292420c78d23339
@@ -8,6 +8,7 @@ require_relative "types/lemur_summary_response"
8
8
  require_relative "types/lemur_question"
9
9
  require_relative "types/lemur_question_answer_response"
10
10
  require_relative "types/lemur_action_items_response"
11
+ require_relative "types/lemur_response"
11
12
  require_relative "types/purge_lemur_request_data_response"
12
13
  require "async"
13
14
 
@@ -224,6 +225,29 @@ module AssemblyAI
224
225
  AssemblyAI::Lemur::LemurActionItemsResponse.from_json(json_object: response.body)
225
226
  end
226
227
 
228
+ # Retrieve a LeMUR response that was previously generated.
229
+ #
230
+ # @param request_id [String] The ID of the LeMUR request you previously made.
231
+ # This would be found in the response of the original request.
232
+ # @param request_options [AssemblyAI::RequestOptions]
233
+ # @return [AssemblyAI::Lemur::LemurTaskResponse, AssemblyAI::Lemur::LemurSummaryResponse, AssemblyAI::Lemur::LemurQuestionAnswerResponse, AssemblyAI::Lemur::LemurActionItemsResponse]
234
+ # @example
235
+ # api = AssemblyAI::Client.new(
236
+ # environment: AssemblyAI::Environment::DEFAULT,
237
+ # base_url: "https://api.example.com",
238
+ # api_key: "YOUR_API_KEY"
239
+ # )
240
+ # api.lemur.get_response(request_id: "request_id")
241
+ def get_response(request_id:, request_options: nil)
242
+ response = @request_client.conn.get do |req|
243
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
244
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
245
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
246
+ req.url "#{@request_client.get_url(request_options: request_options)}/lemur/v3/#{request_id}"
247
+ end
248
+ AssemblyAI::Lemur::LemurResponse.from_json(json_object: response.body)
249
+ end
250
+
227
251
  # Delete the data for a previously submitted LeMUR request.
228
252
  # The LLM response data, as well as any context provided in the original request
229
253
  # will be removed.
@@ -470,6 +494,31 @@ module AssemblyAI
470
494
  end
471
495
  end
472
496
 
497
+ # Retrieve a LeMUR response that was previously generated.
498
+ #
499
+ # @param request_id [String] The ID of the LeMUR request you previously made.
500
+ # This would be found in the response of the original request.
501
+ # @param request_options [AssemblyAI::RequestOptions]
502
+ # @return [AssemblyAI::Lemur::LemurTaskResponse, AssemblyAI::Lemur::LemurSummaryResponse, AssemblyAI::Lemur::LemurQuestionAnswerResponse, AssemblyAI::Lemur::LemurActionItemsResponse]
503
+ # @example
504
+ # api = AssemblyAI::Client.new(
505
+ # environment: AssemblyAI::Environment::DEFAULT,
506
+ # base_url: "https://api.example.com",
507
+ # api_key: "YOUR_API_KEY"
508
+ # )
509
+ # api.lemur.get_response(request_id: "request_id")
510
+ def get_response(request_id:, request_options: nil)
511
+ Async do
512
+ response = @request_client.conn.get do |req|
513
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
514
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
515
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
516
+ req.url "#{@request_client.get_url(request_options: request_options)}/lemur/v3/#{request_id}"
517
+ end
518
+ AssemblyAI::Lemur::LemurResponse.from_json(json_object: response.body)
519
+ end
520
+ end
521
+
473
522
  # Delete the data for a previously submitted LeMUR request.
474
523
  # The LLM response data, as well as any context provided in the original request
475
524
  # will be removed.
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "lemur_usage"
3
4
  require "ostruct"
4
5
  require "json"
5
6
 
@@ -10,6 +11,8 @@ module AssemblyAI
10
11
  attr_reader :response
11
12
  # @return [String] The ID of the LeMUR request
12
13
  attr_reader :request_id
14
+ # @return [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
15
+ attr_reader :usage
13
16
  # @return [OpenStruct] Additional properties unmapped to the current class definition
14
17
  attr_reader :additional_properties
15
18
  # @return [Object]
@@ -20,13 +23,15 @@ module AssemblyAI
20
23
 
21
24
  # @param response [String] The response generated by LeMUR
22
25
  # @param request_id [String] The ID of the LeMUR request
26
+ # @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
23
27
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
28
  # @return [AssemblyAI::Lemur::LemurActionItemsResponse]
25
- def initialize(response:, request_id:, additional_properties: nil)
29
+ def initialize(response:, request_id:, usage:, additional_properties: nil)
26
30
  @response = response
27
31
  @request_id = request_id
32
+ @usage = usage
28
33
  @additional_properties = additional_properties
29
- @_field_set = { "response": response, "request_id": request_id }
34
+ @_field_set = { "response": response, "request_id": request_id, "usage": usage }
30
35
  end
31
36
 
32
37
  # Deserialize a JSON object to an instance of LemurActionItemsResponse
@@ -35,11 +40,19 @@ module AssemblyAI
35
40
  # @return [AssemblyAI::Lemur::LemurActionItemsResponse]
36
41
  def self.from_json(json_object:)
37
42
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
+ parsed_json = JSON.parse(json_object)
38
44
  response = struct["response"]
39
45
  request_id = struct["request_id"]
46
+ if parsed_json["usage"].nil?
47
+ usage = nil
48
+ else
49
+ usage = parsed_json["usage"].to_json
50
+ usage = AssemblyAI::Lemur::LemurUsage.from_json(json_object: usage)
51
+ end
40
52
  new(
41
53
  response: response,
42
54
  request_id: request_id,
55
+ usage: usage,
43
56
  additional_properties: struct
44
57
  )
45
58
  end
@@ -60,6 +73,7 @@ module AssemblyAI
60
73
  def self.validate_raw(obj:)
61
74
  obj.response.is_a?(String) != false || raise("Passed value for field obj.response is not the expected type, validation failed.")
62
75
  obj.request_id.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.")
76
+ AssemblyAI::Lemur::LemurUsage.validate_raw(obj: obj.usage)
63
77
  end
64
78
  end
65
79
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "lemur_usage"
3
4
  require "ostruct"
4
5
  require "json"
5
6
 
@@ -8,6 +9,8 @@ module AssemblyAI
8
9
  class LemurBaseResponse
9
10
  # @return [String] The ID of the LeMUR request
10
11
  attr_reader :request_id
12
+ # @return [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
13
+ attr_reader :usage
11
14
  # @return [OpenStruct] Additional properties unmapped to the current class definition
12
15
  attr_reader :additional_properties
13
16
  # @return [Object]
@@ -17,12 +20,14 @@ module AssemblyAI
17
20
  OMIT = Object.new
18
21
 
19
22
  # @param request_id [String] The ID of the LeMUR request
23
+ # @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
20
24
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
25
  # @return [AssemblyAI::Lemur::LemurBaseResponse]
22
- def initialize(request_id:, additional_properties: nil)
26
+ def initialize(request_id:, usage:, additional_properties: nil)
23
27
  @request_id = request_id
28
+ @usage = usage
24
29
  @additional_properties = additional_properties
25
- @_field_set = { "request_id": request_id }
30
+ @_field_set = { "request_id": request_id, "usage": usage }
26
31
  end
27
32
 
28
33
  # Deserialize a JSON object to an instance of LemurBaseResponse
@@ -31,8 +36,19 @@ module AssemblyAI
31
36
  # @return [AssemblyAI::Lemur::LemurBaseResponse]
32
37
  def self.from_json(json_object:)
33
38
  struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ parsed_json = JSON.parse(json_object)
34
40
  request_id = struct["request_id"]
35
- new(request_id: request_id, additional_properties: struct)
41
+ if parsed_json["usage"].nil?
42
+ usage = nil
43
+ else
44
+ usage = parsed_json["usage"].to_json
45
+ usage = AssemblyAI::Lemur::LemurUsage.from_json(json_object: usage)
46
+ end
47
+ new(
48
+ request_id: request_id,
49
+ usage: usage,
50
+ additional_properties: struct
51
+ )
36
52
  end
37
53
 
38
54
  # Serialize an instance of LemurBaseResponse to a JSON object
@@ -50,6 +66,7 @@ module AssemblyAI
50
66
  # @return [Void]
51
67
  def self.validate_raw(obj:)
52
68
  obj.request_id.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.")
69
+ AssemblyAI::Lemur::LemurUsage.validate_raw(obj: obj.usage)
53
70
  end
54
71
  end
55
72
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "lemur_question_answer"
4
+ require_relative "lemur_usage"
4
5
  require "ostruct"
5
6
  require "json"
6
7
 
@@ -11,6 +12,8 @@ module AssemblyAI
11
12
  attr_reader :response
12
13
  # @return [String] The ID of the LeMUR request
13
14
  attr_reader :request_id
15
+ # @return [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
16
+ attr_reader :usage
14
17
  # @return [OpenStruct] Additional properties unmapped to the current class definition
15
18
  attr_reader :additional_properties
16
19
  # @return [Object]
@@ -21,13 +24,15 @@ module AssemblyAI
21
24
 
22
25
  # @param response [Array<AssemblyAI::Lemur::LemurQuestionAnswer>] The answers generated by LeMUR and their questions
23
26
  # @param request_id [String] The ID of the LeMUR request
27
+ # @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
24
28
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
29
  # @return [AssemblyAI::Lemur::LemurQuestionAnswerResponse]
26
- def initialize(response:, request_id:, additional_properties: nil)
30
+ def initialize(response:, request_id:, usage:, additional_properties: nil)
27
31
  @response = response
28
32
  @request_id = request_id
33
+ @usage = usage
29
34
  @additional_properties = additional_properties
30
- @_field_set = { "response": response, "request_id": request_id }
35
+ @_field_set = { "response": response, "request_id": request_id, "usage": usage }
31
36
  end
32
37
 
33
38
  # Deserialize a JSON object to an instance of LemurQuestionAnswerResponse
@@ -42,9 +47,16 @@ module AssemblyAI
42
47
  AssemblyAI::Lemur::LemurQuestionAnswer.from_json(json_object: v)
43
48
  end
44
49
  request_id = struct["request_id"]
50
+ if parsed_json["usage"].nil?
51
+ usage = nil
52
+ else
53
+ usage = parsed_json["usage"].to_json
54
+ usage = AssemblyAI::Lemur::LemurUsage.from_json(json_object: usage)
55
+ end
45
56
  new(
46
57
  response: response,
47
58
  request_id: request_id,
59
+ usage: usage,
48
60
  additional_properties: struct
49
61
  )
50
62
  end
@@ -65,6 +77,7 @@ module AssemblyAI
65
77
  def self.validate_raw(obj:)
66
78
  obj.response.is_a?(Array) != false || raise("Passed value for field obj.response is not the expected type, validation failed.")
67
79
  obj.request_id.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.")
80
+ AssemblyAI::Lemur::LemurUsage.validate_raw(obj: obj.usage)
68
81
  end
69
82
  end
70
83
  end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "lemur_task_response"
5
+ require_relative "lemur_summary_response"
6
+ require_relative "lemur_question_answer_response"
7
+ require_relative "lemur_action_items_response"
8
+
9
+ module AssemblyAI
10
+ class Lemur
11
+ class LemurResponse
12
+ # Deserialize a JSON object to an instance of LemurResponse
13
+ #
14
+ # @param json_object [String]
15
+ # @return [AssemblyAI::Lemur::LemurResponse]
16
+ def self.from_json(json_object:)
17
+ struct = JSON.parse(json_object, object_class: OpenStruct)
18
+ begin
19
+ AssemblyAI::Lemur::LemurTaskResponse.validate_raw(obj: struct)
20
+ return AssemblyAI::Lemur::LemurTaskResponse.from_json(json_object: json_object) unless json_object.nil?
21
+
22
+ return nil
23
+ rescue StandardError
24
+ # noop
25
+ end
26
+ begin
27
+ AssemblyAI::Lemur::LemurSummaryResponse.validate_raw(obj: struct)
28
+ return AssemblyAI::Lemur::LemurSummaryResponse.from_json(json_object: json_object) unless json_object.nil?
29
+
30
+ return nil
31
+ rescue StandardError
32
+ # noop
33
+ end
34
+ begin
35
+ AssemblyAI::Lemur::LemurQuestionAnswerResponse.validate_raw(obj: struct)
36
+ unless json_object.nil?
37
+ return AssemblyAI::Lemur::LemurQuestionAnswerResponse.from_json(json_object: json_object)
38
+ end
39
+
40
+ return nil
41
+ rescue StandardError
42
+ # noop
43
+ end
44
+ begin
45
+ AssemblyAI::Lemur::LemurActionItemsResponse.validate_raw(obj: struct)
46
+ return AssemblyAI::Lemur::LemurActionItemsResponse.from_json(json_object: json_object) unless json_object.nil?
47
+
48
+ return nil
49
+ rescue StandardError
50
+ # noop
51
+ end
52
+ struct
53
+ end
54
+
55
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
56
+ # hash and check each fields type against the current object's property
57
+ # definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ begin
63
+ return AssemblyAI::Lemur::LemurTaskResponse.validate_raw(obj: obj)
64
+ rescue StandardError
65
+ # noop
66
+ end
67
+ begin
68
+ return AssemblyAI::Lemur::LemurSummaryResponse.validate_raw(obj: obj)
69
+ rescue StandardError
70
+ # noop
71
+ end
72
+ begin
73
+ return AssemblyAI::Lemur::LemurQuestionAnswerResponse.validate_raw(obj: obj)
74
+ rescue StandardError
75
+ # noop
76
+ end
77
+ begin
78
+ return AssemblyAI::Lemur::LemurActionItemsResponse.validate_raw(obj: obj)
79
+ rescue StandardError
80
+ # noop
81
+ end
82
+ raise("Passed value matched no type within the union, validation failed.")
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "lemur_usage"
3
4
  require "ostruct"
4
5
  require "json"
5
6
 
@@ -10,6 +11,8 @@ module AssemblyAI
10
11
  attr_reader :response
11
12
  # @return [String] The ID of the LeMUR request
12
13
  attr_reader :request_id
14
+ # @return [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
15
+ attr_reader :usage
13
16
  # @return [OpenStruct] Additional properties unmapped to the current class definition
14
17
  attr_reader :additional_properties
15
18
  # @return [Object]
@@ -20,13 +23,15 @@ module AssemblyAI
20
23
 
21
24
  # @param response [String] The response generated by LeMUR
22
25
  # @param request_id [String] The ID of the LeMUR request
26
+ # @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
23
27
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
28
  # @return [AssemblyAI::Lemur::LemurSummaryResponse]
25
- def initialize(response:, request_id:, additional_properties: nil)
29
+ def initialize(response:, request_id:, usage:, additional_properties: nil)
26
30
  @response = response
27
31
  @request_id = request_id
32
+ @usage = usage
28
33
  @additional_properties = additional_properties
29
- @_field_set = { "response": response, "request_id": request_id }
34
+ @_field_set = { "response": response, "request_id": request_id, "usage": usage }
30
35
  end
31
36
 
32
37
  # Deserialize a JSON object to an instance of LemurSummaryResponse
@@ -35,11 +40,19 @@ module AssemblyAI
35
40
  # @return [AssemblyAI::Lemur::LemurSummaryResponse]
36
41
  def self.from_json(json_object:)
37
42
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
+ parsed_json = JSON.parse(json_object)
38
44
  response = struct["response"]
39
45
  request_id = struct["request_id"]
46
+ if parsed_json["usage"].nil?
47
+ usage = nil
48
+ else
49
+ usage = parsed_json["usage"].to_json
50
+ usage = AssemblyAI::Lemur::LemurUsage.from_json(json_object: usage)
51
+ end
40
52
  new(
41
53
  response: response,
42
54
  request_id: request_id,
55
+ usage: usage,
43
56
  additional_properties: struct
44
57
  )
45
58
  end
@@ -60,6 +73,7 @@ module AssemblyAI
60
73
  def self.validate_raw(obj:)
61
74
  obj.response.is_a?(String) != false || raise("Passed value for field obj.response is not the expected type, validation failed.")
62
75
  obj.request_id.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.")
76
+ AssemblyAI::Lemur::LemurUsage.validate_raw(obj: obj.usage)
63
77
  end
64
78
  end
65
79
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "lemur_usage"
3
4
  require "ostruct"
4
5
  require "json"
5
6
 
@@ -10,6 +11,8 @@ module AssemblyAI
10
11
  attr_reader :response
11
12
  # @return [String] The ID of the LeMUR request
12
13
  attr_reader :request_id
14
+ # @return [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
15
+ attr_reader :usage
13
16
  # @return [OpenStruct] Additional properties unmapped to the current class definition
14
17
  attr_reader :additional_properties
15
18
  # @return [Object]
@@ -20,13 +23,15 @@ module AssemblyAI
20
23
 
21
24
  # @param response [String] The response generated by LeMUR.
22
25
  # @param request_id [String] The ID of the LeMUR request
26
+ # @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
23
27
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
28
  # @return [AssemblyAI::Lemur::LemurTaskResponse]
25
- def initialize(response:, request_id:, additional_properties: nil)
29
+ def initialize(response:, request_id:, usage:, additional_properties: nil)
26
30
  @response = response
27
31
  @request_id = request_id
32
+ @usage = usage
28
33
  @additional_properties = additional_properties
29
- @_field_set = { "response": response, "request_id": request_id }
34
+ @_field_set = { "response": response, "request_id": request_id, "usage": usage }
30
35
  end
31
36
 
32
37
  # Deserialize a JSON object to an instance of LemurTaskResponse
@@ -35,11 +40,19 @@ module AssemblyAI
35
40
  # @return [AssemblyAI::Lemur::LemurTaskResponse]
36
41
  def self.from_json(json_object:)
37
42
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
+ parsed_json = JSON.parse(json_object)
38
44
  response = struct["response"]
39
45
  request_id = struct["request_id"]
46
+ if parsed_json["usage"].nil?
47
+ usage = nil
48
+ else
49
+ usage = parsed_json["usage"].to_json
50
+ usage = AssemblyAI::Lemur::LemurUsage.from_json(json_object: usage)
51
+ end
40
52
  new(
41
53
  response: response,
42
54
  request_id: request_id,
55
+ usage: usage,
43
56
  additional_properties: struct
44
57
  )
45
58
  end
@@ -60,6 +73,7 @@ module AssemblyAI
60
73
  def self.validate_raw(obj:)
61
74
  obj.response.is_a?(String) != false || raise("Passed value for field obj.response is not the expected type, validation failed.")
62
75
  obj.request_id.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.")
76
+ AssemblyAI::Lemur::LemurUsage.validate_raw(obj: obj.usage)
63
77
  end
64
78
  end
65
79
  end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module AssemblyAI
7
+ class Lemur
8
+ # The usage numbers for the LeMUR request
9
+ class LemurUsage
10
+ # @return [Integer] The number of input tokens used by the model
11
+ attr_reader :input_tokens
12
+ # @return [Integer] The number of output tokens generated by the model
13
+ attr_reader :output_tokens
14
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
15
+ attr_reader :additional_properties
16
+ # @return [Object]
17
+ attr_reader :_field_set
18
+ protected :_field_set
19
+
20
+ OMIT = Object.new
21
+
22
+ # @param input_tokens [Integer] The number of input tokens used by the model
23
+ # @param output_tokens [Integer] The number of output tokens generated by the model
24
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
+ # @return [AssemblyAI::Lemur::LemurUsage]
26
+ def initialize(input_tokens:, output_tokens:, additional_properties: nil)
27
+ @input_tokens = input_tokens
28
+ @output_tokens = output_tokens
29
+ @additional_properties = additional_properties
30
+ @_field_set = { "input_tokens": input_tokens, "output_tokens": output_tokens }
31
+ end
32
+
33
+ # Deserialize a JSON object to an instance of LemurUsage
34
+ #
35
+ # @param json_object [String]
36
+ # @return [AssemblyAI::Lemur::LemurUsage]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ input_tokens = struct["input_tokens"]
40
+ output_tokens = struct["output_tokens"]
41
+ new(
42
+ input_tokens: input_tokens,
43
+ output_tokens: output_tokens,
44
+ additional_properties: struct
45
+ )
46
+ end
47
+
48
+ # Serialize an instance of LemurUsage to a JSON object
49
+ #
50
+ # @return [String]
51
+ def to_json(*_args)
52
+ @_field_set&.to_json
53
+ end
54
+
55
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
56
+ # hash and check each fields type against the current object's property
57
+ # definitions.
58
+ #
59
+ # @param obj [Object]
60
+ # @return [Void]
61
+ def self.validate_raw(obj:)
62
+ obj.input_tokens.is_a?(Integer) != false || raise("Passed value for field obj.input_tokens is not the expected type, validation failed.")
63
+ obj.output_tokens.is_a?(Integer) != false || raise("Passed value for field obj.output_tokens is not the expected type, validation failed.")
64
+ end
65
+ end
66
+ end
67
+ end
data/lib/requests.rb CHANGED
@@ -29,7 +29,7 @@ module AssemblyAI
29
29
  @headers = {
30
30
  "X-Fern-Language": "Ruby",
31
31
  "X-Fern-SDK-Name": "assemblyai",
32
- "X-Fern-SDK-Version": "1.0.0-beta.10",
32
+ "X-Fern-SDK-Version": "1.0.0-beta.11",
33
33
  "Authorization": api_key.to_s
34
34
  }
35
35
  @conn = Faraday.new(headers: @headers) do |faraday|
@@ -70,7 +70,7 @@ module AssemblyAI
70
70
  @headers = {
71
71
  "X-Fern-Language": "Ruby",
72
72
  "X-Fern-SDK-Name": "assemblyai",
73
- "X-Fern-SDK-Version": "1.0.0-beta.10",
73
+ "X-Fern-SDK-Version": "1.0.0-beta.11",
74
74
  "Authorization": api_key.to_s
75
75
  }
76
76
  @conn = Faraday.new(headers: @headers) do |faraday|
data/lib/types_export.rb CHANGED
@@ -66,16 +66,18 @@ require_relative "assemblyai/realtime/types/audio_encoding"
66
66
  require_relative "assemblyai/realtime/types/realtime_temporary_token_response"
67
67
  require_relative "assemblyai/lemur/types/purge_lemur_request_data_response"
68
68
  require_relative "assemblyai/lemur/types/lemur_base_response"
69
+ require_relative "assemblyai/lemur/types/lemur_task_response"
69
70
  require_relative "assemblyai/lemur/types/lemur_summary_response"
70
71
  require_relative "assemblyai/lemur/types/lemur_question_answer_response"
71
72
  require_relative "assemblyai/lemur/types/lemur_question_answer"
72
73
  require_relative "assemblyai/lemur/types/lemur_action_items_response"
73
- require_relative "assemblyai/lemur/types/lemur_task_response"
74
+ require_relative "assemblyai/lemur/types/lemur_response"
74
75
  require_relative "assemblyai/lemur/types/lemur_base_params_context"
75
76
  require_relative "assemblyai/lemur/types/lemur_base_params"
76
77
  require_relative "assemblyai/lemur/types/lemur_question_context"
77
78
  require_relative "assemblyai/lemur/types/lemur_question"
78
79
  require_relative "assemblyai/lemur/types/lemur_model"
80
+ require_relative "assemblyai/lemur/types/lemur_usage"
79
81
  require_relative "assemblyai/streaming/types/streaming"
80
82
  require_relative "assemblyai/streaming/types/receive_message"
81
83
  require_relative "assemblyai/streaming/types/send_message"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assemblyai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.10
4
+ version: 1.0.0.pre.beta.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-05 00:00:00.000000000 Z
11
+ date: 2024-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http-faraday
@@ -109,8 +109,10 @@ files:
109
109
  - lib/assemblyai/lemur/types/lemur_question_answer.rb
110
110
  - lib/assemblyai/lemur/types/lemur_question_answer_response.rb
111
111
  - lib/assemblyai/lemur/types/lemur_question_context.rb
112
+ - lib/assemblyai/lemur/types/lemur_response.rb
112
113
  - lib/assemblyai/lemur/types/lemur_summary_response.rb
113
114
  - lib/assemblyai/lemur/types/lemur_task_response.rb
115
+ - lib/assemblyai/lemur/types/lemur_usage.rb
114
116
  - lib/assemblyai/lemur/types/purge_lemur_request_data_response.rb
115
117
  - lib/assemblyai/realtime/client.rb
116
118
  - lib/assemblyai/realtime/types/audio_encoding.rb