assemblyai 1.0.0.pre.beta.7 → 1.0.0.pre.beta.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assemblyai/files/client.rb +4 -2
- data/lib/assemblyai/files/types/uploaded_file.rb +20 -11
- data/lib/assemblyai/lemur/client.rb +260 -150
- data/lib/assemblyai/lemur/types/lemur_action_items_response.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_base_params.rb +83 -55
- data/lib/assemblyai/lemur/types/lemur_base_params_context.rb +11 -5
- data/lib/assemblyai/lemur/types/lemur_base_response.rb +20 -11
- data/lib/assemblyai/lemur/types/lemur_question.rb +57 -32
- data/lib/assemblyai/lemur/types/lemur_question_answer.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_question_answer_response.rb +29 -15
- data/lib/assemblyai/lemur/types/lemur_question_context.rb +13 -6
- data/lib/assemblyai/lemur/types/lemur_summary_response.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_task_response.rb +28 -14
- data/lib/assemblyai/lemur/types/purge_lemur_request_data_response.rb +32 -17
- data/lib/assemblyai/realtime/client.rb +30 -14
- data/lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb +24 -13
- data/lib/assemblyai/realtime/types/final_transcript.rb +73 -42
- data/lib/assemblyai/realtime/types/force_end_utterance.rb +20 -11
- data/lib/assemblyai/realtime/types/message_type.rb +1 -0
- data/lib/assemblyai/realtime/types/partial_transcript.rb +63 -35
- data/lib/assemblyai/realtime/types/realtime_base_message.rb +22 -13
- data/lib/assemblyai/realtime/types/realtime_base_transcript.rb +57 -31
- data/lib/assemblyai/realtime/types/realtime_error.rb +20 -11
- data/lib/assemblyai/realtime/types/realtime_message.rb +44 -18
- data/lib/assemblyai/realtime/types/realtime_temporary_token_response.rb +20 -11
- data/lib/assemblyai/realtime/types/realtime_transcript.rb +15 -9
- data/lib/assemblyai/realtime/types/session_begins.rb +32 -15
- data/lib/assemblyai/realtime/types/session_information.rb +69 -0
- data/lib/assemblyai/realtime/types/session_terminated.rb +21 -12
- data/lib/assemblyai/realtime/types/terminate_session.rb +20 -11
- data/lib/assemblyai/realtime/types/word.rb +36 -18
- data/lib/assemblyai/streaming/types/receive_message.rb +113 -0
- data/lib/assemblyai/{realtime → streaming}/types/send_message.rb +26 -14
- data/lib/assemblyai/streaming/types/streaming.rb +11 -0
- data/lib/assemblyai/transcripts/client.rb +50 -18
- data/lib/assemblyai/transcripts/list_by_url_client.rb +6 -4
- data/lib/assemblyai/transcripts/polling_client.rb +12 -2
- data/lib/assemblyai/transcripts/types/auto_highlight_result.rb +40 -19
- data/lib/assemblyai/transcripts/types/auto_highlights_result.rb +38 -14
- data/lib/assemblyai/transcripts/types/chapter.rb +40 -20
- data/lib/assemblyai/transcripts/types/content_safety_label.rb +32 -16
- data/lib/assemblyai/transcripts/types/content_safety_label_result.rb +51 -29
- data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +51 -29
- data/lib/assemblyai/transcripts/types/entity.rb +41 -21
- data/lib/assemblyai/transcripts/types/entity_type.rb +15 -0
- data/lib/assemblyai/transcripts/types/page_details.rb +62 -36
- data/lib/assemblyai/transcripts/types/paragraphs_response.rb +37 -19
- data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +4 -1
- data/lib/assemblyai/transcripts/types/redacted_audio_response.rb +29 -15
- data/lib/assemblyai/transcripts/types/sentences_response.rb +37 -19
- data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +63 -36
- data/lib/assemblyai/transcripts/types/severity_score_summary.rb +32 -16
- data/lib/assemblyai/transcripts/types/speech_model.rb +1 -0
- data/lib/assemblyai/transcripts/types/substitution_policy.rb +3 -1
- data/lib/assemblyai/transcripts/types/timestamp.rb +28 -14
- data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +39 -20
- data/lib/assemblyai/transcripts/types/topic_detection_result.rb +40 -21
- data/lib/assemblyai/transcripts/types/topic_detection_result_labels_item.rb +31 -15
- data/lib/assemblyai/transcripts/types/transcript.rb +513 -295
- data/lib/assemblyai/transcripts/types/transcript_custom_spelling.rb +30 -15
- data/lib/assemblyai/transcripts/types/transcript_language_code.rb +87 -4
- data/lib/assemblyai/transcripts/types/transcript_list.rb +33 -17
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +60 -35
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +338 -196
- data/lib/assemblyai/transcripts/types/transcript_paragraph.rb +61 -34
- data/lib/assemblyai/transcripts/types/transcript_ready_notification.rb +30 -16
- data/lib/assemblyai/transcripts/types/transcript_sentence.rb +61 -34
- data/lib/assemblyai/transcripts/types/transcript_status.rb +2 -1
- data/lib/assemblyai/transcripts/types/transcript_utterance.rb +55 -32
- data/lib/assemblyai/transcripts/types/transcript_word.rb +55 -24
- data/lib/assemblyai/transcripts/types/word_search_match.rb +40 -20
- data/lib/assemblyai/transcripts/types/word_search_response.rb +36 -17
- data/lib/assemblyai/types/error.rb +32 -16
- data/lib/requests.rb +80 -34
- data/lib/types_export.rb +4 -3
- metadata +6 -5
- data/lib/assemblyai/realtime/types/audio_data.rb +0 -7
- data/lib/assemblyai/realtime/types/receive_message.rb +0 -87
@@ -1,58 +1,76 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "transcript_paragraph"
|
4
|
+
require "ostruct"
|
4
5
|
require "json"
|
5
6
|
|
6
7
|
module AssemblyAI
|
7
8
|
class Transcripts
|
8
9
|
class ParagraphsResponse
|
9
|
-
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :id
|
12
|
+
# @return [Float]
|
13
|
+
attr_reader :confidence
|
14
|
+
# @return [Float]
|
15
|
+
attr_reader :audio_duration
|
16
|
+
# @return [Array<AssemblyAI::Transcripts::TranscriptParagraph>]
|
17
|
+
attr_reader :paragraphs
|
18
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
attr_reader :additional_properties
|
20
|
+
# @return [Object]
|
21
|
+
attr_reader :_field_set
|
22
|
+
protected :_field_set
|
23
|
+
|
24
|
+
OMIT = Object.new
|
10
25
|
|
11
26
|
# @param id [String]
|
12
27
|
# @param confidence [Float]
|
13
28
|
# @param audio_duration [Float]
|
14
|
-
# @param paragraphs [Array<Transcripts::TranscriptParagraph>]
|
29
|
+
# @param paragraphs [Array<AssemblyAI::Transcripts::TranscriptParagraph>]
|
15
30
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
-
# @return [Transcripts::ParagraphsResponse]
|
31
|
+
# @return [AssemblyAI::Transcripts::ParagraphsResponse]
|
17
32
|
def initialize(id:, confidence:, audio_duration:, paragraphs:, additional_properties: nil)
|
18
|
-
# @type [String]
|
19
33
|
@id = id
|
20
|
-
# @type [Float]
|
21
34
|
@confidence = confidence
|
22
|
-
# @type [Float]
|
23
35
|
@audio_duration = audio_duration
|
24
|
-
# @type [Array<Transcripts::TranscriptParagraph>]
|
25
36
|
@paragraphs = paragraphs
|
26
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
27
37
|
@additional_properties = additional_properties
|
38
|
+
@_field_set = { "id": id, "confidence": confidence, "audio_duration": audio_duration, "paragraphs": paragraphs }
|
28
39
|
end
|
29
40
|
|
30
41
|
# Deserialize a JSON object to an instance of ParagraphsResponse
|
31
42
|
#
|
32
|
-
# @param json_object [
|
33
|
-
# @return [Transcripts::ParagraphsResponse]
|
43
|
+
# @param json_object [String]
|
44
|
+
# @return [AssemblyAI::Transcripts::ParagraphsResponse]
|
34
45
|
def self.from_json(json_object:)
|
35
46
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
36
47
|
parsed_json = JSON.parse(json_object)
|
37
|
-
id = struct
|
38
|
-
confidence = struct
|
39
|
-
audio_duration = struct
|
48
|
+
id = struct["id"]
|
49
|
+
confidence = struct["confidence"]
|
50
|
+
audio_duration = struct["audio_duration"]
|
40
51
|
paragraphs = parsed_json["paragraphs"]&.map do |v|
|
41
52
|
v = v.to_json
|
42
|
-
Transcripts::TranscriptParagraph.from_json(json_object: v)
|
53
|
+
AssemblyAI::Transcripts::TranscriptParagraph.from_json(json_object: v)
|
43
54
|
end
|
44
|
-
new(
|
45
|
-
|
55
|
+
new(
|
56
|
+
id: id,
|
57
|
+
confidence: confidence,
|
58
|
+
audio_duration: audio_duration,
|
59
|
+
paragraphs: paragraphs,
|
60
|
+
additional_properties: struct
|
61
|
+
)
|
46
62
|
end
|
47
63
|
|
48
64
|
# Serialize an instance of ParagraphsResponse to a JSON object
|
49
65
|
#
|
50
|
-
# @return [
|
66
|
+
# @return [String]
|
51
67
|
def to_json(*_args)
|
52
|
-
|
68
|
+
@_field_set&.to_json
|
53
69
|
end
|
54
70
|
|
55
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
71
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
72
|
+
# hash and check each fields type against the current object's property
|
73
|
+
# definitions.
|
56
74
|
#
|
57
75
|
# @param obj [Object]
|
58
76
|
# @return [Void]
|
@@ -2,7 +2,10 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
# Controls the filetype of the audio created by redact_pii_audio. Currently
|
5
|
+
# Controls the filetype of the audio created by redact_pii_audio. Currently
|
6
|
+
# supports mp3 (default) and wav. See [PII
|
7
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
8
|
+
# details.
|
6
9
|
class RedactPiiAudioQuality
|
7
10
|
MP3 = "mp3"
|
8
11
|
WAV = "wav"
|
@@ -1,46 +1,60 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "redacted_audio_status"
|
4
|
+
require "ostruct"
|
4
5
|
require "json"
|
5
6
|
|
6
7
|
module AssemblyAI
|
7
8
|
class Transcripts
|
8
9
|
class RedactedAudioResponse
|
9
|
-
|
10
|
+
# @return [AssemblyAI::Transcripts::REDACTED_AUDIO_STATUS] The status of the redacted audio
|
11
|
+
attr_reader :status
|
12
|
+
# @return [String] The URL of the redacted audio file
|
13
|
+
attr_reader :redacted_audio_url
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
10
19
|
|
11
|
-
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param status [AssemblyAI::Transcripts::REDACTED_AUDIO_STATUS] The status of the redacted audio
|
12
23
|
# @param redacted_audio_url [String] The URL of the redacted audio file
|
13
24
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
-
# @return [Transcripts::RedactedAudioResponse]
|
25
|
+
# @return [AssemblyAI::Transcripts::RedactedAudioResponse]
|
15
26
|
def initialize(status:, redacted_audio_url:, additional_properties: nil)
|
16
|
-
# @type [Transcripts::REDACTED_AUDIO_STATUS] The status of the redacted audio
|
17
27
|
@status = status
|
18
|
-
# @type [String] The URL of the redacted audio file
|
19
28
|
@redacted_audio_url = redacted_audio_url
|
20
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
21
29
|
@additional_properties = additional_properties
|
30
|
+
@_field_set = { "status": status, "redacted_audio_url": redacted_audio_url }
|
22
31
|
end
|
23
32
|
|
24
33
|
# Deserialize a JSON object to an instance of RedactedAudioResponse
|
25
34
|
#
|
26
|
-
# @param json_object [
|
27
|
-
# @return [Transcripts::RedactedAudioResponse]
|
35
|
+
# @param json_object [String]
|
36
|
+
# @return [AssemblyAI::Transcripts::RedactedAudioResponse]
|
28
37
|
def self.from_json(json_object:)
|
29
38
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
status = struct["status"]
|
40
|
+
redacted_audio_url = struct["redacted_audio_url"]
|
41
|
+
new(
|
42
|
+
status: status,
|
43
|
+
redacted_audio_url: redacted_audio_url,
|
44
|
+
additional_properties: struct
|
45
|
+
)
|
34
46
|
end
|
35
47
|
|
36
48
|
# Serialize an instance of RedactedAudioResponse to a JSON object
|
37
49
|
#
|
38
|
-
# @return [
|
50
|
+
# @return [String]
|
39
51
|
def to_json(*_args)
|
40
|
-
|
52
|
+
@_field_set&.to_json
|
41
53
|
end
|
42
54
|
|
43
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
55
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
56
|
+
# hash and check each fields type against the current object's property
|
57
|
+
# definitions.
|
44
58
|
#
|
45
59
|
# @param obj [Object]
|
46
60
|
# @return [Void]
|
@@ -1,58 +1,76 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "transcript_sentence"
|
4
|
+
require "ostruct"
|
4
5
|
require "json"
|
5
6
|
|
6
7
|
module AssemblyAI
|
7
8
|
class Transcripts
|
8
9
|
class SentencesResponse
|
9
|
-
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :id
|
12
|
+
# @return [Float]
|
13
|
+
attr_reader :confidence
|
14
|
+
# @return [Float]
|
15
|
+
attr_reader :audio_duration
|
16
|
+
# @return [Array<AssemblyAI::Transcripts::TranscriptSentence>]
|
17
|
+
attr_reader :sentences
|
18
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
attr_reader :additional_properties
|
20
|
+
# @return [Object]
|
21
|
+
attr_reader :_field_set
|
22
|
+
protected :_field_set
|
23
|
+
|
24
|
+
OMIT = Object.new
|
10
25
|
|
11
26
|
# @param id [String]
|
12
27
|
# @param confidence [Float]
|
13
28
|
# @param audio_duration [Float]
|
14
|
-
# @param sentences [Array<Transcripts::TranscriptSentence>]
|
29
|
+
# @param sentences [Array<AssemblyAI::Transcripts::TranscriptSentence>]
|
15
30
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
-
# @return [Transcripts::SentencesResponse]
|
31
|
+
# @return [AssemblyAI::Transcripts::SentencesResponse]
|
17
32
|
def initialize(id:, confidence:, audio_duration:, sentences:, additional_properties: nil)
|
18
|
-
# @type [String]
|
19
33
|
@id = id
|
20
|
-
# @type [Float]
|
21
34
|
@confidence = confidence
|
22
|
-
# @type [Float]
|
23
35
|
@audio_duration = audio_duration
|
24
|
-
# @type [Array<Transcripts::TranscriptSentence>]
|
25
36
|
@sentences = sentences
|
26
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
27
37
|
@additional_properties = additional_properties
|
38
|
+
@_field_set = { "id": id, "confidence": confidence, "audio_duration": audio_duration, "sentences": sentences }
|
28
39
|
end
|
29
40
|
|
30
41
|
# Deserialize a JSON object to an instance of SentencesResponse
|
31
42
|
#
|
32
|
-
# @param json_object [
|
33
|
-
# @return [Transcripts::SentencesResponse]
|
43
|
+
# @param json_object [String]
|
44
|
+
# @return [AssemblyAI::Transcripts::SentencesResponse]
|
34
45
|
def self.from_json(json_object:)
|
35
46
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
36
47
|
parsed_json = JSON.parse(json_object)
|
37
|
-
id = struct
|
38
|
-
confidence = struct
|
39
|
-
audio_duration = struct
|
48
|
+
id = struct["id"]
|
49
|
+
confidence = struct["confidence"]
|
50
|
+
audio_duration = struct["audio_duration"]
|
40
51
|
sentences = parsed_json["sentences"]&.map do |v|
|
41
52
|
v = v.to_json
|
42
|
-
Transcripts::TranscriptSentence.from_json(json_object: v)
|
53
|
+
AssemblyAI::Transcripts::TranscriptSentence.from_json(json_object: v)
|
43
54
|
end
|
44
|
-
new(
|
45
|
-
|
55
|
+
new(
|
56
|
+
id: id,
|
57
|
+
confidence: confidence,
|
58
|
+
audio_duration: audio_duration,
|
59
|
+
sentences: sentences,
|
60
|
+
additional_properties: struct
|
61
|
+
)
|
46
62
|
end
|
47
63
|
|
48
64
|
# Serialize an instance of SentencesResponse to a JSON object
|
49
65
|
#
|
50
|
-
# @return [
|
66
|
+
# @return [String]
|
51
67
|
def to_json(*_args)
|
52
|
-
|
68
|
+
@_field_set&.to_json
|
53
69
|
end
|
54
70
|
|
55
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
71
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
72
|
+
# hash and check each fields type against the current object's property
|
73
|
+
# definitions.
|
56
74
|
#
|
57
75
|
# @param obj [Object]
|
58
76
|
# @return [Void]
|
@@ -1,71 +1,98 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "sentiment"
|
4
|
+
require "ostruct"
|
4
5
|
require "json"
|
5
6
|
|
6
7
|
module AssemblyAI
|
7
8
|
class Transcripts
|
8
|
-
# The result of the
|
9
|
+
# The result of the Sentiment Analysis model
|
9
10
|
class SentimentAnalysisResult
|
10
|
-
|
11
|
+
# @return [String] The transcript of the sentence
|
12
|
+
attr_reader :text
|
13
|
+
# @return [Integer] The starting time, in milliseconds, of the sentence
|
14
|
+
attr_reader :start
|
15
|
+
# @return [Integer] The ending time, in milliseconds, of the sentence
|
16
|
+
attr_reader :end_
|
17
|
+
# @return [AssemblyAI::Transcripts::Sentiment] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
|
18
|
+
attr_reader :sentiment
|
19
|
+
# @return [Float] The confidence score for the detected sentiment of the sentence, from 0 to 1
|
20
|
+
attr_reader :confidence
|
21
|
+
# @return [String] The speaker of the sentence if [Speaker
|
22
|
+
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
23
|
+
# enabled, else null
|
24
|
+
attr_reader :speaker
|
25
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
attr_reader :additional_properties
|
27
|
+
# @return [Object]
|
28
|
+
attr_reader :_field_set
|
29
|
+
protected :_field_set
|
30
|
+
|
31
|
+
OMIT = Object.new
|
11
32
|
|
12
33
|
# @param text [String] The transcript of the sentence
|
13
34
|
# @param start [Integer] The starting time, in milliseconds, of the sentence
|
14
35
|
# @param end_ [Integer] The ending time, in milliseconds, of the sentence
|
15
|
-
# @param sentiment [Transcripts::Sentiment] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
|
36
|
+
# @param sentiment [AssemblyAI::Transcripts::Sentiment] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
|
16
37
|
# @param confidence [Float] The confidence score for the detected sentiment of the sentence, from 0 to 1
|
17
|
-
# @param speaker [String] The speaker of the sentence if [Speaker
|
38
|
+
# @param speaker [String] The speaker of the sentence if [Speaker
|
39
|
+
# Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is
|
40
|
+
# enabled, else null
|
18
41
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
-
# @return [Transcripts::SentimentAnalysisResult]
|
20
|
-
def initialize(text:, start:, end_:, sentiment:, confidence:, speaker:
|
21
|
-
# @type [String] The transcript of the sentence
|
42
|
+
# @return [AssemblyAI::Transcripts::SentimentAnalysisResult]
|
43
|
+
def initialize(text:, start:, end_:, sentiment:, confidence:, speaker: OMIT, additional_properties: nil)
|
22
44
|
@text = text
|
23
|
-
# @type [Integer] The starting time, in milliseconds, of the sentence
|
24
45
|
@start = start
|
25
|
-
# @type [Integer] The ending time, in milliseconds, of the sentence
|
26
46
|
@end_ = end_
|
27
|
-
# @type [Transcripts::Sentiment] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE
|
28
47
|
@sentiment = sentiment
|
29
|
-
# @type [Float] The confidence score for the detected sentiment of the sentence, from 0 to 1
|
30
48
|
@confidence = confidence
|
31
|
-
|
32
|
-
@speaker = speaker
|
33
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
49
|
+
@speaker = speaker if speaker != OMIT
|
34
50
|
@additional_properties = additional_properties
|
51
|
+
@_field_set = {
|
52
|
+
"text": text,
|
53
|
+
"start": start,
|
54
|
+
"end": end_,
|
55
|
+
"sentiment": sentiment,
|
56
|
+
"confidence": confidence,
|
57
|
+
"speaker": speaker
|
58
|
+
}.reject do |_k, v|
|
59
|
+
v == OMIT
|
60
|
+
end
|
35
61
|
end
|
36
62
|
|
37
63
|
# Deserialize a JSON object to an instance of SentimentAnalysisResult
|
38
64
|
#
|
39
|
-
# @param json_object [
|
40
|
-
# @return [Transcripts::SentimentAnalysisResult]
|
65
|
+
# @param json_object [String]
|
66
|
+
# @return [AssemblyAI::Transcripts::SentimentAnalysisResult]
|
41
67
|
def self.from_json(json_object:)
|
42
68
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
69
|
+
text = struct["text"]
|
70
|
+
start = struct["start"]
|
71
|
+
end_ = struct["end"]
|
72
|
+
sentiment = struct["sentiment"]
|
73
|
+
confidence = struct["confidence"]
|
74
|
+
speaker = struct["speaker"]
|
75
|
+
new(
|
76
|
+
text: text,
|
77
|
+
start: start,
|
78
|
+
end_: end_,
|
79
|
+
sentiment: sentiment,
|
80
|
+
confidence: confidence,
|
81
|
+
speaker: speaker,
|
82
|
+
additional_properties: struct
|
83
|
+
)
|
52
84
|
end
|
53
85
|
|
54
86
|
# Serialize an instance of SentimentAnalysisResult to a JSON object
|
55
87
|
#
|
56
|
-
# @return [
|
88
|
+
# @return [String]
|
57
89
|
def to_json(*_args)
|
58
|
-
|
59
|
-
"text": @text,
|
60
|
-
"start": @start,
|
61
|
-
"end": @end_,
|
62
|
-
"sentiment": @sentiment,
|
63
|
-
"confidence": @confidence,
|
64
|
-
"speaker": @speaker
|
65
|
-
}.to_json
|
90
|
+
@_field_set&.to_json
|
66
91
|
end
|
67
92
|
|
68
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
93
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
94
|
+
# hash and check each fields type against the current object's property
|
95
|
+
# definitions.
|
69
96
|
#
|
70
97
|
# @param obj [Object]
|
71
98
|
# @return [Void]
|
@@ -73,7 +100,7 @@ module AssemblyAI
|
|
73
100
|
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
74
101
|
obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
75
102
|
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
76
|
-
obj.sentiment.is_a?(Transcripts::Sentiment) != false || raise("Passed value for field obj.sentiment is not the expected type, validation failed.")
|
103
|
+
obj.sentiment.is_a?(AssemblyAI::Transcripts::Sentiment) != false || raise("Passed value for field obj.sentiment is not the expected type, validation failed.")
|
77
104
|
obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
78
105
|
obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
|
79
106
|
end
|
@@ -1,49 +1,65 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "ostruct"
|
3
4
|
require "json"
|
4
5
|
|
5
6
|
module AssemblyAI
|
6
7
|
class Transcripts
|
7
8
|
class SeverityScoreSummary
|
8
|
-
|
9
|
+
# @return [Float]
|
10
|
+
attr_reader :low
|
11
|
+
# @return [Float]
|
12
|
+
attr_reader :medium
|
13
|
+
# @return [Float]
|
14
|
+
attr_reader :high
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
attr_reader :additional_properties
|
17
|
+
# @return [Object]
|
18
|
+
attr_reader :_field_set
|
19
|
+
protected :_field_set
|
20
|
+
|
21
|
+
OMIT = Object.new
|
9
22
|
|
10
23
|
# @param low [Float]
|
11
24
|
# @param medium [Float]
|
12
25
|
# @param high [Float]
|
13
26
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
-
# @return [Transcripts::SeverityScoreSummary]
|
27
|
+
# @return [AssemblyAI::Transcripts::SeverityScoreSummary]
|
15
28
|
def initialize(low:, medium:, high:, additional_properties: nil)
|
16
|
-
# @type [Float]
|
17
29
|
@low = low
|
18
|
-
# @type [Float]
|
19
30
|
@medium = medium
|
20
|
-
# @type [Float]
|
21
31
|
@high = high
|
22
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
23
32
|
@additional_properties = additional_properties
|
33
|
+
@_field_set = { "low": low, "medium": medium, "high": high }
|
24
34
|
end
|
25
35
|
|
26
36
|
# Deserialize a JSON object to an instance of SeverityScoreSummary
|
27
37
|
#
|
28
|
-
# @param json_object [
|
29
|
-
# @return [Transcripts::SeverityScoreSummary]
|
38
|
+
# @param json_object [String]
|
39
|
+
# @return [AssemblyAI::Transcripts::SeverityScoreSummary]
|
30
40
|
def self.from_json(json_object:)
|
31
41
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
42
|
+
low = struct["low"]
|
43
|
+
medium = struct["medium"]
|
44
|
+
high = struct["high"]
|
45
|
+
new(
|
46
|
+
low: low,
|
47
|
+
medium: medium,
|
48
|
+
high: high,
|
49
|
+
additional_properties: struct
|
50
|
+
)
|
37
51
|
end
|
38
52
|
|
39
53
|
# Serialize an instance of SeverityScoreSummary to a JSON object
|
40
54
|
#
|
41
|
-
# @return [
|
55
|
+
# @return [String]
|
42
56
|
def to_json(*_args)
|
43
|
-
|
57
|
+
@_field_set&.to_json
|
44
58
|
end
|
45
59
|
|
46
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
60
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
61
|
+
# hash and check each fields type against the current object's property
|
62
|
+
# definitions.
|
47
63
|
#
|
48
64
|
# @param obj [Object]
|
49
65
|
# @return [Void]
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
# The replacement logic for detected PII, can be "entity_name" or "hash". See [PII
|
5
|
+
# The replacement logic for detected PII, can be "entity_name" or "hash". See [PII
|
6
|
+
# redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more
|
7
|
+
# details.
|
6
8
|
class SubstitutionPolicy
|
7
9
|
ENTITY_NAME = "entity_name"
|
8
10
|
HASH = "hash"
|
@@ -1,46 +1,60 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "ostruct"
|
3
4
|
require "json"
|
4
5
|
|
5
6
|
module AssemblyAI
|
6
7
|
class Transcripts
|
7
8
|
# Timestamp containing a start and end property in milliseconds
|
8
9
|
class Timestamp
|
9
|
-
|
10
|
+
# @return [Integer] The start time in milliseconds
|
11
|
+
attr_reader :start
|
12
|
+
# @return [Integer] The end time in milliseconds
|
13
|
+
attr_reader :end_
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
10
21
|
|
11
22
|
# @param start [Integer] The start time in milliseconds
|
12
23
|
# @param end_ [Integer] The end time in milliseconds
|
13
24
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
-
# @return [Transcripts::Timestamp]
|
25
|
+
# @return [AssemblyAI::Transcripts::Timestamp]
|
15
26
|
def initialize(start:, end_:, additional_properties: nil)
|
16
|
-
# @type [Integer] The start time in milliseconds
|
17
27
|
@start = start
|
18
|
-
# @type [Integer] The end time in milliseconds
|
19
28
|
@end_ = end_
|
20
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
21
29
|
@additional_properties = additional_properties
|
30
|
+
@_field_set = { "start": start, "end": end_ }
|
22
31
|
end
|
23
32
|
|
24
33
|
# Deserialize a JSON object to an instance of Timestamp
|
25
34
|
#
|
26
|
-
# @param json_object [
|
27
|
-
# @return [Transcripts::Timestamp]
|
35
|
+
# @param json_object [String]
|
36
|
+
# @return [AssemblyAI::Transcripts::Timestamp]
|
28
37
|
def self.from_json(json_object:)
|
29
38
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
start = struct["start"]
|
40
|
+
end_ = struct["end"]
|
41
|
+
new(
|
42
|
+
start: start,
|
43
|
+
end_: end_,
|
44
|
+
additional_properties: struct
|
45
|
+
)
|
34
46
|
end
|
35
47
|
|
36
48
|
# Serialize an instance of Timestamp to a JSON object
|
37
49
|
#
|
38
|
-
# @return [
|
50
|
+
# @return [String]
|
39
51
|
def to_json(*_args)
|
40
|
-
|
52
|
+
@_field_set&.to_json
|
41
53
|
end
|
42
54
|
|
43
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
55
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
56
|
+
# hash and check each fields type against the current object's property
|
57
|
+
# definitions.
|
44
58
|
#
|
45
59
|
# @param obj [Object]
|
46
60
|
# @return [Void]
|