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
@@ -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
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "transcript_ready_status"
4
+ require "json"
5
+
6
+ module AssemblyAI
7
+ class Transcripts
8
+ # The notification when the transcript status is completed or error.
9
+ class TranscriptReadyNotification
10
+ attr_reader :transcript_id, :status, :additional_properties
11
+
12
+ # @param transcript_id [String] The ID of the transcript
13
+ # @param status [Transcripts::TranscriptReadyStatus] The status of the transcript. Either completed or error.
14
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
+ # @return [Transcripts::TranscriptReadyNotification]
16
+ def initialize(transcript_id:, status:, additional_properties: nil)
17
+ # @type [String] The ID of the transcript
18
+ @transcript_id = transcript_id
19
+ # @type [Transcripts::TranscriptReadyStatus] The status of the transcript. Either completed or error.
20
+ @status = status
21
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
22
+ @additional_properties = additional_properties
23
+ end
24
+
25
+ # Deserialize a JSON object to an instance of TranscriptReadyNotification
26
+ #
27
+ # @param json_object [JSON]
28
+ # @return [Transcripts::TranscriptReadyNotification]
29
+ def self.from_json(json_object:)
30
+ struct = JSON.parse(json_object, object_class: OpenStruct)
31
+ JSON.parse(json_object)
32
+ transcript_id = struct.transcript_id
33
+ status = struct.status
34
+ new(transcript_id: transcript_id, status: status, additional_properties: struct)
35
+ end
36
+
37
+ # Serialize an instance of TranscriptReadyNotification to a JSON object
38
+ #
39
+ # @return [JSON]
40
+ def to_json(*_args)
41
+ { "transcript_id": @transcript_id, "status": @status }.to_json
42
+ end
43
+
44
+ # 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.
45
+ #
46
+ # @param obj [Object]
47
+ # @return [Void]
48
+ def self.validate_raw(obj:)
49
+ obj.transcript_id.is_a?(String) != false || raise("Passed value for field obj.transcript_id is not the expected type, validation failed.")
50
+ obj.status.is_a?(Transcripts::TranscriptReadyStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AssemblyAI
4
+ class Transcripts
5
+ # The status of the transcript. Either completed or error.
6
+ class TranscriptReadyStatus
7
+ COMPLETED = "completed"
8
+ ERROR = "error"
9
+ end
10
+ end
11
+ 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/assemblyai.rb CHANGED
@@ -6,6 +6,7 @@ require_relative "requests"
6
6
  require_relative "assemblyai/files/client"
7
7
  require_relative "assemblyai/transcripts/client"
8
8
  require_relative "assemblyai/transcripts/polling_client"
9
+ require_relative "assemblyai/transcripts/list_by_url_client"
9
10
  require_relative "assemblyai/realtime/client"
10
11
  require_relative "assemblyai/lemur/client"
11
12
 
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.3",
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.3",
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
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "assemblyai/files/types/uploaded_file"
4
+ require_relative "assemblyai/transcripts/types/transcript_ready_notification"
4
5
  require_relative "assemblyai/transcripts/types/redacted_audio_response"
5
6
  require_relative "assemblyai/transcripts/types/redacted_audio_status"
6
7
  require_relative "assemblyai/transcripts/types/subtitle_format"
@@ -20,6 +21,7 @@ require_relative "assemblyai/transcripts/types/pii_policy"
20
21
  require_relative "assemblyai/transcripts/types/speech_model"
21
22
  require_relative "assemblyai/transcripts/types/transcript_language_code"
22
23
  require_relative "assemblyai/transcripts/types/transcript_status"
24
+ require_relative "assemblyai/transcripts/types/transcript_ready_status"
23
25
  require_relative "assemblyai/transcripts/types/transcript"
24
26
  require_relative "assemblyai/transcripts/types/topic_detection_model_result"
25
27
  require_relative "assemblyai/transcripts/types/content_safety_labels_result"
@@ -46,18 +48,20 @@ require_relative "assemblyai/transcripts/types/transcript_list"
46
48
  require_relative "assemblyai/transcripts/types/audio_intelligence_model_status"
47
49
  require_relative "assemblyai/realtime/types/realtime_temporary_token_response"
48
50
  require_relative "assemblyai/realtime/types/realtime_base_message"
49
- require_relative "assemblyai/realtime/types/realtime_message"
51
+ require_relative "assemblyai/realtime/types/session_begins"
52
+ require_relative "assemblyai/realtime/types/partial_transcript"
53
+ require_relative "assemblyai/realtime/types/final_transcript"
54
+ require_relative "assemblyai/realtime/types/session_terminated"
50
55
  require_relative "assemblyai/realtime/types/realtime_error"
56
+ require_relative "assemblyai/realtime/types/realtime_message"
51
57
  require_relative "assemblyai/realtime/types/message_type"
52
58
  require_relative "assemblyai/realtime/types/realtime_transcript_type"
53
59
  require_relative "assemblyai/realtime/types/realtime_transcript"
54
- require_relative "assemblyai/realtime/types/session_begins"
55
- require_relative "assemblyai/realtime/types/session_terminated"
56
60
  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
61
  require_relative "assemblyai/realtime/types/word"
60
62
  require_relative "assemblyai/realtime/types/audio_data"
63
+ require_relative "assemblyai/realtime/types/force_end_utterance"
64
+ require_relative "assemblyai/realtime/types/configure_end_utterance_silence_threshold"
61
65
  require_relative "assemblyai/realtime/types/terminate_session"
62
66
  require_relative "assemblyai/realtime/types/audio_encoding"
63
67
  require_relative "assemblyai/lemur/types/purge_lemur_request_data_response"
metadata CHANGED
@@ -1,57 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assemblyai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta
4
+ version: 1.0.0.pre.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-09 00:00:00.000000000 Z
11
+ date: 2024-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http-faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.12'
19
+ version: '0.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0.0'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '0.12'
32
+ version: '1.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '1.10'
40
+ - - "<"
32
41
  - !ruby/object:Gem::Version
33
- version: '2.7'
42
+ version: '3.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '2.7'
49
+ version: '1.10'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3.0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: faraday-net_http
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '1.0'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '4.0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '1.0'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '4.0'
41
73
  - !ruby/object:Gem::Dependency
42
74
  name: faraday-retry
43
75
  requirement: !ruby/object:Gem::Requirement
44
76
  requirements:
45
- - - "~>"
77
+ - - ">="
46
78
  - !ruby/object:Gem::Version
47
- version: '2.2'
79
+ version: '1.0'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
48
83
  type: :runtime
49
84
  prerelease: false
50
85
  version_requirements: !ruby/object:Gem::Requirement
51
86
  requirements:
52
- - - "~>"
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ - - "<"
53
91
  - !ruby/object:Gem::Version
54
- version: '2.2'
92
+ version: '3.0'
55
93
  description: ''
56
94
  email: ''
57
95
  executables: []
@@ -77,7 +115,9 @@ files:
77
115
  - lib/assemblyai/realtime/client.rb
78
116
  - lib/assemblyai/realtime/types/audio_data.rb
79
117
  - lib/assemblyai/realtime/types/audio_encoding.rb
118
+ - lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb
80
119
  - lib/assemblyai/realtime/types/final_transcript.rb
120
+ - lib/assemblyai/realtime/types/force_end_utterance.rb
81
121
  - lib/assemblyai/realtime/types/message_type.rb
82
122
  - lib/assemblyai/realtime/types/partial_transcript.rb
83
123
  - lib/assemblyai/realtime/types/realtime_base_message.rb
@@ -92,6 +132,7 @@ files:
92
132
  - lib/assemblyai/realtime/types/terminate_session.rb
93
133
  - lib/assemblyai/realtime/types/word.rb
94
134
  - lib/assemblyai/transcripts/client.rb
135
+ - lib/assemblyai/transcripts/list_by_url_client.rb
95
136
  - lib/assemblyai/transcripts/polling_client.rb
96
137
  - lib/assemblyai/transcripts/types/audio_intelligence_model_status.rb
97
138
  - lib/assemblyai/transcripts/types/auto_highlight_result.rb
@@ -130,6 +171,8 @@ files:
130
171
  - lib/assemblyai/transcripts/types/transcript_list_item.rb
131
172
  - lib/assemblyai/transcripts/types/transcript_optional_params.rb
132
173
  - lib/assemblyai/transcripts/types/transcript_paragraph.rb
174
+ - lib/assemblyai/transcripts/types/transcript_ready_notification.rb
175
+ - lib/assemblyai/transcripts/types/transcript_ready_status.rb
133
176
  - lib/assemblyai/transcripts/types/transcript_sentence.rb
134
177
  - lib/assemblyai/transcripts/types/transcript_status.rb
135
178
  - lib/assemblyai/transcripts/types/transcript_utterance.rb