assemblyai 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assemblyai/transcripts/client.rb +341 -155
- data/lib/assemblyai/transcripts/polling_client.rb +6 -8
- data/lib/assemblyai/transcripts/types/transcript.rb +78 -56
- data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +1 -1
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +3 -3
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +44 -32
- data/lib/gemconfig.rb +1 -1
- metadata +2 -2
@@ -18,16 +18,26 @@ module AssemblyAI
|
|
18
18
|
class TranscriptOptionalParams
|
19
19
|
# @return [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
20
20
|
attr_reader :language_code
|
21
|
+
# @return [Boolean] Enable [Automatic language
|
22
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
23
|
+
# either true or false.
|
24
|
+
attr_reader :language_detection
|
25
|
+
# @return [Float] The confidence threshold for the automatically detected language.
|
26
|
+
# An error will be returned if the language confidence is below this threshold.
|
27
|
+
# Defaults to 0.
|
28
|
+
attr_reader :language_confidence_threshold
|
29
|
+
# @return [AssemblyAI::Transcripts::SpeechModel]
|
30
|
+
attr_reader :speech_model
|
21
31
|
# @return [Boolean] Enable Automatic Punctuation, can be true or false
|
22
32
|
attr_reader :punctuate
|
23
33
|
# @return [Boolean] Enable Text Formatting, can be true or false
|
24
34
|
attr_reader :format_text
|
35
|
+
# @return [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
36
|
+
attr_reader :disfluencies
|
25
37
|
# @return [Boolean] Enable [Dual
|
26
38
|
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
27
39
|
# transcription, can be true or false.
|
28
40
|
attr_reader :dual_channel
|
29
|
-
# @return [AssemblyAI::Transcripts::SpeechModel]
|
30
|
-
attr_reader :speech_model
|
31
41
|
# @return [String] The URL to which we send webhook requests. We sends two different types of
|
32
42
|
# webhook requests. One request when a transcript is completed or failed, and one
|
33
43
|
# request when the redacted audio is ready if redact_pii_audio is enabled.
|
@@ -46,7 +56,7 @@ module AssemblyAI
|
|
46
56
|
attr_reader :audio_end_at
|
47
57
|
# @return [Array<String>] The list of custom vocabulary to boost transcription probability for
|
48
58
|
attr_reader :word_boost
|
49
|
-
# @return [AssemblyAI::Transcripts::TranscriptBoostParam]
|
59
|
+
# @return [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
50
60
|
attr_reader :boost_param
|
51
61
|
# @return [Boolean] Filter profanity from the transcribed text, can be true or false
|
52
62
|
attr_reader :filter_profanity
|
@@ -89,14 +99,8 @@ module AssemblyAI
|
|
89
99
|
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
90
100
|
# or false
|
91
101
|
attr_reader :iab_categories
|
92
|
-
# @return [Boolean] Enable [Automatic language
|
93
|
-
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
94
|
-
# either true or false.
|
95
|
-
attr_reader :language_detection
|
96
102
|
# @return [Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>] Customize how words are spelled and formatted using to and from values
|
97
103
|
attr_reader :custom_spelling
|
98
|
-
# @return [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
99
|
-
attr_reader :disfluencies
|
100
104
|
# @return [Boolean] Enable [Sentiment
|
101
105
|
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
102
106
|
# true or false
|
@@ -131,12 +135,19 @@ module AssemblyAI
|
|
131
135
|
OMIT = Object.new
|
132
136
|
|
133
137
|
# @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
138
|
+
# @param language_detection [Boolean] Enable [Automatic language
|
139
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
140
|
+
# either true or false.
|
141
|
+
# @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language.
|
142
|
+
# An error will be returned if the language confidence is below this threshold.
|
143
|
+
# Defaults to 0.
|
144
|
+
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
134
145
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
135
146
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
147
|
+
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
136
148
|
# @param dual_channel [Boolean] Enable [Dual
|
137
149
|
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
138
150
|
# transcription, can be true or false.
|
139
|
-
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
140
151
|
# @param webhook_url [String] The URL to which we send webhook requests. We sends two different types of
|
141
152
|
# webhook requests. One request when a transcript is completed or failed, and one
|
142
153
|
# request when the redacted audio is ready if redact_pii_audio is enabled.
|
@@ -148,7 +159,7 @@ module AssemblyAI
|
|
148
159
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
149
160
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
150
161
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
151
|
-
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam]
|
162
|
+
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
152
163
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
153
164
|
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
154
165
|
# false
|
@@ -179,11 +190,7 @@ module AssemblyAI
|
|
179
190
|
# @param iab_categories [Boolean] Enable [Topic
|
180
191
|
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
181
192
|
# or false
|
182
|
-
# @param language_detection [Boolean] Enable [Automatic language
|
183
|
-
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
184
|
-
# either true or false.
|
185
193
|
# @param custom_spelling [Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>] Customize how words are spelled and formatted using to and from values
|
186
|
-
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
187
194
|
# @param sentiment_analysis [Boolean] Enable [Sentiment
|
188
195
|
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
189
196
|
# true or false
|
@@ -202,13 +209,16 @@ module AssemblyAI
|
|
202
209
|
# @param topics [Array<String>] The list of custom topics
|
203
210
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
204
211
|
# @return [AssemblyAI::Transcripts::TranscriptOptionalParams]
|
205
|
-
def initialize(language_code: OMIT,
|
206
|
-
webhook_url: OMIT, webhook_auth_header_name: OMIT, webhook_auth_header_value: OMIT, auto_highlights: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_confidence: OMIT, iab_categories: OMIT,
|
212
|
+
def initialize(language_code: OMIT, language_detection: OMIT, language_confidence_threshold: OMIT,
|
213
|
+
speech_model: OMIT, punctuate: OMIT, format_text: OMIT, disfluencies: OMIT, dual_channel: OMIT, webhook_url: OMIT, webhook_auth_header_name: OMIT, webhook_auth_header_value: OMIT, auto_highlights: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_confidence: OMIT, iab_categories: OMIT, custom_spelling: OMIT, sentiment_analysis: OMIT, auto_chapters: OMIT, entity_detection: OMIT, speech_threshold: OMIT, summarization: OMIT, summary_model: OMIT, summary_type: OMIT, custom_topics: OMIT, topics: OMIT, additional_properties: nil)
|
207
214
|
@language_code = language_code if language_code != OMIT
|
215
|
+
@language_detection = language_detection if language_detection != OMIT
|
216
|
+
@language_confidence_threshold = language_confidence_threshold if language_confidence_threshold != OMIT
|
217
|
+
@speech_model = speech_model if speech_model != OMIT
|
208
218
|
@punctuate = punctuate if punctuate != OMIT
|
209
219
|
@format_text = format_text if format_text != OMIT
|
220
|
+
@disfluencies = disfluencies if disfluencies != OMIT
|
210
221
|
@dual_channel = dual_channel if dual_channel != OMIT
|
211
|
-
@speech_model = speech_model if speech_model != OMIT
|
212
222
|
@webhook_url = webhook_url if webhook_url != OMIT
|
213
223
|
@webhook_auth_header_name = webhook_auth_header_name if webhook_auth_header_name != OMIT
|
214
224
|
@webhook_auth_header_value = webhook_auth_header_value if webhook_auth_header_value != OMIT
|
@@ -228,9 +238,7 @@ module AssemblyAI
|
|
228
238
|
@content_safety = content_safety if content_safety != OMIT
|
229
239
|
@content_safety_confidence = content_safety_confidence if content_safety_confidence != OMIT
|
230
240
|
@iab_categories = iab_categories if iab_categories != OMIT
|
231
|
-
@language_detection = language_detection if language_detection != OMIT
|
232
241
|
@custom_spelling = custom_spelling if custom_spelling != OMIT
|
233
|
-
@disfluencies = disfluencies if disfluencies != OMIT
|
234
242
|
@sentiment_analysis = sentiment_analysis if sentiment_analysis != OMIT
|
235
243
|
@auto_chapters = auto_chapters if auto_chapters != OMIT
|
236
244
|
@entity_detection = entity_detection if entity_detection != OMIT
|
@@ -243,10 +251,13 @@ module AssemblyAI
|
|
243
251
|
@additional_properties = additional_properties
|
244
252
|
@_field_set = {
|
245
253
|
"language_code": language_code,
|
254
|
+
"language_detection": language_detection,
|
255
|
+
"language_confidence_threshold": language_confidence_threshold,
|
256
|
+
"speech_model": speech_model,
|
246
257
|
"punctuate": punctuate,
|
247
258
|
"format_text": format_text,
|
259
|
+
"disfluencies": disfluencies,
|
248
260
|
"dual_channel": dual_channel,
|
249
|
-
"speech_model": speech_model,
|
250
261
|
"webhook_url": webhook_url,
|
251
262
|
"webhook_auth_header_name": webhook_auth_header_name,
|
252
263
|
"webhook_auth_header_value": webhook_auth_header_value,
|
@@ -266,9 +277,7 @@ module AssemblyAI
|
|
266
277
|
"content_safety": content_safety,
|
267
278
|
"content_safety_confidence": content_safety_confidence,
|
268
279
|
"iab_categories": iab_categories,
|
269
|
-
"language_detection": language_detection,
|
270
280
|
"custom_spelling": custom_spelling,
|
271
|
-
"disfluencies": disfluencies,
|
272
281
|
"sentiment_analysis": sentiment_analysis,
|
273
282
|
"auto_chapters": auto_chapters,
|
274
283
|
"entity_detection": entity_detection,
|
@@ -291,10 +300,13 @@ module AssemblyAI
|
|
291
300
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
292
301
|
parsed_json = JSON.parse(json_object)
|
293
302
|
language_code = struct["language_code"]
|
303
|
+
language_detection = struct["language_detection"]
|
304
|
+
language_confidence_threshold = struct["language_confidence_threshold"]
|
305
|
+
speech_model = struct["speech_model"]
|
294
306
|
punctuate = struct["punctuate"]
|
295
307
|
format_text = struct["format_text"]
|
308
|
+
disfluencies = struct["disfluencies"]
|
296
309
|
dual_channel = struct["dual_channel"]
|
297
|
-
speech_model = struct["speech_model"]
|
298
310
|
webhook_url = struct["webhook_url"]
|
299
311
|
webhook_auth_header_name = struct["webhook_auth_header_name"]
|
300
312
|
webhook_auth_header_value = struct["webhook_auth_header_value"]
|
@@ -314,12 +326,10 @@ module AssemblyAI
|
|
314
326
|
content_safety = struct["content_safety"]
|
315
327
|
content_safety_confidence = struct["content_safety_confidence"]
|
316
328
|
iab_categories = struct["iab_categories"]
|
317
|
-
language_detection = struct["language_detection"]
|
318
329
|
custom_spelling = parsed_json["custom_spelling"]&.map do |v|
|
319
330
|
v = v.to_json
|
320
331
|
AssemblyAI::Transcripts::TranscriptCustomSpelling.from_json(json_object: v)
|
321
332
|
end
|
322
|
-
disfluencies = struct["disfluencies"]
|
323
333
|
sentiment_analysis = struct["sentiment_analysis"]
|
324
334
|
auto_chapters = struct["auto_chapters"]
|
325
335
|
entity_detection = struct["entity_detection"]
|
@@ -331,10 +341,13 @@ module AssemblyAI
|
|
331
341
|
topics = struct["topics"]
|
332
342
|
new(
|
333
343
|
language_code: language_code,
|
344
|
+
language_detection: language_detection,
|
345
|
+
language_confidence_threshold: language_confidence_threshold,
|
346
|
+
speech_model: speech_model,
|
334
347
|
punctuate: punctuate,
|
335
348
|
format_text: format_text,
|
349
|
+
disfluencies: disfluencies,
|
336
350
|
dual_channel: dual_channel,
|
337
|
-
speech_model: speech_model,
|
338
351
|
webhook_url: webhook_url,
|
339
352
|
webhook_auth_header_name: webhook_auth_header_name,
|
340
353
|
webhook_auth_header_value: webhook_auth_header_value,
|
@@ -354,9 +367,7 @@ module AssemblyAI
|
|
354
367
|
content_safety: content_safety,
|
355
368
|
content_safety_confidence: content_safety_confidence,
|
356
369
|
iab_categories: iab_categories,
|
357
|
-
language_detection: language_detection,
|
358
370
|
custom_spelling: custom_spelling,
|
359
|
-
disfluencies: disfluencies,
|
360
371
|
sentiment_analysis: sentiment_analysis,
|
361
372
|
auto_chapters: auto_chapters,
|
362
373
|
entity_detection: entity_detection,
|
@@ -385,10 +396,13 @@ module AssemblyAI
|
|
385
396
|
# @return [Void]
|
386
397
|
def self.validate_raw(obj:)
|
387
398
|
obj.language_code&.is_a?(AssemblyAI::Transcripts::TranscriptLanguageCode) != false || raise("Passed value for field obj.language_code is not the expected type, validation failed.")
|
399
|
+
obj.language_detection&.is_a?(Boolean) != false || raise("Passed value for field obj.language_detection is not the expected type, validation failed.")
|
400
|
+
obj.language_confidence_threshold&.is_a?(Float) != false || raise("Passed value for field obj.language_confidence_threshold is not the expected type, validation failed.")
|
401
|
+
obj.speech_model&.is_a?(AssemblyAI::Transcripts::SpeechModel) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
|
388
402
|
obj.punctuate&.is_a?(Boolean) != false || raise("Passed value for field obj.punctuate is not the expected type, validation failed.")
|
389
403
|
obj.format_text&.is_a?(Boolean) != false || raise("Passed value for field obj.format_text is not the expected type, validation failed.")
|
404
|
+
obj.disfluencies&.is_a?(Boolean) != false || raise("Passed value for field obj.disfluencies is not the expected type, validation failed.")
|
390
405
|
obj.dual_channel&.is_a?(Boolean) != false || raise("Passed value for field obj.dual_channel is not the expected type, validation failed.")
|
391
|
-
obj.speech_model&.is_a?(AssemblyAI::Transcripts::SpeechModel) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
|
392
406
|
obj.webhook_url&.is_a?(String) != false || raise("Passed value for field obj.webhook_url is not the expected type, validation failed.")
|
393
407
|
obj.webhook_auth_header_name&.is_a?(String) != false || raise("Passed value for field obj.webhook_auth_header_name is not the expected type, validation failed.")
|
394
408
|
obj.webhook_auth_header_value&.is_a?(String) != false || raise("Passed value for field obj.webhook_auth_header_value is not the expected type, validation failed.")
|
@@ -408,9 +422,7 @@ module AssemblyAI
|
|
408
422
|
obj.content_safety&.is_a?(Boolean) != false || raise("Passed value for field obj.content_safety is not the expected type, validation failed.")
|
409
423
|
obj.content_safety_confidence&.is_a?(Integer) != false || raise("Passed value for field obj.content_safety_confidence is not the expected type, validation failed.")
|
410
424
|
obj.iab_categories&.is_a?(Boolean) != false || raise("Passed value for field obj.iab_categories is not the expected type, validation failed.")
|
411
|
-
obj.language_detection&.is_a?(Boolean) != false || raise("Passed value for field obj.language_detection is not the expected type, validation failed.")
|
412
425
|
obj.custom_spelling&.is_a?(Array) != false || raise("Passed value for field obj.custom_spelling is not the expected type, validation failed.")
|
413
|
-
obj.disfluencies&.is_a?(Boolean) != false || raise("Passed value for field obj.disfluencies is not the expected type, validation failed.")
|
414
426
|
obj.sentiment_analysis&.is_a?(Boolean) != false || raise("Passed value for field obj.sentiment_analysis is not the expected type, validation failed.")
|
415
427
|
obj.auto_chapters&.is_a?(Boolean) != false || raise("Passed value for field obj.auto_chapters is not the expected type, validation failed.")
|
416
428
|
obj.entity_detection&.is_a?(Boolean) != false || raise("Passed value for field obj.entity_detection is not the expected type, validation failed.")
|
data/lib/gemconfig.rb
CHANGED
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
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AssemblyAI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http-faraday
|