assemblyai 1.0.0.pre.beta → 1.0.0.pre.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assemblyai/lemur/client.rb +16 -16
  3. data/lib/assemblyai/lemur/types/lemur_base_params.rb +5 -5
  4. data/lib/assemblyai/lemur/types/lemur_base_params_context.rb +3 -29
  5. data/lib/assemblyai/lemur/types/lemur_model.rb +7 -7
  6. data/lib/assemblyai/lemur/types/lemur_question_context.rb +3 -29
  7. data/lib/assemblyai/realtime/types/audio_encoding.rb +5 -2
  8. data/lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb +48 -0
  9. data/lib/assemblyai/realtime/types/force_end_utterance.rb +48 -0
  10. data/lib/assemblyai/realtime/types/message_type.rb +6 -7
  11. data/lib/assemblyai/realtime/types/realtime_base_message.rb +6 -6
  12. data/lib/assemblyai/realtime/types/realtime_message.rb +6 -35
  13. data/lib/assemblyai/realtime/types/realtime_transcript.rb +3 -29
  14. data/lib/assemblyai/realtime/types/realtime_transcript_type.rb +4 -2
  15. data/lib/assemblyai/realtime/types/terminate_session.rb +5 -14
  16. data/lib/assemblyai/transcripts/client.rb +20 -20
  17. data/lib/assemblyai/transcripts/types/audio_intelligence_model_status.rb +5 -2
  18. data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +5 -5
  19. data/lib/assemblyai/transcripts/types/entity.rb +6 -11
  20. data/lib/assemblyai/transcripts/types/entity_type.rb +32 -32
  21. data/lib/assemblyai/transcripts/types/pii_policy.rb +29 -30
  22. data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +5 -2
  23. data/lib/assemblyai/transcripts/types/sentiment.rb +5 -2
  24. data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +6 -6
  25. data/lib/assemblyai/transcripts/types/speech_model.rb +4 -1
  26. data/lib/assemblyai/transcripts/types/substitution_policy.rb +5 -2
  27. data/lib/assemblyai/transcripts/types/subtitle_format.rb +5 -2
  28. data/lib/assemblyai/transcripts/types/summary_model.rb +6 -2
  29. data/lib/assemblyai/transcripts/types/summary_type.rb +8 -8
  30. data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +5 -9
  31. data/lib/assemblyai/transcripts/types/transcript.rb +26 -29
  32. data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +6 -2
  33. data/lib/assemblyai/transcripts/types/transcript_language_code.rb +24 -23
  34. data/lib/assemblyai/transcripts/types/transcript_list_item.rb +5 -5
  35. data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +36 -39
  36. data/lib/assemblyai/transcripts/types/transcript_status.rb +7 -2
  37. data/lib/requests.rb +28 -2
  38. data/lib/types_export.rb +7 -5
  39. metadata +54 -14
@@ -25,11 +25,11 @@ module AssemblyAI
25
25
  :words, :utterances, :confidence, :audio_duration, :punctuate, :format_text, :dual_channel, :webhook_url, :webhook_status_code, :webhook_auth, :webhook_auth_header_name, :speed_boost, :auto_highlights, :auto_highlights_result, :audio_start_from, :audio_end_at, :word_boost, :boost_param, :filter_profanity, :redact_pii, :redact_pii_audio, :redact_pii_audio_quality, :redact_pii_policies, :redact_pii_sub, :speaker_labels, :speakers_expected, :content_safety, :content_safety_labels, :iab_categories, :iab_categories_result, :language_detection, :custom_spelling, :auto_chapters, :chapters, :summarization, :summary_type, :summary_model, :summary, :custom_topics, :topics, :disfluencies, :sentiment_analysis, :sentiment_analysis_results, :entity_detection, :entities, :speech_threshold, :throttled, :error, :additional_properties
26
26
 
27
27
  # @param id [String] The unique identifier of your transcript
28
- # @param speech_model [Transcripts::SPEECH_MODEL]
28
+ # @param speech_model [Transcripts::SpeechModel]
29
29
  # @param language_model [String] The language model that was used for the transcript
30
30
  # @param acoustic_model [String] The acoustic model that was used for the transcript
31
- # @param status [TRANSCRIPT_STATUS] The status of your transcript. Possible values are queued, processing, completed, or error.
32
- # @param language_code [TRANSCRIPT_LANGUAGE_CODE] The language of your audio file.
31
+ # @param status [Transcripts::TranscriptStatus] The status of your transcript. Possible values are queued, processing, completed, or error.
32
+ # @param language_code [Transcripts::TranscriptLanguageCode] The language of your audio file.
33
33
  # Possible values are found in [Supported Languages](https://www.assemblyai.com/docs/concepts/supported-languages).
34
34
  # The default value is 'en_us'.
35
35
  # @param audio_url [String] The URL of the media that was transcribed
@@ -58,10 +58,10 @@ module AssemblyAI
58
58
  # @param redact_pii [Boolean] Whether [PII Redaction](https://www.assemblyai.com/docs/models/pii-redaction) is enabled, either true or false
59
59
  # @param redact_pii_audio [Boolean] Whether a redacted version of the audio file was generated,
60
60
  # either true or false. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more information.
61
- # @param redact_pii_audio_quality [REDACT_PII_AUDIO_QUALITY]
62
- # @param redact_pii_policies [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies that were enabled, if PII Redaction is enabled.
61
+ # @param redact_pii_audio_quality [Transcripts::RedactPiiAudioQuality]
62
+ # @param redact_pii_policies [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies that were enabled, if PII Redaction is enabled.
63
63
  # See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more information.
64
- # @param redact_pii_sub [SUBSTITUTION_POLICY] The replacement logic for detected PII, can be "entity_type" or "hash". See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
64
+ # @param redact_pii_sub [Transcripts::SubstitutionPolicy] The replacement logic for detected PII, can be "entity_type" or "hash". See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
65
65
  # @param speaker_labels [Boolean] Whether [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, can be true or false
66
66
  # @param speakers_expected [Integer] Tell the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for more details.
67
67
  # @param content_safety [Boolean] Whether [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation) is enabled, can be true or false
@@ -96,15 +96,15 @@ module AssemblyAI
96
96
  text: nil, words: nil, utterances: nil, confidence: nil, audio_duration: nil, punctuate: nil, format_text: nil, dual_channel: nil, webhook_url: nil, webhook_status_code: nil, webhook_auth_header_name: nil, speed_boost: nil, auto_highlights_result: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_labels: nil, iab_categories: nil, iab_categories_result: nil, language_detection: nil, custom_spelling: nil, auto_chapters: nil, chapters: nil, summary_type: nil, summary_model: nil, summary: nil, custom_topics: nil, topics: nil, disfluencies: nil, sentiment_analysis: nil, sentiment_analysis_results: nil, entity_detection: nil, entities: nil, speech_threshold: nil, throttled: nil, error: nil, additional_properties: nil)
97
97
  # @type [String] The unique identifier of your transcript
98
98
  @id = id
99
- # @type [Transcripts::SPEECH_MODEL]
99
+ # @type [Transcripts::SpeechModel]
100
100
  @speech_model = speech_model
101
101
  # @type [String] The language model that was used for the transcript
102
102
  @language_model = language_model
103
103
  # @type [String] The acoustic model that was used for the transcript
104
104
  @acoustic_model = acoustic_model
105
- # @type [TRANSCRIPT_STATUS] The status of your transcript. Possible values are queued, processing, completed, or error.
105
+ # @type [Transcripts::TranscriptStatus] The status of your transcript. Possible values are queued, processing, completed, or error.
106
106
  @status = status
107
- # @type [TRANSCRIPT_LANGUAGE_CODE] The language of your audio file.
107
+ # @type [Transcripts::TranscriptLanguageCode] The language of your audio file.
108
108
  # Possible values are found in [Supported Languages](https://www.assemblyai.com/docs/concepts/supported-languages).
109
109
  # The default value is 'en_us'.
110
110
  @language_code = language_code
@@ -157,12 +157,12 @@ module AssemblyAI
157
157
  # @type [Boolean] Whether a redacted version of the audio file was generated,
158
158
  # either true or false. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more information.
159
159
  @redact_pii_audio = redact_pii_audio
160
- # @type [REDACT_PII_AUDIO_QUALITY]
160
+ # @type [Transcripts::RedactPiiAudioQuality]
161
161
  @redact_pii_audio_quality = redact_pii_audio_quality
162
- # @type [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies that were enabled, if PII Redaction is enabled.
162
+ # @type [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies that were enabled, if PII Redaction is enabled.
163
163
  # See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more information.
164
164
  @redact_pii_policies = redact_pii_policies
165
- # @type [SUBSTITUTION_POLICY] The replacement logic for detected PII, can be "entity_type" or "hash". See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
165
+ # @type [Transcripts::SubstitutionPolicy] The replacement logic for detected PII, can be "entity_type" or "hash". See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
166
166
  @redact_pii_sub = redact_pii_sub
167
167
  # @type [Boolean] Whether [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, can be true or false
168
168
  @speaker_labels = speaker_labels
@@ -231,8 +231,8 @@ module AssemblyAI
231
231
  speech_model = struct.speech_model
232
232
  language_model = struct.language_model
233
233
  acoustic_model = struct.acoustic_model
234
- status = Transcripts::TRANSCRIPT_STATUS.key(parsed_json["status"]) || parsed_json["status"]
235
- language_code = Transcripts::TRANSCRIPT_LANGUAGE_CODE.key(parsed_json["language_code"]) || parsed_json["language_code"]
234
+ status = struct.status
235
+ language_code = struct.language_code
236
236
  audio_url = struct.audio_url
237
237
  text = struct.text
238
238
  words = parsed_json["words"]&.map do |v|
@@ -267,12 +267,9 @@ module AssemblyAI
267
267
  filter_profanity = struct.filter_profanity
268
268
  redact_pii = struct.redact_pii
269
269
  redact_pii_audio = struct.redact_pii_audio
270
- redact_pii_audio_quality = Transcripts::REDACT_PII_AUDIO_QUALITY.key(parsed_json["redact_pii_audio_quality"]) || parsed_json["redact_pii_audio_quality"]
271
- redact_pii_policies = parsed_json["redact_pii_policies"]&.map do |v|
272
- v = v.to_json
273
- Transcripts::PII_POLICY.key(v) || v
274
- end
275
- redact_pii_sub = Transcripts::SUBSTITUTION_POLICY.key(parsed_json["redact_pii_sub"]) || parsed_json["redact_pii_sub"]
270
+ redact_pii_audio_quality = struct.redact_pii_audio_quality
271
+ redact_pii_policies = struct.redact_pii_policies
272
+ redact_pii_sub = struct.redact_pii_sub
276
273
  speaker_labels = struct.speaker_labels
277
274
  speakers_expected = struct.speakers_expected
278
275
  content_safety = struct.content_safety
@@ -332,8 +329,8 @@ module AssemblyAI
332
329
  "speech_model": @speech_model,
333
330
  "language_model": @language_model,
334
331
  "acoustic_model": @acoustic_model,
335
- "status": Transcripts::TRANSCRIPT_STATUS[@status] || @status,
336
- "language_code": Transcripts::TRANSCRIPT_LANGUAGE_CODE[@language_code] || @language_code,
332
+ "status": @status,
333
+ "language_code": @language_code,
337
334
  "audio_url": @audio_url,
338
335
  "text": @text,
339
336
  "words": @words,
@@ -357,9 +354,9 @@ module AssemblyAI
357
354
  "filter_profanity": @filter_profanity,
358
355
  "redact_pii": @redact_pii,
359
356
  "redact_pii_audio": @redact_pii_audio,
360
- "redact_pii_audio_quality": Transcripts::REDACT_PII_AUDIO_QUALITY[@redact_pii_audio_quality] || @redact_pii_audio_quality,
357
+ "redact_pii_audio_quality": @redact_pii_audio_quality,
361
358
  "redact_pii_policies": @redact_pii_policies,
362
- "redact_pii_sub": Transcripts::SUBSTITUTION_POLICY[@redact_pii_sub] || @redact_pii_sub,
359
+ "redact_pii_sub": @redact_pii_sub,
363
360
  "speaker_labels": @speaker_labels,
364
361
  "speakers_expected": @speakers_expected,
365
362
  "content_safety": @content_safety,
@@ -393,11 +390,11 @@ module AssemblyAI
393
390
  # @return [Void]
394
391
  def self.validate_raw(obj:)
395
392
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
396
- obj.speech_model&.is_a?(String) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
393
+ obj.speech_model&.is_a?(Transcripts::SpeechModel) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
397
394
  obj.language_model.is_a?(String) != false || raise("Passed value for field obj.language_model is not the expected type, validation failed.")
398
395
  obj.acoustic_model.is_a?(String) != false || raise("Passed value for field obj.acoustic_model is not the expected type, validation failed.")
399
- obj.status.is_a?(Transcripts::TRANSCRIPT_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
400
- obj.language_code&.is_a?(Transcripts::TRANSCRIPT_LANGUAGE_CODE) != false || raise("Passed value for field obj.language_code is not the expected type, validation failed.")
396
+ obj.status.is_a?(Transcripts::TranscriptStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
397
+ obj.language_code&.is_a?(Transcripts::TranscriptLanguageCode) != false || raise("Passed value for field obj.language_code is not the expected type, validation failed.")
401
398
  obj.audio_url.is_a?(String) != false || raise("Passed value for field obj.audio_url is not the expected type, validation failed.")
402
399
  obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
403
400
  obj.words&.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.")
@@ -421,9 +418,9 @@ module AssemblyAI
421
418
  obj.filter_profanity&.is_a?(Boolean) != false || raise("Passed value for field obj.filter_profanity is not the expected type, validation failed.")
422
419
  obj.redact_pii.is_a?(Boolean) != false || raise("Passed value for field obj.redact_pii is not the expected type, validation failed.")
423
420
  obj.redact_pii_audio&.is_a?(Boolean) != false || raise("Passed value for field obj.redact_pii_audio is not the expected type, validation failed.")
424
- obj.redact_pii_audio_quality&.is_a?(Transcripts::REDACT_PII_AUDIO_QUALITY) != false || raise("Passed value for field obj.redact_pii_audio_quality is not the expected type, validation failed.")
421
+ obj.redact_pii_audio_quality&.is_a?(Transcripts::RedactPiiAudioQuality) != false || raise("Passed value for field obj.redact_pii_audio_quality is not the expected type, validation failed.")
425
422
  obj.redact_pii_policies&.is_a?(Array) != false || raise("Passed value for field obj.redact_pii_policies is not the expected type, validation failed.")
426
- obj.redact_pii_sub&.is_a?(Transcripts::SUBSTITUTION_POLICY) != false || raise("Passed value for field obj.redact_pii_sub is not the expected type, validation failed.")
423
+ obj.redact_pii_sub&.is_a?(Transcripts::SubstitutionPolicy) != false || raise("Passed value for field obj.redact_pii_sub is not the expected type, validation failed.")
427
424
  obj.speaker_labels&.is_a?(Boolean) != false || raise("Passed value for field obj.speaker_labels is not the expected type, validation failed.")
428
425
  obj.speakers_expected&.is_a?(Integer) != false || raise("Passed value for field obj.speakers_expected is not the expected type, validation failed.")
429
426
  obj.content_safety&.is_a?(Boolean) != false || raise("Passed value for field obj.content_safety is not the expected type, validation failed.")
@@ -2,7 +2,11 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [TRANSCRIPT_BOOST_PARAM]
6
- TRANSCRIPT_BOOST_PARAM = { low: "low", default: "default", high: "high" }.freeze
5
+ # The word boost parameter value
6
+ class TranscriptBoostParam
7
+ LOW = "low"
8
+ DEFAULT = "default"
9
+ HIGH = "high"
10
+ end
7
11
  end
8
12
  end
@@ -2,28 +2,29 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [TRANSCRIPT_LANGUAGE_CODE]
6
- TRANSCRIPT_LANGUAGE_CODE = {
7
- en: "en",
8
- en_au: "en_au",
9
- en_uk: "en_uk",
10
- en_us: "en_us",
11
- es: "es",
12
- fr: "fr",
13
- de: "de",
14
- it: "it",
15
- pt: "pt",
16
- nl: "nl",
17
- hi: "hi",
18
- ja: "ja",
19
- zh: "zh",
20
- fi: "fi",
21
- ko: "ko",
22
- pl: "pl",
23
- ru: "ru",
24
- tr: "tr",
25
- uk: "uk",
26
- vi: "vi"
27
- }.freeze
5
+ # The language of your audio file. Possible values are found in [Supported Languages](https://www.assemblyai.com/docs/concepts/supported-languages).
6
+ # The default value is 'en_us'.
7
+ class TranscriptLanguageCode
8
+ EN = "en"
9
+ EN_AU = "en_au"
10
+ EN_UK = "en_uk"
11
+ EN_US = "en_us"
12
+ ES = "es"
13
+ FR = "fr"
14
+ DE = "de"
15
+ IT = "it"
16
+ PT = "pt"
17
+ NL = "nl"
18
+ HI = "hi"
19
+ JA = "ja"
20
+ ZH = "zh"
21
+ FI = "fi"
22
+ KO = "ko"
23
+ PL = "pl"
24
+ RU = "ru"
25
+ TR = "tr"
26
+ UK = "uk"
27
+ VI = "vi"
28
+ end
28
29
  end
29
30
  end
@@ -11,7 +11,7 @@ module AssemblyAI
11
11
 
12
12
  # @param id [String]
13
13
  # @param resource_url [String]
14
- # @param status [TRANSCRIPT_STATUS]
14
+ # @param status [Transcripts::TranscriptStatus]
15
15
  # @param created [DateTime]
16
16
  # @param completed [DateTime]
17
17
  # @param audio_url [String]
@@ -22,7 +22,7 @@ module AssemblyAI
22
22
  @id = id
23
23
  # @type [String]
24
24
  @resource_url = resource_url
25
- # @type [TRANSCRIPT_STATUS]
25
+ # @type [Transcripts::TranscriptStatus]
26
26
  @status = status
27
27
  # @type [DateTime]
28
28
  @created = created
@@ -43,7 +43,7 @@ module AssemblyAI
43
43
  parsed_json = JSON.parse(json_object)
44
44
  id = struct.id
45
45
  resource_url = struct.resource_url
46
- status = Transcripts::TRANSCRIPT_STATUS.key(parsed_json["status"]) || parsed_json["status"]
46
+ status = struct.status
47
47
  created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
48
48
  completed = (DateTime.parse(parsed_json["completed"]) unless parsed_json["completed"].nil?)
49
49
  audio_url = struct.audio_url
@@ -58,7 +58,7 @@ module AssemblyAI
58
58
  {
59
59
  "id": @id,
60
60
  "resource_url": @resource_url,
61
- "status": Transcripts::TRANSCRIPT_STATUS[@status] || @status,
61
+ "status": @status,
62
62
  "created": @created,
63
63
  "completed": @completed,
64
64
  "audio_url": @audio_url
@@ -72,7 +72,7 @@ module AssemblyAI
72
72
  def self.validate_raw(obj:)
73
73
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
74
74
  obj.resource_url.is_a?(String) != false || raise("Passed value for field obj.resource_url is not the expected type, validation failed.")
75
- obj.status.is_a?(Transcripts::TRANSCRIPT_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
75
+ obj.status.is_a?(Transcripts::TranscriptStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
76
76
  obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
77
77
  obj.completed.is_a?(DateTime) != false || raise("Passed value for field obj.completed is not the expected type, validation failed.")
78
78
  obj.audio_url.is_a?(String) != false || raise("Passed value for field obj.audio_url is not the expected type, validation failed.")
@@ -18,8 +18,8 @@ module AssemblyAI
18
18
  attr_reader :speech_model, :language_code, :punctuate, :format_text, :dual_channel, :webhook_url,
19
19
  :webhook_auth_header_name, :webhook_auth_header_value, :auto_highlights, :audio_start_from, :audio_end_at, :word_boost, :boost_param, :filter_profanity, :redact_pii, :redact_pii_audio, :redact_pii_audio_quality, :redact_pii_policies, :redact_pii_sub, :speaker_labels, :speakers_expected, :content_safety, :content_safety_confidence, :iab_categories, :language_detection, :custom_spelling, :disfluencies, :sentiment_analysis, :auto_chapters, :entity_detection, :speech_threshold, :summarization, :summary_model, :summary_type, :custom_topics, :topics, :additional_properties
20
20
 
21
- # @param speech_model [Transcripts::SPEECH_MODEL]
22
- # @param language_code [TRANSCRIPT_LANGUAGE_CODE]
21
+ # @param speech_model [Transcripts::SpeechModel]
22
+ # @param language_code [Transcripts::TranscriptLanguageCode]
23
23
  # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
24
24
  # @param format_text [Boolean] Enable Text Formatting, can be true or false
25
25
  # @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
@@ -30,13 +30,13 @@ module AssemblyAI
30
30
  # @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
31
31
  # @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
32
32
  # @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
33
- # @param boost_param [TRANSCRIPT_BOOST_PARAM] The word boost parameter value
33
+ # @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value
34
34
  # @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
35
35
  # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false
36
36
  # @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be true or false. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
37
- # @param redact_pii_audio_quality [REDACT_PII_AUDIO_QUALITY] Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
38
- # @param redact_pii_policies [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
39
- # @param redact_pii_sub [SUBSTITUTION_POLICY]
37
+ # @param redact_pii_audio_quality [Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
38
+ # @param redact_pii_policies [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
39
+ # @param redact_pii_sub [Transcripts::SubstitutionPolicy]
40
40
  # @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
41
41
  # @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for more details.
42
42
  # @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false
@@ -51,17 +51,17 @@ module AssemblyAI
51
51
  # @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
52
52
  # Valid values are in the range [0, 1] inclusive.
53
53
  # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
54
- # @param summary_model [SUMMARY_MODEL] The model to summarize the transcript
55
- # @param summary_type [SUMMARY_TYPE] The type of summary
54
+ # @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript
55
+ # @param summary_type [Transcripts::SummaryType] The type of summary
56
56
  # @param custom_topics [Boolean] Whether custom topics is enabled, either true or false
57
57
  # @param topics [Array<String>] The list of custom topics provided, if custom topics is enabled
58
58
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
59
59
  # @return [Transcripts::TranscriptOptionalParams]
60
60
  def initialize(speech_model: nil, language_code: nil, punctuate: nil, format_text: nil, dual_channel: nil,
61
61
  webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, language_detection: nil, custom_spelling: nil, disfluencies: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, additional_properties: nil)
62
- # @type [Transcripts::SPEECH_MODEL]
62
+ # @type [Transcripts::SpeechModel]
63
63
  @speech_model = speech_model
64
- # @type [TRANSCRIPT_LANGUAGE_CODE]
64
+ # @type [Transcripts::TranscriptLanguageCode]
65
65
  @language_code = language_code
66
66
  # @type [Boolean] Enable Automatic Punctuation, can be true or false
67
67
  @punctuate = punctuate
@@ -83,7 +83,7 @@ module AssemblyAI
83
83
  @audio_end_at = audio_end_at
84
84
  # @type [Array<String>] The list of custom vocabulary to boost transcription probability for
85
85
  @word_boost = word_boost
86
- # @type [TRANSCRIPT_BOOST_PARAM] The word boost parameter value
86
+ # @type [Transcripts::TranscriptBoostParam] The word boost parameter value
87
87
  @boost_param = boost_param
88
88
  # @type [Boolean] Filter profanity from the transcribed text, can be true or false
89
89
  @filter_profanity = filter_profanity
@@ -91,11 +91,11 @@ module AssemblyAI
91
91
  @redact_pii = redact_pii
92
92
  # @type [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be true or false. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
93
93
  @redact_pii_audio = redact_pii_audio
94
- # @type [REDACT_PII_AUDIO_QUALITY] Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
94
+ # @type [Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
95
95
  @redact_pii_audio_quality = redact_pii_audio_quality
96
- # @type [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
96
+ # @type [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
97
97
  @redact_pii_policies = redact_pii_policies
98
- # @type [SUBSTITUTION_POLICY]
98
+ # @type [Transcripts::SubstitutionPolicy]
99
99
  @redact_pii_sub = redact_pii_sub
100
100
  # @type [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
101
101
  @speaker_labels = speaker_labels
@@ -124,9 +124,9 @@ module AssemblyAI
124
124
  @speech_threshold = speech_threshold
125
125
  # @type [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
126
126
  @summarization = summarization
127
- # @type [SUMMARY_MODEL] The model to summarize the transcript
127
+ # @type [Transcripts::SummaryModel] The model to summarize the transcript
128
128
  @summary_model = summary_model
129
- # @type [SUMMARY_TYPE] The type of summary
129
+ # @type [Transcripts::SummaryType] The type of summary
130
130
  @summary_type = summary_type
131
131
  # @type [Boolean] Whether custom topics is enabled, either true or false
132
132
  @custom_topics = custom_topics
@@ -144,7 +144,7 @@ module AssemblyAI
144
144
  struct = JSON.parse(json_object, object_class: OpenStruct)
145
145
  parsed_json = JSON.parse(json_object)
146
146
  speech_model = struct.speech_model
147
- language_code = Transcripts::TRANSCRIPT_LANGUAGE_CODE.key(parsed_json["language_code"]) || parsed_json["language_code"]
147
+ language_code = struct.language_code
148
148
  punctuate = struct.punctuate
149
149
  format_text = struct.format_text
150
150
  dual_channel = struct.dual_channel
@@ -155,16 +155,13 @@ module AssemblyAI
155
155
  audio_start_from = struct.audio_start_from
156
156
  audio_end_at = struct.audio_end_at
157
157
  word_boost = struct.word_boost
158
- boost_param = Transcripts::TRANSCRIPT_BOOST_PARAM.key(parsed_json["boost_param"]) || parsed_json["boost_param"]
158
+ boost_param = struct.boost_param
159
159
  filter_profanity = struct.filter_profanity
160
160
  redact_pii = struct.redact_pii
161
161
  redact_pii_audio = struct.redact_pii_audio
162
- redact_pii_audio_quality = Transcripts::REDACT_PII_AUDIO_QUALITY.key(parsed_json["redact_pii_audio_quality"]) || parsed_json["redact_pii_audio_quality"]
163
- redact_pii_policies = parsed_json["redact_pii_policies"]&.map do |v|
164
- v = v.to_json
165
- Transcripts::PII_POLICY.key(v) || v
166
- end
167
- redact_pii_sub = Transcripts::SUBSTITUTION_POLICY.key(parsed_json["redact_pii_sub"]) || parsed_json["redact_pii_sub"]
162
+ redact_pii_audio_quality = struct.redact_pii_audio_quality
163
+ redact_pii_policies = struct.redact_pii_policies
164
+ redact_pii_sub = struct.redact_pii_sub
168
165
  speaker_labels = struct.speaker_labels
169
166
  speakers_expected = struct.speakers_expected
170
167
  content_safety = struct.content_safety
@@ -181,8 +178,8 @@ module AssemblyAI
181
178
  entity_detection = struct.entity_detection
182
179
  speech_threshold = struct.speech_threshold
183
180
  summarization = struct.summarization
184
- summary_model = Transcripts::SUMMARY_MODEL.key(parsed_json["summary_model"]) || parsed_json["summary_model"]
185
- summary_type = Transcripts::SUMMARY_TYPE.key(parsed_json["summary_type"]) || parsed_json["summary_type"]
181
+ summary_model = struct.summary_model
182
+ summary_type = struct.summary_type
186
183
  custom_topics = struct.custom_topics
187
184
  topics = struct.topics
188
185
  new(speech_model: speech_model, language_code: language_code, punctuate: punctuate, format_text: format_text,
@@ -195,7 +192,7 @@ module AssemblyAI
195
192
  def to_json(*_args)
196
193
  {
197
194
  "speech_model": @speech_model,
198
- "language_code": Transcripts::TRANSCRIPT_LANGUAGE_CODE[@language_code] || @language_code,
195
+ "language_code": @language_code,
199
196
  "punctuate": @punctuate,
200
197
  "format_text": @format_text,
201
198
  "dual_channel": @dual_channel,
@@ -206,13 +203,13 @@ module AssemblyAI
206
203
  "audio_start_from": @audio_start_from,
207
204
  "audio_end_at": @audio_end_at,
208
205
  "word_boost": @word_boost,
209
- "boost_param": Transcripts::TRANSCRIPT_BOOST_PARAM[@boost_param] || @boost_param,
206
+ "boost_param": @boost_param,
210
207
  "filter_profanity": @filter_profanity,
211
208
  "redact_pii": @redact_pii,
212
209
  "redact_pii_audio": @redact_pii_audio,
213
- "redact_pii_audio_quality": Transcripts::REDACT_PII_AUDIO_QUALITY[@redact_pii_audio_quality] || @redact_pii_audio_quality,
210
+ "redact_pii_audio_quality": @redact_pii_audio_quality,
214
211
  "redact_pii_policies": @redact_pii_policies,
215
- "redact_pii_sub": Transcripts::SUBSTITUTION_POLICY[@redact_pii_sub] || @redact_pii_sub,
212
+ "redact_pii_sub": @redact_pii_sub,
216
213
  "speaker_labels": @speaker_labels,
217
214
  "speakers_expected": @speakers_expected,
218
215
  "content_safety": @content_safety,
@@ -226,8 +223,8 @@ module AssemblyAI
226
223
  "entity_detection": @entity_detection,
227
224
  "speech_threshold": @speech_threshold,
228
225
  "summarization": @summarization,
229
- "summary_model": Transcripts::SUMMARY_MODEL[@summary_model] || @summary_model,
230
- "summary_type": Transcripts::SUMMARY_TYPE[@summary_type] || @summary_type,
226
+ "summary_model": @summary_model,
227
+ "summary_type": @summary_type,
231
228
  "custom_topics": @custom_topics,
232
229
  "topics": @topics
233
230
  }.to_json
@@ -238,8 +235,8 @@ module AssemblyAI
238
235
  # @param obj [Object]
239
236
  # @return [Void]
240
237
  def self.validate_raw(obj:)
241
- obj.speech_model&.is_a?(String) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
242
- obj.language_code&.is_a?(Transcripts::TRANSCRIPT_LANGUAGE_CODE) != false || raise("Passed value for field obj.language_code is not the expected type, validation failed.")
238
+ obj.speech_model&.is_a?(Transcripts::SpeechModel) != false || raise("Passed value for field obj.speech_model is not the expected type, validation failed.")
239
+ obj.language_code&.is_a?(Transcripts::TranscriptLanguageCode) != false || raise("Passed value for field obj.language_code is not the expected type, validation failed.")
243
240
  obj.punctuate&.is_a?(Boolean) != false || raise("Passed value for field obj.punctuate is not the expected type, validation failed.")
244
241
  obj.format_text&.is_a?(Boolean) != false || raise("Passed value for field obj.format_text is not the expected type, validation failed.")
245
242
  obj.dual_channel&.is_a?(Boolean) != false || raise("Passed value for field obj.dual_channel is not the expected type, validation failed.")
@@ -250,13 +247,13 @@ module AssemblyAI
250
247
  obj.audio_start_from&.is_a?(Integer) != false || raise("Passed value for field obj.audio_start_from is not the expected type, validation failed.")
251
248
  obj.audio_end_at&.is_a?(Integer) != false || raise("Passed value for field obj.audio_end_at is not the expected type, validation failed.")
252
249
  obj.word_boost&.is_a?(Array) != false || raise("Passed value for field obj.word_boost is not the expected type, validation failed.")
253
- obj.boost_param&.is_a?(Transcripts::TRANSCRIPT_BOOST_PARAM) != false || raise("Passed value for field obj.boost_param is not the expected type, validation failed.")
250
+ obj.boost_param&.is_a?(Transcripts::TranscriptBoostParam) != false || raise("Passed value for field obj.boost_param is not the expected type, validation failed.")
254
251
  obj.filter_profanity&.is_a?(Boolean) != false || raise("Passed value for field obj.filter_profanity is not the expected type, validation failed.")
255
252
  obj.redact_pii&.is_a?(Boolean) != false || raise("Passed value for field obj.redact_pii is not the expected type, validation failed.")
256
253
  obj.redact_pii_audio&.is_a?(Boolean) != false || raise("Passed value for field obj.redact_pii_audio is not the expected type, validation failed.")
257
- obj.redact_pii_audio_quality&.is_a?(Transcripts::REDACT_PII_AUDIO_QUALITY) != false || raise("Passed value for field obj.redact_pii_audio_quality is not the expected type, validation failed.")
254
+ obj.redact_pii_audio_quality&.is_a?(Transcripts::RedactPiiAudioQuality) != false || raise("Passed value for field obj.redact_pii_audio_quality is not the expected type, validation failed.")
258
255
  obj.redact_pii_policies&.is_a?(Array) != false || raise("Passed value for field obj.redact_pii_policies is not the expected type, validation failed.")
259
- obj.redact_pii_sub&.is_a?(Transcripts::SUBSTITUTION_POLICY) != false || raise("Passed value for field obj.redact_pii_sub is not the expected type, validation failed.")
256
+ obj.redact_pii_sub&.is_a?(Transcripts::SubstitutionPolicy) != false || raise("Passed value for field obj.redact_pii_sub is not the expected type, validation failed.")
260
257
  obj.speaker_labels&.is_a?(Boolean) != false || raise("Passed value for field obj.speaker_labels is not the expected type, validation failed.")
261
258
  obj.speakers_expected&.is_a?(Integer) != false || raise("Passed value for field obj.speakers_expected is not the expected type, validation failed.")
262
259
  obj.content_safety&.is_a?(Boolean) != false || raise("Passed value for field obj.content_safety is not the expected type, validation failed.")
@@ -270,8 +267,8 @@ module AssemblyAI
270
267
  obj.entity_detection&.is_a?(Boolean) != false || raise("Passed value for field obj.entity_detection is not the expected type, validation failed.")
271
268
  obj.speech_threshold&.is_a?(Float) != false || raise("Passed value for field obj.speech_threshold is not the expected type, validation failed.")
272
269
  obj.summarization&.is_a?(Boolean) != false || raise("Passed value for field obj.summarization is not the expected type, validation failed.")
273
- obj.summary_model&.is_a?(Transcripts::SUMMARY_MODEL) != false || raise("Passed value for field obj.summary_model is not the expected type, validation failed.")
274
- obj.summary_type&.is_a?(Transcripts::SUMMARY_TYPE) != false || raise("Passed value for field obj.summary_type is not the expected type, validation failed.")
270
+ obj.summary_model&.is_a?(Transcripts::SummaryModel) != false || raise("Passed value for field obj.summary_model is not the expected type, validation failed.")
271
+ obj.summary_type&.is_a?(Transcripts::SummaryType) != false || raise("Passed value for field obj.summary_type is not the expected type, validation failed.")
275
272
  obj.custom_topics&.is_a?(Boolean) != false || raise("Passed value for field obj.custom_topics is not the expected type, validation failed.")
276
273
  obj.topics&.is_a?(Array) != false || raise("Passed value for field obj.topics is not the expected type, validation failed.")
277
274
  end
@@ -2,7 +2,12 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [TRANSCRIPT_STATUS]
6
- TRANSCRIPT_STATUS = { queued: "queued", processing: "processing", completed: "completed", error: "error" }.freeze
5
+ # The status of your transcript. Possible values are queued, processing, completed, or error.
6
+ class TranscriptStatus
7
+ QUEUED = "queued"
8
+ PROCESSING = "processing"
9
+ COMPLETED = "completed"
10
+ ERROR = "error"
11
+ end
7
12
  end
8
13
  end
data/lib/requests.rb CHANGED
@@ -20,7 +20,7 @@ module AssemblyAI
20
20
  @headers = {
21
21
  "X-Fern-Language": "Ruby",
22
22
  "X-Fern-SDK-Name": "AssemblyAI",
23
- "X-Fern-SDK-Version": "1.0.0-beta",
23
+ "X-Fern-SDK-Version": "1.0.0-beta.2",
24
24
  "Authorization": api_key.to_s
25
25
  }
26
26
  @conn = Faraday.new(@base_url, headers: @headers) do |faraday|
@@ -46,7 +46,7 @@ module AssemblyAI
46
46
  @headers = {
47
47
  "X-Fern-Language": "Ruby",
48
48
  "X-Fern-SDK-Name": "AssemblyAI",
49
- "X-Fern-SDK-Version": "1.0.0-beta",
49
+ "X-Fern-SDK-Version": "1.0.0-beta.2",
50
50
  "Authorization": api_key.to_s
51
51
  }
52
52
  @conn = Faraday.new(@base_url, headers: @headers) do |faraday|
@@ -84,4 +84,30 @@ module AssemblyAI
84
84
  @timeout_in_seconds = timeout_in_seconds
85
85
  end
86
86
  end
87
+
88
+ # Additional options for request-specific configuration when calling APIs via the SDK.
89
+ class IdempotencyRequestOptions
90
+ attr_reader :api_key, :additional_headers, :additional_query_parameters, :additional_body_parameters,
91
+ :timeout_in_seconds
92
+
93
+ # @param api_key [String]
94
+ # @param additional_headers [Hash{String => Object}]
95
+ # @param additional_query_parameters [Hash{String => Object}]
96
+ # @param additional_body_parameters [Hash{String => Object}]
97
+ # @param timeout_in_seconds [Long]
98
+ # @return [IdempotencyRequestOptions]
99
+ def initialize(api_key: nil, additional_headers: nil, additional_query_parameters: nil,
100
+ additional_body_parameters: nil, timeout_in_seconds: nil)
101
+ # @type [String]
102
+ @api_key = api_key
103
+ # @type [Hash{String => Object}]
104
+ @additional_headers = additional_headers
105
+ # @type [Hash{String => Object}]
106
+ @additional_query_parameters = additional_query_parameters
107
+ # @type [Hash{String => Object}]
108
+ @additional_body_parameters = additional_body_parameters
109
+ # @type [Long]
110
+ @timeout_in_seconds = timeout_in_seconds
111
+ end
112
+ end
87
113
  end
data/lib/types_export.rb CHANGED
@@ -46,18 +46,20 @@ require_relative "assemblyai/transcripts/types/transcript_list"
46
46
  require_relative "assemblyai/transcripts/types/audio_intelligence_model_status"
47
47
  require_relative "assemblyai/realtime/types/realtime_temporary_token_response"
48
48
  require_relative "assemblyai/realtime/types/realtime_base_message"
49
- require_relative "assemblyai/realtime/types/realtime_message"
49
+ require_relative "assemblyai/realtime/types/session_begins"
50
+ require_relative "assemblyai/realtime/types/partial_transcript"
51
+ require_relative "assemblyai/realtime/types/final_transcript"
52
+ require_relative "assemblyai/realtime/types/session_terminated"
50
53
  require_relative "assemblyai/realtime/types/realtime_error"
54
+ require_relative "assemblyai/realtime/types/realtime_message"
51
55
  require_relative "assemblyai/realtime/types/message_type"
52
56
  require_relative "assemblyai/realtime/types/realtime_transcript_type"
53
57
  require_relative "assemblyai/realtime/types/realtime_transcript"
54
- require_relative "assemblyai/realtime/types/session_begins"
55
- require_relative "assemblyai/realtime/types/session_terminated"
56
58
  require_relative "assemblyai/realtime/types/realtime_base_transcript"
57
- require_relative "assemblyai/realtime/types/partial_transcript"
58
- require_relative "assemblyai/realtime/types/final_transcript"
59
59
  require_relative "assemblyai/realtime/types/word"
60
60
  require_relative "assemblyai/realtime/types/audio_data"
61
+ require_relative "assemblyai/realtime/types/force_end_utterance"
62
+ require_relative "assemblyai/realtime/types/configure_end_utterance_silence_threshold"
61
63
  require_relative "assemblyai/realtime/types/terminate_session"
62
64
  require_relative "assemblyai/realtime/types/audio_encoding"
63
65
  require_relative "assemblyai/lemur/types/purge_lemur_request_data_response"