assemblyai 1.0.0.pre.beta → 1.0.0.pre.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) 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/list_by_url_client.rb +57 -0
  18. data/lib/assemblyai/transcripts/polling_client.rb +27 -25
  19. data/lib/assemblyai/transcripts/types/audio_intelligence_model_status.rb +5 -2
  20. data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +5 -5
  21. data/lib/assemblyai/transcripts/types/entity.rb +6 -11
  22. data/lib/assemblyai/transcripts/types/entity_type.rb +32 -32
  23. data/lib/assemblyai/transcripts/types/pii_policy.rb +29 -30
  24. data/lib/assemblyai/transcripts/types/polling_options.rb +14 -15
  25. data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +5 -2
  26. data/lib/assemblyai/transcripts/types/sentiment.rb +5 -2
  27. data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +6 -6
  28. data/lib/assemblyai/transcripts/types/speech_model.rb +4 -1
  29. data/lib/assemblyai/transcripts/types/substitution_policy.rb +5 -2
  30. data/lib/assemblyai/transcripts/types/subtitle_format.rb +5 -2
  31. data/lib/assemblyai/transcripts/types/summary_model.rb +6 -2
  32. data/lib/assemblyai/transcripts/types/summary_type.rb +8 -8
  33. data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +5 -9
  34. data/lib/assemblyai/transcripts/types/transcript.rb +26 -29
  35. data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +6 -2
  36. data/lib/assemblyai/transcripts/types/transcript_language_code.rb +24 -23
  37. data/lib/assemblyai/transcripts/types/transcript_list_item.rb +5 -5
  38. data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +36 -39
  39. data/lib/assemblyai/transcripts/types/transcript_ready_notification.rb +54 -0
  40. data/lib/assemblyai/transcripts/types/transcript_ready_status.rb +11 -0
  41. data/lib/assemblyai/transcripts/types/transcript_status.rb +7 -2
  42. data/lib/assemblyai.rb +1 -0
  43. data/lib/requests.rb +28 -2
  44. data/lib/types_export.rb +9 -5
  45. metadata +57 -14
@@ -1,21 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AssemblyAI
4
- class Transcripts
5
- # Configuration options for polling requests.
6
- class PollingOptions
7
- attr_reader :interval, :timeout
8
-
9
- # @param interval [Integer] The amount of time to wait between polling requests, in milliseconds. Defaults to 3000.
10
- # @param timeout [Integer] The maximum amount of time to wait for the transcript to be ready, in milliseconds. Defaults to -1, which means poll forever.
11
- # @return [Transcripts::PollingOptions]
12
- def initialize(interval: 3000, timeout: -1)
13
- # @type [Integer] The amount of time to wait between polling requests, in milliseconds.
14
- @interval = interval
15
- # @type [Integer] The maximum amount of time to wait for the transcript to be ready, in milliseconds.
16
- @timeout = timeout
17
- end
4
+ class Transcripts
5
+ # Configuration options for polling requests.
6
+ class PollingOptions
7
+ attr_reader :interval, :timeout
8
+
9
+ # @param interval [Integer] The amount of time to wait between polling requests, in milliseconds. Defaults to 3000.
10
+ # @param timeout [Integer] The maximum amount of time to wait for the transcript to be ready, in milliseconds. Defaults to -1, which means poll forever.
11
+ # @return [Transcripts::PollingOptions]
12
+ def initialize(interval: 3000, timeout: -1)
13
+ # @type [Integer] The amount of time to wait between polling requests, in milliseconds.
14
+ @interval = interval
15
+ # @type [Integer] The maximum amount of time to wait for the transcript to be ready, in milliseconds.
16
+ @timeout = timeout
18
17
  end
19
18
  end
20
19
  end
21
-
20
+ end
@@ -2,7 +2,10 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [REDACT_PII_AUDIO_QUALITY]
6
- REDACT_PII_AUDIO_QUALITY = { mp3: "mp3", wav: "wav" }.freeze
5
+ # 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.
6
+ class RedactPiiAudioQuality
7
+ MP3 = "mp3"
8
+ WAV = "wav"
9
+ end
7
10
  end
8
11
  end
@@ -2,7 +2,10 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [SENTIMENT]
6
- SENTIMENT = { positive: "POSITIVE", neutral: "NEUTRAL", negative: "NEGATIVE" }.freeze
5
+ class Sentiment
6
+ POSITIVE = "POSITIVE"
7
+ NEUTRAL = "NEUTRAL"
8
+ NEGATIVE = "NEGATIVE"
9
+ end
7
10
  end
8
11
  end
@@ -12,7 +12,7 @@ module AssemblyAI
12
12
  # @param text [String] The transcript of the sentence
13
13
  # @param start [Integer] The starting time, in milliseconds, of the sentence
14
14
  # @param end_ [Integer] The ending time, in milliseconds, of the sentence
15
- # @param sentiment [SENTIMENT] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
15
+ # @param sentiment [Transcripts::Sentiment] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
16
16
  # @param confidence [Float] The confidence score for the detected sentiment of the sentence, from 0 to 1
17
17
  # @param speaker [String] The speaker of the sentence if [Speaker Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, else null
18
18
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
@@ -24,7 +24,7 @@ module AssemblyAI
24
24
  @start = start
25
25
  # @type [Integer] The ending time, in milliseconds, of the sentence
26
26
  @end_ = end_
27
- # @type [SENTIMENT] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
27
+ # @type [Transcripts::Sentiment] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
28
28
  @sentiment = sentiment
29
29
  # @type [Float] The confidence score for the detected sentiment of the sentence, from 0 to 1
30
30
  @confidence = confidence
@@ -40,11 +40,11 @@ module AssemblyAI
40
40
  # @return [Transcripts::SentimentAnalysisResult]
41
41
  def self.from_json(json_object:)
42
42
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
- parsed_json = JSON.parse(json_object)
43
+ JSON.parse(json_object)
44
44
  text = struct.text
45
45
  start = struct.start
46
46
  end_ = struct.end
47
- sentiment = Transcripts::SENTIMENT.key(parsed_json["sentiment"]) || parsed_json["sentiment"]
47
+ sentiment = struct.sentiment
48
48
  confidence = struct.confidence
49
49
  speaker = struct.speaker
50
50
  new(text: text, start: start, end_: end_, sentiment: sentiment, confidence: confidence, speaker: speaker,
@@ -59,7 +59,7 @@ module AssemblyAI
59
59
  "text": @text,
60
60
  "start": @start,
61
61
  "end": @end_,
62
- "sentiment": Transcripts::SENTIMENT[@sentiment] || @sentiment,
62
+ "sentiment": @sentiment,
63
63
  "confidence": @confidence,
64
64
  "speaker": @speaker
65
65
  }.to_json
@@ -73,7 +73,7 @@ module AssemblyAI
73
73
  obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
74
74
  obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
75
75
  obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
76
- obj.sentiment.is_a?(Transcripts::SENTIMENT) != false || raise("Passed value for field obj.sentiment is not the expected type, validation failed.")
76
+ obj.sentiment.is_a?(Transcripts::Sentiment) != false || raise("Passed value for field obj.sentiment is not the expected type, validation failed.")
77
77
  obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
78
78
  obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
79
79
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- SPEECH_MODEL = String
5
+ # The speech model to use for the transcription.
6
+ class SpeechModel
7
+ NANO = "nano"
8
+ end
6
9
  end
7
10
  end
@@ -2,7 +2,10 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [SUBSTITUTION_POLICY]
6
- SUBSTITUTION_POLICY = { entity_type: "entity_type", hash: "hash" }.freeze
5
+ # 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.
6
+ class SubstitutionPolicy
7
+ ENTITY_TYPE = "entity_type"
8
+ HASH = "hash"
9
+ end
7
10
  end
8
11
  end
@@ -2,7 +2,10 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [SUBTITLE_FORMAT]
6
- SUBTITLE_FORMAT = { srt: "srt", vtt: "vtt" }.freeze
5
+ # Format of the subtitles
6
+ class SubtitleFormat
7
+ SRT = "srt"
8
+ VTT = "vtt"
9
+ end
7
10
  end
8
11
  end
@@ -2,7 +2,11 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [SUMMARY_MODEL]
6
- SUMMARY_MODEL = { informative: "informative", conversational: "conversational", catchy: "catchy" }.freeze
5
+ # The model to summarize the transcript
6
+ class SummaryModel
7
+ INFORMATIVE = "informative"
8
+ CONVERSATIONAL = "conversational"
9
+ CATCHY = "catchy"
10
+ end
7
11
  end
8
12
  end
@@ -2,13 +2,13 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [SUMMARY_TYPE]
6
- SUMMARY_TYPE = {
7
- bullets: "bullets",
8
- bullets_verbose: "bullets_verbose",
9
- gist: "gist",
10
- headline: "headline",
11
- paragraph: "paragraph"
12
- }.freeze
5
+ # The type of summary
6
+ class SummaryType
7
+ BULLETS = "bullets"
8
+ BULLETS_VERBOSE = "bullets_verbose"
9
+ GIST = "gist"
10
+ HEADLINE = "headline"
11
+ PARAGRAPH = "paragraph"
12
+ end
13
13
  end
14
14
  end
@@ -11,13 +11,13 @@ module AssemblyAI
11
11
  class TopicDetectionModelResult
12
12
  attr_reader :status, :results, :summary, :additional_properties
13
13
 
14
- # @param status [AUDIO_INTELLIGENCE_MODEL_STATUS] The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed.
14
+ # @param status [Transcripts::AudioIntelligenceModelStatus] The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed.
15
15
  # @param results [Array<Transcripts::TopicDetectionResult>] An array of results for the Topic Detection model
16
16
  # @param summary [Hash{String => String}] The overall relevance of topic to the entire audio file
17
17
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
18
18
  # @return [Transcripts::TopicDetectionModelResult]
19
19
  def initialize(status:, results:, summary:, additional_properties: nil)
20
- # @type [AUDIO_INTELLIGENCE_MODEL_STATUS] The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed.
20
+ # @type [Transcripts::AudioIntelligenceModelStatus] The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed.
21
21
  @status = status
22
22
  # @type [Array<Transcripts::TopicDetectionResult>] An array of results for the Topic Detection model
23
23
  @results = results
@@ -34,7 +34,7 @@ module AssemblyAI
34
34
  def self.from_json(json_object:)
35
35
  struct = JSON.parse(json_object, object_class: OpenStruct)
36
36
  parsed_json = JSON.parse(json_object)
37
- status = Transcripts::AUDIO_INTELLIGENCE_MODEL_STATUS.key(parsed_json["status"]) || parsed_json["status"]
37
+ status = struct.status
38
38
  results = parsed_json["results"]&.map do |v|
39
39
  v = v.to_json
40
40
  Transcripts::TopicDetectionResult.from_json(json_object: v)
@@ -47,11 +47,7 @@ module AssemblyAI
47
47
  #
48
48
  # @return [JSON]
49
49
  def to_json(*_args)
50
- {
51
- "status": Transcripts::AUDIO_INTELLIGENCE_MODEL_STATUS[@status] || @status,
52
- "results": @results,
53
- "summary": @summary
54
- }.to_json
50
+ { "status": @status, "results": @results, "summary": @summary }.to_json
55
51
  end
56
52
 
57
53
  # 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.
@@ -59,7 +55,7 @@ module AssemblyAI
59
55
  # @param obj [Object]
60
56
  # @return [Void]
61
57
  def self.validate_raw(obj:)
62
- obj.status.is_a?(Transcripts::AUDIO_INTELLIGENCE_MODEL_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
58
+ obj.status.is_a?(Transcripts::AudioIntelligenceModelStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
63
59
  obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
64
60
  obj.summary.is_a?(Hash) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.")
65
61
  end
@@ -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.")