assemblyai 1.0.0.pre.beta → 1.0.0.pre.beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/assemblyai/lemur/client.rb +16 -16
- data/lib/assemblyai/lemur/types/lemur_base_params.rb +5 -5
- data/lib/assemblyai/lemur/types/lemur_base_params_context.rb +3 -29
- data/lib/assemblyai/lemur/types/lemur_model.rb +7 -7
- data/lib/assemblyai/lemur/types/lemur_question_context.rb +3 -29
- data/lib/assemblyai/realtime/types/audio_encoding.rb +5 -2
- data/lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb +48 -0
- data/lib/assemblyai/realtime/types/force_end_utterance.rb +48 -0
- data/lib/assemblyai/realtime/types/message_type.rb +6 -7
- data/lib/assemblyai/realtime/types/realtime_base_message.rb +6 -6
- data/lib/assemblyai/realtime/types/realtime_message.rb +6 -35
- data/lib/assemblyai/realtime/types/realtime_transcript.rb +3 -29
- data/lib/assemblyai/realtime/types/realtime_transcript_type.rb +4 -2
- data/lib/assemblyai/realtime/types/terminate_session.rb +5 -14
- data/lib/assemblyai/transcripts/client.rb +20 -20
- data/lib/assemblyai/transcripts/types/audio_intelligence_model_status.rb +5 -2
- data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +5 -5
- data/lib/assemblyai/transcripts/types/entity.rb +6 -11
- data/lib/assemblyai/transcripts/types/entity_type.rb +32 -32
- data/lib/assemblyai/transcripts/types/pii_policy.rb +29 -30
- data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +5 -2
- data/lib/assemblyai/transcripts/types/sentiment.rb +5 -2
- data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +6 -6
- data/lib/assemblyai/transcripts/types/speech_model.rb +4 -1
- data/lib/assemblyai/transcripts/types/substitution_policy.rb +5 -2
- data/lib/assemblyai/transcripts/types/subtitle_format.rb +5 -2
- data/lib/assemblyai/transcripts/types/summary_model.rb +6 -2
- data/lib/assemblyai/transcripts/types/summary_type.rb +8 -8
- data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +5 -9
- data/lib/assemblyai/transcripts/types/transcript.rb +26 -29
- data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +6 -2
- data/lib/assemblyai/transcripts/types/transcript_language_code.rb +24 -23
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +5 -5
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +36 -39
- data/lib/assemblyai/transcripts/types/transcript_status.rb +7 -2
- data/lib/requests.rb +28 -2
- data/lib/types_export.rb +7 -5
- metadata +54 -14
@@ -1,22 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "message_type"
|
4
3
|
require "json"
|
5
4
|
|
6
5
|
module AssemblyAI
|
7
6
|
class Realtime
|
8
7
|
class TerminateSession
|
9
|
-
attr_reader :terminate_session, :
|
8
|
+
attr_reader :terminate_session, :additional_properties
|
10
9
|
|
11
10
|
# @param terminate_session [Boolean] Set to true to end your real-time session forever
|
12
|
-
# @param message_type [MESSAGE_TYPE] Describes the type of the message
|
13
11
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
12
|
# @return [Realtime::TerminateSession]
|
15
|
-
def initialize(terminate_session:,
|
13
|
+
def initialize(terminate_session:, additional_properties: nil)
|
16
14
|
# @type [Boolean] Set to true to end your real-time session forever
|
17
15
|
@terminate_session = terminate_session
|
18
|
-
# @type [MESSAGE_TYPE] Describes the type of the message
|
19
|
-
@message_type = message_type
|
20
16
|
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
21
17
|
@additional_properties = additional_properties
|
22
18
|
end
|
@@ -27,20 +23,16 @@ module AssemblyAI
|
|
27
23
|
# @return [Realtime::TerminateSession]
|
28
24
|
def self.from_json(json_object:)
|
29
25
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
-
|
26
|
+
JSON.parse(json_object)
|
31
27
|
terminate_session = struct.terminate_session
|
32
|
-
|
33
|
-
new(terminate_session: terminate_session, message_type: message_type, additional_properties: struct)
|
28
|
+
new(terminate_session: terminate_session, additional_properties: struct)
|
34
29
|
end
|
35
30
|
|
36
31
|
# Serialize an instance of TerminateSession to a JSON object
|
37
32
|
#
|
38
33
|
# @return [JSON]
|
39
34
|
def to_json(*_args)
|
40
|
-
{
|
41
|
-
"terminate_session": @terminate_session,
|
42
|
-
"message_type": Realtime::MESSAGE_TYPE[@message_type] || @message_type
|
43
|
-
}.to_json
|
35
|
+
{ "terminate_session": @terminate_session }.to_json
|
44
36
|
end
|
45
37
|
|
46
38
|
# 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.
|
@@ -49,7 +41,6 @@ module AssemblyAI
|
|
49
41
|
# @return [Void]
|
50
42
|
def self.validate_raw(obj:)
|
51
43
|
obj.terminate_session.is_a?(Boolean) != false || raise("Passed value for field obj.terminate_session is not the expected type, validation failed.")
|
52
|
-
obj.message_type.is_a?(Realtime::MESSAGE_TYPE) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
|
53
44
|
end
|
54
45
|
end
|
55
46
|
end
|
@@ -34,7 +34,7 @@ module AssemblyAI
|
|
34
34
|
# Retrieve a list of transcripts you created
|
35
35
|
#
|
36
36
|
# @param limit [Integer] Maximum amount of transcripts to retrieve
|
37
|
-
# @param status [
|
37
|
+
# @param status [Transcripts::TranscriptStatus] Filter by transcript status
|
38
38
|
# @param created_on [String] Only get transcripts created on this date
|
39
39
|
# @param before_id [String] Get transcripts that were created before this transcript ID
|
40
40
|
# @param after_id [String] Get transcripts that were created after this transcript ID
|
@@ -62,8 +62,8 @@ module AssemblyAI
|
|
62
62
|
|
63
63
|
# Create a transcript from an audio or video file that is accessible via a URL.
|
64
64
|
#
|
65
|
-
# @param speech_model [Transcripts::
|
66
|
-
# @param language_code [
|
65
|
+
# @param speech_model [Transcripts::SpeechModel]
|
66
|
+
# @param language_code [Transcripts::TranscriptLanguageCode]
|
67
67
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
68
68
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
69
69
|
# @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
|
@@ -74,13 +74,13 @@ module AssemblyAI
|
|
74
74
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
75
75
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
76
76
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
77
|
-
# @param boost_param [
|
77
|
+
# @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value
|
78
78
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
79
79
|
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false
|
80
80
|
# @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.
|
81
|
-
# @param redact_pii_audio_quality [
|
82
|
-
# @param redact_pii_policies [Array<Transcripts::
|
83
|
-
# @param redact_pii_sub [
|
81
|
+
# @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.
|
82
|
+
# @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.
|
83
|
+
# @param redact_pii_sub [Transcripts::SubstitutionPolicy]
|
84
84
|
# @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
|
85
85
|
# @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.
|
86
86
|
# @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false
|
@@ -97,8 +97,8 @@ module AssemblyAI
|
|
97
97
|
# @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
|
98
98
|
# Valid values are in the range [0, 1] inclusive.
|
99
99
|
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
|
100
|
-
# @param summary_model [
|
101
|
-
# @param summary_type [
|
100
|
+
# @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript
|
101
|
+
# @param summary_type [Transcripts::SummaryType] The type of summary
|
102
102
|
# @param custom_topics [Boolean] Whether custom topics is enabled, either true or false
|
103
103
|
# @param topics [Array<String>] The list of custom topics provided, if custom topics is enabled
|
104
104
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
@@ -187,7 +187,7 @@ module AssemblyAI
|
|
187
187
|
# Export your transcript in SRT or VTT format, to be plugged into a video player for subtitles and closed captions.
|
188
188
|
#
|
189
189
|
# @param transcript_id [String] ID of the transcript
|
190
|
-
# @param subtitle_format [
|
190
|
+
# @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
|
191
191
|
# @param chars_per_caption [Integer] The maximum number of characters per caption
|
192
192
|
# @param request_options [RequestOptions]
|
193
193
|
# @return [String]
|
@@ -276,7 +276,7 @@ module AssemblyAI
|
|
276
276
|
# Retrieve a list of transcripts you created
|
277
277
|
#
|
278
278
|
# @param limit [Integer] Maximum amount of transcripts to retrieve
|
279
|
-
# @param status [
|
279
|
+
# @param status [Transcripts::TranscriptStatus] Filter by transcript status
|
280
280
|
# @param created_on [String] Only get transcripts created on this date
|
281
281
|
# @param before_id [String] Get transcripts that were created before this transcript ID
|
282
282
|
# @param after_id [String] Get transcripts that were created after this transcript ID
|
@@ -306,8 +306,8 @@ module AssemblyAI
|
|
306
306
|
|
307
307
|
# Create a transcript from an audio or video file that is accessible via a URL.
|
308
308
|
#
|
309
|
-
# @param speech_model [Transcripts::
|
310
|
-
# @param language_code [
|
309
|
+
# @param speech_model [Transcripts::SpeechModel]
|
310
|
+
# @param language_code [Transcripts::TranscriptLanguageCode]
|
311
311
|
# @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
|
312
312
|
# @param format_text [Boolean] Enable Text Formatting, can be true or false
|
313
313
|
# @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
|
@@ -318,13 +318,13 @@ module AssemblyAI
|
|
318
318
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
319
319
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
320
320
|
# @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
|
321
|
-
# @param boost_param [
|
321
|
+
# @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value
|
322
322
|
# @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
|
323
323
|
# @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false
|
324
324
|
# @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.
|
325
|
-
# @param redact_pii_audio_quality [
|
326
|
-
# @param redact_pii_policies [Array<Transcripts::
|
327
|
-
# @param redact_pii_sub [
|
325
|
+
# @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.
|
326
|
+
# @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.
|
327
|
+
# @param redact_pii_sub [Transcripts::SubstitutionPolicy]
|
328
328
|
# @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
|
329
329
|
# @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.
|
330
330
|
# @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false
|
@@ -341,8 +341,8 @@ module AssemblyAI
|
|
341
341
|
# @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
|
342
342
|
# Valid values are in the range [0, 1] inclusive.
|
343
343
|
# @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
|
344
|
-
# @param summary_model [
|
345
|
-
# @param summary_type [
|
344
|
+
# @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript
|
345
|
+
# @param summary_type [Transcripts::SummaryType] The type of summary
|
346
346
|
# @param custom_topics [Boolean] Whether custom topics is enabled, either true or false
|
347
347
|
# @param topics [Array<String>] The list of custom topics provided, if custom topics is enabled
|
348
348
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
@@ -437,7 +437,7 @@ module AssemblyAI
|
|
437
437
|
# Export your transcript in SRT or VTT format, to be plugged into a video player for subtitles and closed captions.
|
438
438
|
#
|
439
439
|
# @param transcript_id [String] ID of the transcript
|
440
|
-
# @param subtitle_format [
|
440
|
+
# @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
|
441
441
|
# @param chars_per_caption [Integer] The maximum number of characters per caption
|
442
442
|
# @param request_options [RequestOptions]
|
443
443
|
# @return [String]
|
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
#
|
6
|
-
|
5
|
+
# Either success, or unavailable in the rare case that the model failed
|
6
|
+
class AudioIntelligenceModelStatus
|
7
|
+
SUCCESS = "success"
|
8
|
+
UNAVAILABLE = "unavailable"
|
9
|
+
end
|
7
10
|
end
|
8
11
|
end
|
@@ -11,14 +11,14 @@ module AssemblyAI
|
|
11
11
|
class ContentSafetyLabelsResult
|
12
12
|
attr_reader :status, :results, :summary, :severity_score_summary, :additional_properties
|
13
13
|
|
14
|
-
# @param status [
|
14
|
+
# @param status [Transcripts::AudioIntelligenceModelStatus] The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed.
|
15
15
|
# @param results [Array<Transcripts::ContentSafetyLabelResult>]
|
16
16
|
# @param summary [Hash{String => String}] A summary of the Content Moderation confidence results for the entire audio file
|
17
17
|
# @param severity_score_summary [Hash{String => String}] A summary of the Content Moderation severity results for the entire audio file
|
18
18
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
19
|
# @return [Transcripts::ContentSafetyLabelsResult]
|
20
20
|
def initialize(status:, results:, summary:, severity_score_summary:, additional_properties: nil)
|
21
|
-
# @type [
|
21
|
+
# @type [Transcripts::AudioIntelligenceModelStatus] The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed.
|
22
22
|
@status = status
|
23
23
|
# @type [Array<Transcripts::ContentSafetyLabelResult>]
|
24
24
|
@results = results
|
@@ -37,7 +37,7 @@ module AssemblyAI
|
|
37
37
|
def self.from_json(json_object:)
|
38
38
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
39
39
|
parsed_json = JSON.parse(json_object)
|
40
|
-
status =
|
40
|
+
status = struct.status
|
41
41
|
results = parsed_json["results"]&.map do |v|
|
42
42
|
v = v.to_json
|
43
43
|
Transcripts::ContentSafetyLabelResult.from_json(json_object: v)
|
@@ -53,7 +53,7 @@ module AssemblyAI
|
|
53
53
|
# @return [JSON]
|
54
54
|
def to_json(*_args)
|
55
55
|
{
|
56
|
-
"status":
|
56
|
+
"status": @status,
|
57
57
|
"results": @results,
|
58
58
|
"summary": @summary,
|
59
59
|
"severity_score_summary": @severity_score_summary
|
@@ -65,7 +65,7 @@ module AssemblyAI
|
|
65
65
|
# @param obj [Object]
|
66
66
|
# @return [Void]
|
67
67
|
def self.validate_raw(obj:)
|
68
|
-
obj.status.is_a?(Transcripts::
|
68
|
+
obj.status.is_a?(Transcripts::AudioIntelligenceModelStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
69
69
|
obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
70
70
|
obj.summary.is_a?(Hash) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.")
|
71
71
|
obj.severity_score_summary.is_a?(Hash) != false || raise("Passed value for field obj.severity_score_summary is not the expected type, validation failed.")
|
@@ -9,14 +9,14 @@ module AssemblyAI
|
|
9
9
|
class Entity
|
10
10
|
attr_reader :entity_type, :text, :start, :end_, :additional_properties
|
11
11
|
|
12
|
-
# @param entity_type [
|
12
|
+
# @param entity_type [Transcripts::EntityType] The type of entity for the detected entity
|
13
13
|
# @param text [String] The text for the detected entity
|
14
14
|
# @param start [Integer] The starting time, in milliseconds, at which the detected entity appears in the audio file
|
15
15
|
# @param end_ [Integer] The ending time, in milliseconds, for the detected entity in the audio file
|
16
16
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
17
|
# @return [Transcripts::Entity]
|
18
18
|
def initialize(entity_type:, text:, start:, end_:, additional_properties: nil)
|
19
|
-
# @type [
|
19
|
+
# @type [Transcripts::EntityType] The type of entity for the detected entity
|
20
20
|
@entity_type = entity_type
|
21
21
|
# @type [String] The text for the detected entity
|
22
22
|
@text = text
|
@@ -34,8 +34,8 @@ module AssemblyAI
|
|
34
34
|
# @return [Transcripts::Entity]
|
35
35
|
def self.from_json(json_object:)
|
36
36
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
37
|
-
|
38
|
-
entity_type =
|
37
|
+
JSON.parse(json_object)
|
38
|
+
entity_type = struct.entity_type
|
39
39
|
text = struct.text
|
40
40
|
start = struct.start
|
41
41
|
end_ = struct.end
|
@@ -46,12 +46,7 @@ module AssemblyAI
|
|
46
46
|
#
|
47
47
|
# @return [JSON]
|
48
48
|
def to_json(*_args)
|
49
|
-
{
|
50
|
-
"entity_type": Transcripts::ENTITY_TYPE[@entity_type] || @entity_type,
|
51
|
-
"text": @text,
|
52
|
-
"start": @start,
|
53
|
-
"end": @end_
|
54
|
-
}.to_json
|
49
|
+
{ "entity_type": @entity_type, "text": @text, "start": @start, "end": @end_ }.to_json
|
55
50
|
end
|
56
51
|
|
57
52
|
# 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 +54,7 @@ module AssemblyAI
|
|
59
54
|
# @param obj [Object]
|
60
55
|
# @return [Void]
|
61
56
|
def self.validate_raw(obj:)
|
62
|
-
obj.entity_type.is_a?(Transcripts::
|
57
|
+
obj.entity_type.is_a?(Transcripts::EntityType) != false || raise("Passed value for field obj.entity_type is not the expected type, validation failed.")
|
63
58
|
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
64
59
|
obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
65
60
|
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
@@ -2,37 +2,37 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
5
|
+
# The type of entity for the detected entity
|
6
|
+
class EntityType
|
7
|
+
BANKING_INFORMATION = "banking_information"
|
8
|
+
BLOOD_TYPE = "blood_type"
|
9
|
+
CREDIT_CARD_CVV = "credit_card_cvv"
|
10
|
+
CREDIT_CARD_EXPIRATION = "credit_card_expiration"
|
11
|
+
CREDIT_CARD_NUMBER = "credit_card_number"
|
12
|
+
DATE = "date"
|
13
|
+
DATE_OF_BIRTH = "date_of_birth"
|
14
|
+
DRIVERS_LICENSE = "drivers_license"
|
15
|
+
DRUG = "drug"
|
16
|
+
EMAIL_ADDRESS = "email_address"
|
17
|
+
EVENT = "event"
|
18
|
+
INJURY = "injury"
|
19
|
+
LANGUAGE = "language"
|
20
|
+
LOCATION = "location"
|
21
|
+
MEDICAL_CONDITION = "medical_condition"
|
22
|
+
MEDICAL_PROCESS = "medical_process"
|
23
|
+
MONEY_AMOUNT = "money_amount"
|
24
|
+
NATIONALITY = "nationality"
|
25
|
+
OCCUPATION = "occupation"
|
26
|
+
ORGANIZATION = "organization"
|
27
|
+
PASSWORD = "password"
|
28
|
+
PERSON_AGE = "person_age"
|
29
|
+
PERSON_NAME = "person_name"
|
30
|
+
PHONE_NUMBER = "phone_number"
|
31
|
+
POLITICAL_AFFILIATION = "political_affiliation"
|
32
|
+
RELIGION = "religion"
|
33
|
+
TIME = "time"
|
34
|
+
URL = "url"
|
35
|
+
US_SOCIAL_SECURITY_NUMBER = "us_social_security_number"
|
36
|
+
end
|
37
37
|
end
|
38
38
|
end
|
@@ -2,35 +2,34 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}.freeze
|
5
|
+
class PiiPolicy
|
6
|
+
MEDICAL_PROCESS = "medical_process"
|
7
|
+
MEDICAL_CONDITION = "medical_condition"
|
8
|
+
BLOOD_TYPE = "blood_type"
|
9
|
+
DRUG = "drug"
|
10
|
+
INJURY = "injury"
|
11
|
+
NUMBER_SEQUENCE = "number_sequence"
|
12
|
+
EMAIL_ADDRESS = "email_address"
|
13
|
+
DATE_OF_BIRTH = "date_of_birth"
|
14
|
+
PHONE_NUMBER = "phone_number"
|
15
|
+
US_SOCIAL_SECURITY_NUMBER = "us_social_security_number"
|
16
|
+
CREDIT_CARD_NUMBER = "credit_card_number"
|
17
|
+
CREDIT_CARD_EXPIRATION = "credit_card_expiration"
|
18
|
+
CREDIT_CARD_CVV = "credit_card_cvv"
|
19
|
+
DATE = "date"
|
20
|
+
NATIONALITY = "nationality"
|
21
|
+
EVENT = "event"
|
22
|
+
LANGUAGE = "language"
|
23
|
+
LOCATION = "location"
|
24
|
+
MONEY_AMOUNT = "money_amount"
|
25
|
+
PERSON_NAME = "person_name"
|
26
|
+
PERSON_AGE = "person_age"
|
27
|
+
ORGANIZATION = "organization"
|
28
|
+
POLITICAL_AFFILIATION = "political_affiliation"
|
29
|
+
OCCUPATION = "occupation"
|
30
|
+
RELIGION = "religion"
|
31
|
+
DRIVERS_LICENSE = "drivers_license"
|
32
|
+
BANKING_INFORMATION = "banking_information"
|
33
|
+
end
|
35
34
|
end
|
36
35
|
end
|
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
#
|
6
|
-
|
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
|
-
|
6
|
-
|
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 [
|
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 [
|
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
|
-
|
43
|
+
JSON.parse(json_object)
|
44
44
|
text = struct.text
|
45
45
|
start = struct.start
|
46
46
|
end_ = struct.end
|
47
|
-
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":
|
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::
|
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,7 +2,10 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
#
|
6
|
-
|
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,11 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
#
|
6
|
-
|
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
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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 [
|
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 [
|
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 =
|
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::
|
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
|