assemblyai 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assemblyai/transcripts/client.rb +341 -155
- data/lib/assemblyai/transcripts/polling_client.rb +6 -8
- data/lib/assemblyai/transcripts/types/transcript.rb +78 -56
- data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +1 -1
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +3 -3
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +44 -32
- data/lib/gemconfig.rb +1 -1
- metadata +2 -2
@@ -3,8 +3,8 @@
|
|
3
3
|
require_relative "../../requests"
|
4
4
|
require_relative "types/transcript_status"
|
5
5
|
require_relative "types/transcript_list"
|
6
|
-
require_relative "types/speech_model"
|
7
6
|
require_relative "types/transcript_language_code"
|
7
|
+
require_relative "types/speech_model"
|
8
8
|
require_relative "types/transcript_boost_param"
|
9
9
|
require_relative "types/redact_pii_audio_quality"
|
10
10
|
require_relative "types/pii_policy"
|
@@ -22,26 +22,34 @@ require "async"
|
|
22
22
|
|
23
23
|
module AssemblyAI
|
24
24
|
class TranscriptsClient
|
25
|
+
# @return [AssemblyAI::RequestClient]
|
25
26
|
attr_reader :request_client
|
26
27
|
|
27
|
-
# @param request_client [RequestClient]
|
28
|
-
# @return [TranscriptsClient]
|
28
|
+
# @param request_client [AssemblyAI::RequestClient]
|
29
|
+
# @return [AssemblyAI::TranscriptsClient]
|
29
30
|
def initialize(request_client:)
|
30
|
-
# @type [RequestClient]
|
31
31
|
@request_client = request_client
|
32
32
|
end
|
33
33
|
|
34
34
|
# Retrieve a list of transcripts you created.
|
35
|
-
#
|
35
|
+
# Transcripts are sorted from newest to oldest. The previous URL always points to
|
36
|
+
# a page with older transcripts.
|
36
37
|
#
|
37
|
-
# @param limit [
|
38
|
-
# @param status [Transcripts::TranscriptStatus] Filter by transcript status
|
38
|
+
# @param limit [Long] Maximum amount of transcripts to retrieve
|
39
|
+
# @param status [AssemblyAI::Transcripts::TranscriptStatus] Filter by transcript status
|
39
40
|
# @param created_on [String] Only get transcripts created on this date
|
40
41
|
# @param before_id [String] Get transcripts that were created before this transcript ID
|
41
42
|
# @param after_id [String] Get transcripts that were created after this transcript ID
|
42
43
|
# @param throttled_only [Boolean] Only get throttled transcripts, overrides the status filter
|
43
|
-
# @param request_options [RequestOptions]
|
44
|
-
# @return [Transcripts::TranscriptList]
|
44
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
45
|
+
# @return [AssemblyAI::Transcripts::TranscriptList]
|
46
|
+
# @example
|
47
|
+
# api = AssemblyAI::Client.new(
|
48
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
49
|
+
# base_url: "https://api.example.com",
|
50
|
+
# api_key: "YOUR_API_KEY"
|
51
|
+
# )
|
52
|
+
# api.transcripts.list
|
45
53
|
def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil, throttled_only: nil,
|
46
54
|
request_options: nil)
|
47
55
|
response = @request_client.conn.get do |req|
|
@@ -59,66 +67,111 @@ module AssemblyAI
|
|
59
67
|
}.compact
|
60
68
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
61
69
|
end
|
62
|
-
Transcripts::TranscriptList.from_json(json_object: response.body)
|
70
|
+
AssemblyAI::Transcripts::TranscriptList.from_json(json_object: response.body)
|
63
71
|
end
|
64
72
|
|
65
|
-
# Create a transcript from
|
73
|
+
# Create a transcript from a media file that is accessible via a URL.
|
66
74
|
#
|
67
|
-
# @param
|
68
|
-
# @param
|
75
|
+
# @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
76
|
+
# @param language_detection [Boolean] Enable [Automatic language
|
77
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
78
|
+
# either true or false.
|
79
|
+
# @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language.
|
80
|
+
# An error will be returned if the language confidence is below this threshold.
|
81
|
+
# Defaults to 0.
|
82
|
+
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
69
83
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
70
84
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
71
|
-
# @param
|
72
|
-
# @param
|
73
|
-
#
|
74
|
-
#
|
75
|
-
# @param
|
85
|
+
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
86
|
+
# @param dual_channel [Boolean] Enable [Dual
|
87
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
88
|
+
# transcription, can be true or false.
|
89
|
+
# @param webhook_url [String] The URL to which we send webhook requests. We sends two different types of
|
90
|
+
# webhook requests. One request when a transcript is completed or failed, and one
|
91
|
+
# request when the redacted audio is ready if redact_pii_audio is enabled.
|
92
|
+
# @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook
|
93
|
+
# requests
|
94
|
+
# @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook
|
95
|
+
# requests for added security
|
96
|
+
# @param auto_highlights [Boolean] Enable Key Phrases, either true or false
|
76
97
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
77
98
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
78
99
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
79
|
-
# @param boost_param [Transcripts::TranscriptBoostParam]
|
100
|
+
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
80
101
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
81
|
-
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
82
|
-
#
|
83
|
-
# @param
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
# @param
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
# @param
|
92
|
-
#
|
102
|
+
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
103
|
+
# false
|
104
|
+
# @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be
|
105
|
+
# true or false. See [PII
|
106
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
107
|
+
# details.
|
108
|
+
# @param redact_pii_audio_quality [AssemblyAI::Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently
|
109
|
+
# supports mp3 (default) and wav. See [PII
|
110
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
111
|
+
# details.
|
112
|
+
# @param redact_pii_policies [Array<AssemblyAI::Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII
|
113
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
114
|
+
# details.
|
115
|
+
# @param redact_pii_sub [AssemblyAI::Transcripts::SubstitutionPolicy]
|
116
|
+
# @param speaker_labels [Boolean] Enable [Speaker
|
117
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be
|
118
|
+
# true or false
|
119
|
+
# @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify,
|
120
|
+
# up to 10. See [Speaker
|
121
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for
|
122
|
+
# more details.
|
123
|
+
# @param content_safety [Boolean] Enable [Content
|
124
|
+
# Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be
|
125
|
+
# true or false
|
126
|
+
# @param content_safety_confidence [Integer] The confidence threshold for the Content Moderation model. Values must be
|
127
|
+
# between 25 and 100.
|
128
|
+
# @param iab_categories [Boolean] Enable [Topic
|
129
|
+
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
130
|
+
# or false
|
131
|
+
# @param custom_spelling [Array<Hash>] Customize how words are spelled and formatted using to and from valuesRequest of type Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>, as a Hash
|
93
132
|
# * :from (Array<String>)
|
94
133
|
# * :to (String)
|
95
|
-
# @param
|
96
|
-
#
|
97
|
-
#
|
98
|
-
# @param
|
134
|
+
# @param sentiment_analysis [Boolean] Enable [Sentiment
|
135
|
+
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
136
|
+
# true or false
|
137
|
+
# @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters),
|
138
|
+
# can be true or false
|
139
|
+
# @param entity_detection [Boolean] Enable [Entity
|
140
|
+
# Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true
|
141
|
+
# or false
|
99
142
|
# @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
|
100
|
-
#
|
101
|
-
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
102
|
-
#
|
103
|
-
# @param
|
104
|
-
# @param
|
105
|
-
# @param
|
106
|
-
# @param
|
143
|
+
# Valid values are in the range [0, 1] inclusive.
|
144
|
+
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
145
|
+
# can be true or false
|
146
|
+
# @param summary_model [AssemblyAI::Transcripts::SummaryModel] The model to summarize the transcript
|
147
|
+
# @param summary_type [AssemblyAI::Transcripts::SummaryType] The type of summary
|
148
|
+
# @param custom_topics [Boolean] Enable custom topics, either true or false
|
149
|
+
# @param topics [Array<String>] The list of custom topics
|
107
150
|
# @param audio_url [String] The URL of the audio or video file to transcribe.
|
108
|
-
# @param request_options [RequestOptions]
|
109
|
-
# @return [Transcripts::Transcript]
|
110
|
-
|
111
|
-
|
151
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
152
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
153
|
+
# @example
|
154
|
+
# api = AssemblyAI::Client.new(
|
155
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
156
|
+
# base_url: "https://api.example.com",
|
157
|
+
# api_key: "YOUR_API_KEY"
|
158
|
+
# )
|
159
|
+
# api.transcripts.submit(audio_url: "https://github.com/AssemblyAI-Examples/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3")
|
160
|
+
def submit(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil,
|
161
|
+
punctuate: nil, format_text: nil, disfluencies: nil, dual_channel: nil, 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, custom_spelling: 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, request_options: nil)
|
112
162
|
response = @request_client.conn.post do |req|
|
113
163
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
114
164
|
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
|
115
165
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
116
166
|
req.body = {
|
117
167
|
**(request_options&.additional_body_parameters || {}),
|
118
|
-
speech_model: speech_model,
|
119
168
|
language_code: language_code,
|
169
|
+
language_detection: language_detection,
|
170
|
+
language_confidence_threshold: language_confidence_threshold,
|
171
|
+
speech_model: speech_model,
|
120
172
|
punctuate: punctuate,
|
121
173
|
format_text: format_text,
|
174
|
+
disfluencies: disfluencies,
|
122
175
|
dual_channel: dual_channel,
|
123
176
|
webhook_url: webhook_url,
|
124
177
|
webhook_auth_header_name: webhook_auth_header_name,
|
@@ -139,9 +192,7 @@ module AssemblyAI
|
|
139
192
|
content_safety: content_safety,
|
140
193
|
content_safety_confidence: content_safety_confidence,
|
141
194
|
iab_categories: iab_categories,
|
142
|
-
language_detection: language_detection,
|
143
195
|
custom_spelling: custom_spelling,
|
144
|
-
disfluencies: disfluencies,
|
145
196
|
sentiment_analysis: sentiment_analysis,
|
146
197
|
auto_chapters: auto_chapters,
|
147
198
|
entity_detection: entity_detection,
|
@@ -151,19 +202,26 @@ module AssemblyAI
|
|
151
202
|
summary_type: summary_type,
|
152
203
|
custom_topics: custom_topics,
|
153
204
|
topics: topics,
|
154
|
-
additional_properties: additional_properties,
|
155
205
|
audio_url: audio_url
|
156
206
|
}.compact
|
157
207
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
158
208
|
end
|
159
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
209
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
160
210
|
end
|
161
211
|
|
162
|
-
# Get the transcript resource. The transcript is ready when the "status" is
|
212
|
+
# Get the transcript resource. The transcript is ready when the "status" is
|
213
|
+
# "completed".
|
163
214
|
#
|
164
215
|
# @param transcript_id [String] ID of the transcript
|
165
|
-
# @param request_options [RequestOptions]
|
166
|
-
# @return [Transcripts::Transcript]
|
216
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
217
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
218
|
+
# @example
|
219
|
+
# api = AssemblyAI::Client.new(
|
220
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
221
|
+
# base_url: "https://api.example.com",
|
222
|
+
# api_key: "YOUR_API_KEY"
|
223
|
+
# )
|
224
|
+
# api.transcripts.get(transcript_id: "transcript_id")
|
167
225
|
def get(transcript_id:, request_options: nil)
|
168
226
|
response = @request_client.conn.get do |req|
|
169
227
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -171,14 +229,21 @@ module AssemblyAI
|
|
171
229
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
172
230
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
173
231
|
end
|
174
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
232
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
175
233
|
end
|
176
234
|
|
177
|
-
#
|
235
|
+
# Remove the data from the transcript and mark it as deleted.
|
178
236
|
#
|
179
237
|
# @param transcript_id [String] ID of the transcript
|
180
|
-
# @param request_options [RequestOptions]
|
181
|
-
# @return [Transcripts::Transcript]
|
238
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
239
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
240
|
+
# @example
|
241
|
+
# api = AssemblyAI::Client.new(
|
242
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
243
|
+
# base_url: "https://api.example.com",
|
244
|
+
# api_key: "YOUR_API_KEY"
|
245
|
+
# )
|
246
|
+
# api.transcripts.delete(transcript_id: "{transcript_id}")
|
182
247
|
def delete(transcript_id:, request_options: nil)
|
183
248
|
response = @request_client.conn.delete do |req|
|
184
249
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -186,15 +251,16 @@ module AssemblyAI
|
|
186
251
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
187
252
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
188
253
|
end
|
189
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
254
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
190
255
|
end
|
191
256
|
|
192
|
-
# Export your transcript in SRT or VTT format
|
257
|
+
# Export your transcript in SRT or VTT format to use with a video player for
|
258
|
+
# subtitles and closed captions.
|
193
259
|
#
|
194
260
|
# @param transcript_id [String] ID of the transcript
|
195
|
-
# @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
|
261
|
+
# @param subtitle_format [AssemblyAI::Transcripts::SubtitleFormat] The format of the captions
|
196
262
|
# @param chars_per_caption [Integer] The maximum number of characters per caption
|
197
|
-
# @param request_options [RequestOptions]
|
263
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
198
264
|
# @return [String]
|
199
265
|
def get_subtitles(transcript_id:, subtitle_format:, chars_per_caption: nil, request_options: nil)
|
200
266
|
response = @request_client.conn.get do |req|
|
@@ -210,11 +276,20 @@ module AssemblyAI
|
|
210
276
|
response.body
|
211
277
|
end
|
212
278
|
|
213
|
-
# Get the transcript split by sentences. The API will attempt to semantically
|
279
|
+
# Get the transcript split by sentences. The API will attempt to semantically
|
280
|
+
# segment the transcript into sentences to create more reader-friendly
|
281
|
+
# transcripts.
|
214
282
|
#
|
215
283
|
# @param transcript_id [String] ID of the transcript
|
216
|
-
# @param request_options [RequestOptions]
|
217
|
-
# @return [Transcripts::SentencesResponse]
|
284
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
285
|
+
# @return [AssemblyAI::Transcripts::SentencesResponse]
|
286
|
+
# @example
|
287
|
+
# api = AssemblyAI::Client.new(
|
288
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
289
|
+
# base_url: "https://api.example.com",
|
290
|
+
# api_key: "YOUR_API_KEY"
|
291
|
+
# )
|
292
|
+
# api.transcripts.get_sentences(transcript_id: "transcript_id")
|
218
293
|
def get_sentences(transcript_id:, request_options: nil)
|
219
294
|
response = @request_client.conn.get do |req|
|
220
295
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -222,14 +297,23 @@ module AssemblyAI
|
|
222
297
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
223
298
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/sentences"
|
224
299
|
end
|
225
|
-
Transcripts::SentencesResponse.from_json(json_object: response.body)
|
300
|
+
AssemblyAI::Transcripts::SentencesResponse.from_json(json_object: response.body)
|
226
301
|
end
|
227
302
|
|
228
|
-
# Get the transcript split by paragraphs. The API will attempt to semantically
|
303
|
+
# Get the transcript split by paragraphs. The API will attempt to semantically
|
304
|
+
# segment your transcript into paragraphs to create more reader-friendly
|
305
|
+
# transcripts.
|
229
306
|
#
|
230
307
|
# @param transcript_id [String] ID of the transcript
|
231
|
-
# @param request_options [RequestOptions]
|
232
|
-
# @return [Transcripts::ParagraphsResponse]
|
308
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
309
|
+
# @return [AssemblyAI::Transcripts::ParagraphsResponse]
|
310
|
+
# @example
|
311
|
+
# api = AssemblyAI::Client.new(
|
312
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
313
|
+
# base_url: "https://api.example.com",
|
314
|
+
# api_key: "YOUR_API_KEY"
|
315
|
+
# )
|
316
|
+
# api.transcripts.get_paragraphs(transcript_id: "transcript_id")
|
233
317
|
def get_paragraphs(transcript_id:, request_options: nil)
|
234
318
|
response = @request_client.conn.get do |req|
|
235
319
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -237,15 +321,16 @@ module AssemblyAI
|
|
237
321
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
238
322
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/paragraphs"
|
239
323
|
end
|
240
|
-
Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
324
|
+
AssemblyAI::Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
241
325
|
end
|
242
326
|
|
243
|
-
# Search through the transcript for
|
327
|
+
# Search through the transcript for keywords. You can search for individual words,
|
328
|
+
# numbers, or phrases containing up to five words or numbers.
|
244
329
|
#
|
245
330
|
# @param transcript_id [String] ID of the transcript
|
246
331
|
# @param words [String] Keywords to search for
|
247
|
-
# @param request_options [RequestOptions]
|
248
|
-
# @return [Transcripts::WordSearchResponse]
|
332
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
333
|
+
# @return [AssemblyAI::Transcripts::WordSearchResponse]
|
249
334
|
def word_search(transcript_id:, words: nil, request_options: nil)
|
250
335
|
response = @request_client.conn.get do |req|
|
251
336
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -254,14 +339,22 @@ module AssemblyAI
|
|
254
339
|
req.params = { **(request_options&.additional_query_parameters || {}), "words": words }.compact
|
255
340
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/word-search"
|
256
341
|
end
|
257
|
-
Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
342
|
+
AssemblyAI::Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
258
343
|
end
|
259
344
|
|
260
|
-
# Retrieve the redacted audio object containing the status and URL to the redacted
|
345
|
+
# Retrieve the redacted audio object containing the status and URL to the redacted
|
346
|
+
# audio.
|
261
347
|
#
|
262
348
|
# @param transcript_id [String] ID of the transcript
|
263
|
-
# @param request_options [RequestOptions]
|
264
|
-
# @return [Transcripts::RedactedAudioResponse]
|
349
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
350
|
+
# @return [AssemblyAI::Transcripts::RedactedAudioResponse]
|
351
|
+
# @example
|
352
|
+
# api = AssemblyAI::Client.new(
|
353
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
354
|
+
# base_url: "https://api.example.com",
|
355
|
+
# api_key: "YOUR_API_KEY"
|
356
|
+
# )
|
357
|
+
# api.transcripts.get_redacted_audio(transcript_id: "transcript_id")
|
265
358
|
def get_redacted_audio(transcript_id:, request_options: nil)
|
266
359
|
response = @request_client.conn.get do |req|
|
267
360
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -269,31 +362,39 @@ module AssemblyAI
|
|
269
362
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
270
363
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/redacted-audio"
|
271
364
|
end
|
272
|
-
Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
365
|
+
AssemblyAI::Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
273
366
|
end
|
274
367
|
end
|
275
368
|
|
276
369
|
class AsyncTranscriptsClient
|
370
|
+
# @return [AssemblyAI::AsyncRequestClient]
|
277
371
|
attr_reader :request_client
|
278
372
|
|
279
|
-
# @param request_client [AsyncRequestClient]
|
280
|
-
# @return [AsyncTranscriptsClient]
|
373
|
+
# @param request_client [AssemblyAI::AsyncRequestClient]
|
374
|
+
# @return [AssemblyAI::AsyncTranscriptsClient]
|
281
375
|
def initialize(request_client:)
|
282
|
-
# @type [AsyncRequestClient]
|
283
376
|
@request_client = request_client
|
284
377
|
end
|
285
378
|
|
286
379
|
# Retrieve a list of transcripts you created.
|
287
|
-
#
|
380
|
+
# Transcripts are sorted from newest to oldest. The previous URL always points to
|
381
|
+
# a page with older transcripts.
|
288
382
|
#
|
289
|
-
# @param limit [
|
290
|
-
# @param status [Transcripts::TranscriptStatus] Filter by transcript status
|
383
|
+
# @param limit [Long] Maximum amount of transcripts to retrieve
|
384
|
+
# @param status [AssemblyAI::Transcripts::TranscriptStatus] Filter by transcript status
|
291
385
|
# @param created_on [String] Only get transcripts created on this date
|
292
386
|
# @param before_id [String] Get transcripts that were created before this transcript ID
|
293
387
|
# @param after_id [String] Get transcripts that were created after this transcript ID
|
294
388
|
# @param throttled_only [Boolean] Only get throttled transcripts, overrides the status filter
|
295
|
-
# @param request_options [RequestOptions]
|
296
|
-
# @return [Transcripts::TranscriptList]
|
389
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
390
|
+
# @return [AssemblyAI::Transcripts::TranscriptList]
|
391
|
+
# @example
|
392
|
+
# api = AssemblyAI::Client.new(
|
393
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
394
|
+
# base_url: "https://api.example.com",
|
395
|
+
# api_key: "YOUR_API_KEY"
|
396
|
+
# )
|
397
|
+
# api.transcripts.list
|
297
398
|
def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil, throttled_only: nil,
|
298
399
|
request_options: nil)
|
299
400
|
Async do
|
@@ -312,57 +413,99 @@ module AssemblyAI
|
|
312
413
|
}.compact
|
313
414
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
314
415
|
end
|
315
|
-
Transcripts::TranscriptList.from_json(json_object: response.body)
|
416
|
+
AssemblyAI::Transcripts::TranscriptList.from_json(json_object: response.body)
|
316
417
|
end
|
317
418
|
end
|
318
419
|
|
319
|
-
# Create a transcript from
|
420
|
+
# Create a transcript from a media file that is accessible via a URL.
|
320
421
|
#
|
321
|
-
# @param
|
322
|
-
# @param
|
422
|
+
# @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode]
|
423
|
+
# @param language_detection [Boolean] Enable [Automatic language
|
424
|
+
# www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection),
|
425
|
+
# either true or false.
|
426
|
+
# @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language.
|
427
|
+
# An error will be returned if the language confidence is below this threshold.
|
428
|
+
# Defaults to 0.
|
429
|
+
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
323
430
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
324
431
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
325
|
-
# @param
|
326
|
-
# @param
|
327
|
-
#
|
328
|
-
#
|
329
|
-
# @param
|
432
|
+
# @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false
|
433
|
+
# @param dual_channel [Boolean] Enable [Dual
|
434
|
+
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
435
|
+
# transcription, can be true or false.
|
436
|
+
# @param webhook_url [String] The URL to which we send webhook requests. We sends two different types of
|
437
|
+
# webhook requests. One request when a transcript is completed or failed, and one
|
438
|
+
# request when the redacted audio is ready if redact_pii_audio is enabled.
|
439
|
+
# @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook
|
440
|
+
# requests
|
441
|
+
# @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook
|
442
|
+
# requests for added security
|
443
|
+
# @param auto_highlights [Boolean] Enable Key Phrases, either true or false
|
330
444
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
331
445
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
332
446
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
333
|
-
# @param boost_param [Transcripts::TranscriptBoostParam]
|
447
|
+
# @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words
|
334
448
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
335
|
-
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
336
|
-
#
|
337
|
-
# @param
|
338
|
-
#
|
339
|
-
#
|
340
|
-
#
|
341
|
-
# @param
|
342
|
-
#
|
343
|
-
#
|
344
|
-
#
|
345
|
-
# @param
|
346
|
-
#
|
449
|
+
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or
|
450
|
+
# false
|
451
|
+
# @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be
|
452
|
+
# true or false. See [PII
|
453
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
454
|
+
# details.
|
455
|
+
# @param redact_pii_audio_quality [AssemblyAI::Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently
|
456
|
+
# supports mp3 (default) and wav. See [PII
|
457
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
458
|
+
# details.
|
459
|
+
# @param redact_pii_policies [Array<AssemblyAI::Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII
|
460
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
461
|
+
# details.
|
462
|
+
# @param redact_pii_sub [AssemblyAI::Transcripts::SubstitutionPolicy]
|
463
|
+
# @param speaker_labels [Boolean] Enable [Speaker
|
464
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be
|
465
|
+
# true or false
|
466
|
+
# @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify,
|
467
|
+
# up to 10. See [Speaker
|
468
|
+
# diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for
|
469
|
+
# more details.
|
470
|
+
# @param content_safety [Boolean] Enable [Content
|
471
|
+
# Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be
|
472
|
+
# true or false
|
473
|
+
# @param content_safety_confidence [Integer] The confidence threshold for the Content Moderation model. Values must be
|
474
|
+
# between 25 and 100.
|
475
|
+
# @param iab_categories [Boolean] Enable [Topic
|
476
|
+
# Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true
|
477
|
+
# or false
|
478
|
+
# @param custom_spelling [Array<Hash>] Customize how words are spelled and formatted using to and from valuesRequest of type Array<AssemblyAI::Transcripts::TranscriptCustomSpelling>, as a Hash
|
347
479
|
# * :from (Array<String>)
|
348
480
|
# * :to (String)
|
349
|
-
# @param
|
350
|
-
#
|
351
|
-
#
|
352
|
-
# @param
|
481
|
+
# @param sentiment_analysis [Boolean] Enable [Sentiment
|
482
|
+
# Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be
|
483
|
+
# true or false
|
484
|
+
# @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters),
|
485
|
+
# can be true or false
|
486
|
+
# @param entity_detection [Boolean] Enable [Entity
|
487
|
+
# Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true
|
488
|
+
# or false
|
353
489
|
# @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
|
354
|
-
#
|
355
|
-
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
356
|
-
#
|
357
|
-
# @param
|
358
|
-
# @param
|
359
|
-
# @param
|
360
|
-
# @param
|
490
|
+
# Valid values are in the range [0, 1] inclusive.
|
491
|
+
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization),
|
492
|
+
# can be true or false
|
493
|
+
# @param summary_model [AssemblyAI::Transcripts::SummaryModel] The model to summarize the transcript
|
494
|
+
# @param summary_type [AssemblyAI::Transcripts::SummaryType] The type of summary
|
495
|
+
# @param custom_topics [Boolean] Enable custom topics, either true or false
|
496
|
+
# @param topics [Array<String>] The list of custom topics
|
361
497
|
# @param audio_url [String] The URL of the audio or video file to transcribe.
|
362
|
-
# @param request_options [RequestOptions]
|
363
|
-
# @return [Transcripts::Transcript]
|
364
|
-
|
365
|
-
|
498
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
499
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
500
|
+
# @example
|
501
|
+
# api = AssemblyAI::Client.new(
|
502
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
503
|
+
# base_url: "https://api.example.com",
|
504
|
+
# api_key: "YOUR_API_KEY"
|
505
|
+
# )
|
506
|
+
# api.transcripts.submit(audio_url: "https://github.com/AssemblyAI-Examples/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3")
|
507
|
+
def submit(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil,
|
508
|
+
punctuate: nil, format_text: nil, disfluencies: nil, dual_channel: nil, 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, custom_spelling: 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, request_options: nil)
|
366
509
|
Async do
|
367
510
|
response = @request_client.conn.post do |req|
|
368
511
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -370,10 +513,13 @@ module AssemblyAI
|
|
370
513
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
371
514
|
req.body = {
|
372
515
|
**(request_options&.additional_body_parameters || {}),
|
373
|
-
speech_model: speech_model,
|
374
516
|
language_code: language_code,
|
517
|
+
language_detection: language_detection,
|
518
|
+
language_confidence_threshold: language_confidence_threshold,
|
519
|
+
speech_model: speech_model,
|
375
520
|
punctuate: punctuate,
|
376
521
|
format_text: format_text,
|
522
|
+
disfluencies: disfluencies,
|
377
523
|
dual_channel: dual_channel,
|
378
524
|
webhook_url: webhook_url,
|
379
525
|
webhook_auth_header_name: webhook_auth_header_name,
|
@@ -394,9 +540,7 @@ module AssemblyAI
|
|
394
540
|
content_safety: content_safety,
|
395
541
|
content_safety_confidence: content_safety_confidence,
|
396
542
|
iab_categories: iab_categories,
|
397
|
-
language_detection: language_detection,
|
398
543
|
custom_spelling: custom_spelling,
|
399
|
-
disfluencies: disfluencies,
|
400
544
|
sentiment_analysis: sentiment_analysis,
|
401
545
|
auto_chapters: auto_chapters,
|
402
546
|
entity_detection: entity_detection,
|
@@ -406,20 +550,27 @@ module AssemblyAI
|
|
406
550
|
summary_type: summary_type,
|
407
551
|
custom_topics: custom_topics,
|
408
552
|
topics: topics,
|
409
|
-
additional_properties: additional_properties,
|
410
553
|
audio_url: audio_url
|
411
554
|
}.compact
|
412
555
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript"
|
413
556
|
end
|
414
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
557
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
415
558
|
end
|
416
559
|
end
|
417
560
|
|
418
|
-
# Get the transcript resource. The transcript is ready when the "status" is
|
561
|
+
# Get the transcript resource. The transcript is ready when the "status" is
|
562
|
+
# "completed".
|
419
563
|
#
|
420
564
|
# @param transcript_id [String] ID of the transcript
|
421
|
-
# @param request_options [RequestOptions]
|
422
|
-
# @return [Transcripts::Transcript]
|
565
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
566
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
567
|
+
# @example
|
568
|
+
# api = AssemblyAI::Client.new(
|
569
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
570
|
+
# base_url: "https://api.example.com",
|
571
|
+
# api_key: "YOUR_API_KEY"
|
572
|
+
# )
|
573
|
+
# api.transcripts.get(transcript_id: "transcript_id")
|
423
574
|
def get(transcript_id:, request_options: nil)
|
424
575
|
Async do
|
425
576
|
response = @request_client.conn.get do |req|
|
@@ -428,15 +579,22 @@ module AssemblyAI
|
|
428
579
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
429
580
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
430
581
|
end
|
431
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
582
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
432
583
|
end
|
433
584
|
end
|
434
585
|
|
435
|
-
#
|
586
|
+
# Remove the data from the transcript and mark it as deleted.
|
436
587
|
#
|
437
588
|
# @param transcript_id [String] ID of the transcript
|
438
|
-
# @param request_options [RequestOptions]
|
439
|
-
# @return [Transcripts::Transcript]
|
589
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
590
|
+
# @return [AssemblyAI::Transcripts::Transcript]
|
591
|
+
# @example
|
592
|
+
# api = AssemblyAI::Client.new(
|
593
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
594
|
+
# base_url: "https://api.example.com",
|
595
|
+
# api_key: "YOUR_API_KEY"
|
596
|
+
# )
|
597
|
+
# api.transcripts.delete(transcript_id: "{transcript_id}")
|
440
598
|
def delete(transcript_id:, request_options: nil)
|
441
599
|
Async do
|
442
600
|
response = @request_client.conn.delete do |req|
|
@@ -445,16 +603,17 @@ module AssemblyAI
|
|
445
603
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
446
604
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}"
|
447
605
|
end
|
448
|
-
Transcripts::Transcript.from_json(json_object: response.body)
|
606
|
+
AssemblyAI::Transcripts::Transcript.from_json(json_object: response.body)
|
449
607
|
end
|
450
608
|
end
|
451
609
|
|
452
|
-
# Export your transcript in SRT or VTT format
|
610
|
+
# Export your transcript in SRT or VTT format to use with a video player for
|
611
|
+
# subtitles and closed captions.
|
453
612
|
#
|
454
613
|
# @param transcript_id [String] ID of the transcript
|
455
|
-
# @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
|
614
|
+
# @param subtitle_format [AssemblyAI::Transcripts::SubtitleFormat] The format of the captions
|
456
615
|
# @param chars_per_caption [Integer] The maximum number of characters per caption
|
457
|
-
# @param request_options [RequestOptions]
|
616
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
458
617
|
# @return [String]
|
459
618
|
def get_subtitles(transcript_id:, subtitle_format:, chars_per_caption: nil, request_options: nil)
|
460
619
|
Async do
|
@@ -472,11 +631,20 @@ module AssemblyAI
|
|
472
631
|
end
|
473
632
|
end
|
474
633
|
|
475
|
-
# Get the transcript split by sentences. The API will attempt to semantically
|
634
|
+
# Get the transcript split by sentences. The API will attempt to semantically
|
635
|
+
# segment the transcript into sentences to create more reader-friendly
|
636
|
+
# transcripts.
|
476
637
|
#
|
477
638
|
# @param transcript_id [String] ID of the transcript
|
478
|
-
# @param request_options [RequestOptions]
|
479
|
-
# @return [Transcripts::SentencesResponse]
|
639
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
640
|
+
# @return [AssemblyAI::Transcripts::SentencesResponse]
|
641
|
+
# @example
|
642
|
+
# api = AssemblyAI::Client.new(
|
643
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
644
|
+
# base_url: "https://api.example.com",
|
645
|
+
# api_key: "YOUR_API_KEY"
|
646
|
+
# )
|
647
|
+
# api.transcripts.get_sentences(transcript_id: "transcript_id")
|
480
648
|
def get_sentences(transcript_id:, request_options: nil)
|
481
649
|
Async do
|
482
650
|
response = @request_client.conn.get do |req|
|
@@ -485,15 +653,24 @@ module AssemblyAI
|
|
485
653
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
486
654
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/sentences"
|
487
655
|
end
|
488
|
-
Transcripts::SentencesResponse.from_json(json_object: response.body)
|
656
|
+
AssemblyAI::Transcripts::SentencesResponse.from_json(json_object: response.body)
|
489
657
|
end
|
490
658
|
end
|
491
659
|
|
492
|
-
# Get the transcript split by paragraphs. The API will attempt to semantically
|
660
|
+
# Get the transcript split by paragraphs. The API will attempt to semantically
|
661
|
+
# segment your transcript into paragraphs to create more reader-friendly
|
662
|
+
# transcripts.
|
493
663
|
#
|
494
664
|
# @param transcript_id [String] ID of the transcript
|
495
|
-
# @param request_options [RequestOptions]
|
496
|
-
# @return [Transcripts::ParagraphsResponse]
|
665
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
666
|
+
# @return [AssemblyAI::Transcripts::ParagraphsResponse]
|
667
|
+
# @example
|
668
|
+
# api = AssemblyAI::Client.new(
|
669
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
670
|
+
# base_url: "https://api.example.com",
|
671
|
+
# api_key: "YOUR_API_KEY"
|
672
|
+
# )
|
673
|
+
# api.transcripts.get_paragraphs(transcript_id: "transcript_id")
|
497
674
|
def get_paragraphs(transcript_id:, request_options: nil)
|
498
675
|
Async do
|
499
676
|
response = @request_client.conn.get do |req|
|
@@ -502,16 +679,17 @@ module AssemblyAI
|
|
502
679
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
503
680
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/paragraphs"
|
504
681
|
end
|
505
|
-
Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
682
|
+
AssemblyAI::Transcripts::ParagraphsResponse.from_json(json_object: response.body)
|
506
683
|
end
|
507
684
|
end
|
508
685
|
|
509
|
-
# Search through the transcript for
|
686
|
+
# Search through the transcript for keywords. You can search for individual words,
|
687
|
+
# numbers, or phrases containing up to five words or numbers.
|
510
688
|
#
|
511
689
|
# @param transcript_id [String] ID of the transcript
|
512
690
|
# @param words [String] Keywords to search for
|
513
|
-
# @param request_options [RequestOptions]
|
514
|
-
# @return [Transcripts::WordSearchResponse]
|
691
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
692
|
+
# @return [AssemblyAI::Transcripts::WordSearchResponse]
|
515
693
|
def word_search(transcript_id:, words: nil, request_options: nil)
|
516
694
|
Async do
|
517
695
|
response = @request_client.conn.get do |req|
|
@@ -521,15 +699,23 @@ module AssemblyAI
|
|
521
699
|
req.params = { **(request_options&.additional_query_parameters || {}), "words": words }.compact
|
522
700
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/word-search"
|
523
701
|
end
|
524
|
-
Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
702
|
+
AssemblyAI::Transcripts::WordSearchResponse.from_json(json_object: response.body)
|
525
703
|
end
|
526
704
|
end
|
527
705
|
|
528
|
-
# Retrieve the redacted audio object containing the status and URL to the redacted
|
706
|
+
# Retrieve the redacted audio object containing the status and URL to the redacted
|
707
|
+
# audio.
|
529
708
|
#
|
530
709
|
# @param transcript_id [String] ID of the transcript
|
531
|
-
# @param request_options [RequestOptions]
|
532
|
-
# @return [Transcripts::RedactedAudioResponse]
|
710
|
+
# @param request_options [AssemblyAI::RequestOptions]
|
711
|
+
# @return [AssemblyAI::Transcripts::RedactedAudioResponse]
|
712
|
+
# @example
|
713
|
+
# api = AssemblyAI::Client.new(
|
714
|
+
# environment: AssemblyAI::Environment::DEFAULT,
|
715
|
+
# base_url: "https://api.example.com",
|
716
|
+
# api_key: "YOUR_API_KEY"
|
717
|
+
# )
|
718
|
+
# api.transcripts.get_redacted_audio(transcript_id: "transcript_id")
|
533
719
|
def get_redacted_audio(transcript_id:, request_options: nil)
|
534
720
|
Async do
|
535
721
|
response = @request_client.conn.get do |req|
|
@@ -538,7 +724,7 @@ module AssemblyAI
|
|
538
724
|
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
|
539
725
|
req.url "#{@request_client.get_url(request_options: request_options)}/v2/transcript/#{transcript_id}/redacted-audio"
|
540
726
|
end
|
541
|
-
Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
727
|
+
AssemblyAI::Transcripts::RedactedAudioResponse.from_json(json_object: response.body)
|
542
728
|
end
|
543
729
|
end
|
544
730
|
end
|