assemblyai 1.0.0.pre.beta.6 → 1.0.0.pre.beta.8
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 +256 -150
- data/lib/assemblyai/lemur/types/lemur_action_items_response.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_base_params.rb +83 -54
- 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 -31
- data/lib/assemblyai/lemur/types/lemur_question_answer.rb +28 -14
- data/lib/assemblyai/lemur/types/lemur_question_answer_response.rb +29 -14
- 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 +32 -16
- data/lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb +24 -13
- data/lib/assemblyai/realtime/types/final_transcript.rb +72 -41
- 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 +62 -34
- 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 +21 -12
- data/lib/assemblyai/realtime/types/realtime_transcript.rb +15 -9
- data/lib/assemblyai/realtime/types/session_begins.rb +31 -14
- data/lib/assemblyai/realtime/types/session_information.rb +69 -0
- data/lib/assemblyai/realtime/types/session_terminated.rb +20 -11
- data/lib/assemblyai/realtime/types/terminate_session.rb +21 -12
- data/lib/assemblyai/realtime/types/word.rb +36 -18
- data/lib/assemblyai/streaming/types/receive_message.rb +113 -0
- data/lib/assemblyai/streaming/types/send_message.rb +86 -0
- data/lib/assemblyai/streaming/types/streaming.rb +11 -0
- data/lib/assemblyai/transcripts/client.rb +54 -20
- 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/page_details.rb +60 -33
- 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 +62 -35
- data/lib/assemblyai/transcripts/types/severity_score_summary.rb +32 -16
- data/lib/assemblyai/transcripts/types/speech_model.rb +2 -0
- data/lib/assemblyai/transcripts/types/substitution_policy.rb +4 -2
- data/lib/assemblyai/transcripts/types/timestamp.rb +28 -14
- data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +39 -19
- 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 +512 -293
- data/lib/assemblyai/transcripts/types/transcript_custom_spelling.rb +30 -15
- data/lib/assemblyai/transcripts/types/transcript_language_code.rb +3 -2
- data/lib/assemblyai/transcripts/types/transcript_list.rb +33 -16
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +63 -30
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +334 -191
- data/lib/assemblyai/transcripts/types/transcript_paragraph.rb +61 -33
- data/lib/assemblyai/transcripts/types/transcript_ready_notification.rb +30 -16
- data/lib/assemblyai/transcripts/types/transcript_sentence.rb +61 -33
- data/lib/assemblyai/transcripts/types/transcript_status.rb +2 -1
- data/lib/assemblyai/transcripts/types/transcript_utterance.rb +55 -31
- 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 +9 -8
- metadata +6 -5
- data/lib/assemblyai/realtime/types/audio_data.rb +0 -7
- data/lib/assemblyai/realtime/types/receive_message.rb +0 -87
- data/lib/assemblyai/realtime/types/send_message.rb +0 -74
@@ -1,46 +1,61 @@
|
|
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
|
-
# Object containing words or phrases to replace, and the word or phrase to replace
|
8
|
+
# Object containing words or phrases to replace, and the word or phrase to replace
|
9
|
+
# with
|
8
10
|
class TranscriptCustomSpelling
|
9
|
-
|
11
|
+
# @return [Array<String>] Words or phrases to replace
|
12
|
+
attr_reader :from
|
13
|
+
# @return [String] Word or phrase to replace with
|
14
|
+
attr_reader :to
|
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
|
10
22
|
|
11
23
|
# @param from [Array<String>] Words or phrases to replace
|
12
24
|
# @param to [String] Word or phrase to replace with
|
13
25
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
-
# @return [Transcripts::TranscriptCustomSpelling]
|
26
|
+
# @return [AssemblyAI::Transcripts::TranscriptCustomSpelling]
|
15
27
|
def initialize(from:, to:, additional_properties: nil)
|
16
|
-
# @type [Array<String>] Words or phrases to replace
|
17
28
|
@from = from
|
18
|
-
# @type [String] Word or phrase to replace with
|
19
29
|
@to = to
|
20
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
21
30
|
@additional_properties = additional_properties
|
31
|
+
@_field_set = { "from": from, "to": to }
|
22
32
|
end
|
23
33
|
|
24
34
|
# Deserialize a JSON object to an instance of TranscriptCustomSpelling
|
25
35
|
#
|
26
|
-
# @param json_object [
|
27
|
-
# @return [Transcripts::TranscriptCustomSpelling]
|
36
|
+
# @param json_object [String]
|
37
|
+
# @return [AssemblyAI::Transcripts::TranscriptCustomSpelling]
|
28
38
|
def self.from_json(json_object:)
|
29
39
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
from = struct["from"]
|
41
|
+
to = struct["to"]
|
42
|
+
new(
|
43
|
+
from: from,
|
44
|
+
to: to,
|
45
|
+
additional_properties: struct
|
46
|
+
)
|
34
47
|
end
|
35
48
|
|
36
49
|
# Serialize an instance of TranscriptCustomSpelling to a JSON object
|
37
50
|
#
|
38
|
-
# @return [
|
51
|
+
# @return [String]
|
39
52
|
def to_json(*_args)
|
40
|
-
|
53
|
+
@_field_set&.to_json
|
41
54
|
end
|
42
55
|
|
43
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
56
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
57
|
+
# hash and check each fields type against the current object's property
|
58
|
+
# definitions.
|
44
59
|
#
|
45
60
|
# @param obj [Object]
|
46
61
|
# @return [Void]
|
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
class Transcripts
|
5
|
-
# The language of your audio file. Possible values are found in [Supported
|
6
|
-
#
|
5
|
+
# The language of your audio file. Possible values are found in [Supported
|
6
|
+
# Languages](https://www.assemblyai.com/docs/concepts/supported-languages).
|
7
|
+
# The default value is 'en_us'.
|
7
8
|
class TranscriptLanguageCode
|
8
9
|
EN = "en"
|
9
10
|
EN_AU = "en_au"
|
@@ -2,30 +2,41 @@
|
|
2
2
|
|
3
3
|
require_relative "page_details"
|
4
4
|
require_relative "transcript_list_item"
|
5
|
+
require "ostruct"
|
5
6
|
require "json"
|
6
7
|
|
7
8
|
module AssemblyAI
|
8
9
|
class Transcripts
|
10
|
+
# A list of transcripts. Transcripts are sorted from newest to oldest. The
|
11
|
+
# previous URL always points to a page with older transcripts.
|
9
12
|
class TranscriptList
|
10
|
-
|
13
|
+
# @return [AssemblyAI::Transcripts::PageDetails]
|
14
|
+
attr_reader :page_details
|
15
|
+
# @return [Array<AssemblyAI::Transcripts::TranscriptListItem>]
|
16
|
+
attr_reader :transcripts
|
17
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
attr_reader :additional_properties
|
19
|
+
# @return [Object]
|
20
|
+
attr_reader :_field_set
|
21
|
+
protected :_field_set
|
11
22
|
|
12
|
-
|
13
|
-
|
23
|
+
OMIT = Object.new
|
24
|
+
|
25
|
+
# @param page_details [AssemblyAI::Transcripts::PageDetails]
|
26
|
+
# @param transcripts [Array<AssemblyAI::Transcripts::TranscriptListItem>]
|
14
27
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
-
# @return [Transcripts::TranscriptList]
|
28
|
+
# @return [AssemblyAI::Transcripts::TranscriptList]
|
16
29
|
def initialize(page_details:, transcripts:, additional_properties: nil)
|
17
|
-
# @type [Transcripts::PageDetails]
|
18
30
|
@page_details = page_details
|
19
|
-
# @type [Array<Transcripts::TranscriptListItem>]
|
20
31
|
@transcripts = transcripts
|
21
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
22
32
|
@additional_properties = additional_properties
|
33
|
+
@_field_set = { "page_details": page_details, "transcripts": transcripts }
|
23
34
|
end
|
24
35
|
|
25
36
|
# Deserialize a JSON object to an instance of TranscriptList
|
26
37
|
#
|
27
|
-
# @param json_object [
|
28
|
-
# @return [Transcripts::TranscriptList]
|
38
|
+
# @param json_object [String]
|
39
|
+
# @return [AssemblyAI::Transcripts::TranscriptList]
|
29
40
|
def self.from_json(json_object:)
|
30
41
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
42
|
parsed_json = JSON.parse(json_object)
|
@@ -33,28 +44,34 @@ module AssemblyAI
|
|
33
44
|
page_details = nil
|
34
45
|
else
|
35
46
|
page_details = parsed_json["page_details"].to_json
|
36
|
-
page_details = Transcripts::PageDetails.from_json(json_object: page_details)
|
47
|
+
page_details = AssemblyAI::Transcripts::PageDetails.from_json(json_object: page_details)
|
37
48
|
end
|
38
49
|
transcripts = parsed_json["transcripts"]&.map do |v|
|
39
50
|
v = v.to_json
|
40
|
-
Transcripts::TranscriptListItem.from_json(json_object: v)
|
51
|
+
AssemblyAI::Transcripts::TranscriptListItem.from_json(json_object: v)
|
41
52
|
end
|
42
|
-
new(
|
53
|
+
new(
|
54
|
+
page_details: page_details,
|
55
|
+
transcripts: transcripts,
|
56
|
+
additional_properties: struct
|
57
|
+
)
|
43
58
|
end
|
44
59
|
|
45
60
|
# Serialize an instance of TranscriptList to a JSON object
|
46
61
|
#
|
47
|
-
# @return [
|
62
|
+
# @return [String]
|
48
63
|
def to_json(*_args)
|
49
|
-
|
64
|
+
@_field_set&.to_json
|
50
65
|
end
|
51
66
|
|
52
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
67
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
68
|
+
# hash and check each fields type against the current object's property
|
69
|
+
# definitions.
|
53
70
|
#
|
54
71
|
# @param obj [Object]
|
55
72
|
# @return [Void]
|
56
73
|
def self.validate_raw(obj:)
|
57
|
-
Transcripts::PageDetails.validate_raw(obj: obj.page_details)
|
74
|
+
AssemblyAI::Transcripts::PageDetails.validate_raw(obj: obj.page_details)
|
58
75
|
obj.transcripts.is_a?(Array) != false || raise("Passed value for field obj.transcripts is not the expected type, validation failed.")
|
59
76
|
end
|
60
77
|
end
|
@@ -2,80 +2,113 @@
|
|
2
2
|
|
3
3
|
require_relative "transcript_status"
|
4
4
|
require "date"
|
5
|
+
require "ostruct"
|
5
6
|
require "json"
|
6
7
|
|
7
8
|
module AssemblyAI
|
8
9
|
class Transcripts
|
9
10
|
class TranscriptListItem
|
10
|
-
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :id
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :resource_url
|
15
|
+
# @return [AssemblyAI::Transcripts::TranscriptStatus]
|
16
|
+
attr_reader :status
|
17
|
+
# @return [DateTime]
|
18
|
+
attr_reader :created
|
19
|
+
# @return [DateTime]
|
20
|
+
attr_reader :completed
|
21
|
+
# @return [String]
|
22
|
+
attr_reader :audio_url
|
23
|
+
# @return [String] Error message of why the transcript failed
|
24
|
+
attr_reader :error
|
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 id [String]
|
13
34
|
# @param resource_url [String]
|
14
|
-
# @param status [Transcripts::TranscriptStatus]
|
35
|
+
# @param status [AssemblyAI::Transcripts::TranscriptStatus]
|
15
36
|
# @param created [DateTime]
|
16
37
|
# @param completed [DateTime]
|
17
38
|
# @param audio_url [String]
|
39
|
+
# @param error [String] Error message of why the transcript failed
|
18
40
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
-
# @return [Transcripts::TranscriptListItem]
|
20
|
-
def initialize(id:, resource_url:, status:, created:, completed:, audio_url:,
|
21
|
-
|
41
|
+
# @return [AssemblyAI::Transcripts::TranscriptListItem]
|
42
|
+
def initialize(id:, resource_url:, status:, created:, completed:, audio_url:, error: OMIT,
|
43
|
+
additional_properties: nil)
|
22
44
|
@id = id
|
23
|
-
# @type [String]
|
24
45
|
@resource_url = resource_url
|
25
|
-
# @type [Transcripts::TranscriptStatus]
|
26
46
|
@status = status
|
27
|
-
# @type [DateTime]
|
28
47
|
@created = created
|
29
|
-
# @type [DateTime]
|
30
48
|
@completed = completed
|
31
|
-
# @type [String]
|
32
49
|
@audio_url = audio_url
|
33
|
-
|
50
|
+
@error = error if error != OMIT
|
34
51
|
@additional_properties = additional_properties
|
52
|
+
@_field_set = {
|
53
|
+
"id": id,
|
54
|
+
"resource_url": resource_url,
|
55
|
+
"status": status,
|
56
|
+
"created": created,
|
57
|
+
"completed": completed,
|
58
|
+
"audio_url": audio_url,
|
59
|
+
"error": error
|
60
|
+
}.reject do |_k, v|
|
61
|
+
v == OMIT
|
62
|
+
end
|
35
63
|
end
|
36
64
|
|
37
65
|
# Deserialize a JSON object to an instance of TranscriptListItem
|
38
66
|
#
|
39
|
-
# @param json_object [
|
40
|
-
# @return [Transcripts::TranscriptListItem]
|
67
|
+
# @param json_object [String]
|
68
|
+
# @return [AssemblyAI::Transcripts::TranscriptListItem]
|
41
69
|
def self.from_json(json_object:)
|
42
70
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
71
|
parsed_json = JSON.parse(json_object)
|
44
|
-
id = struct
|
45
|
-
resource_url = struct
|
46
|
-
status = struct
|
72
|
+
id = struct["id"]
|
73
|
+
resource_url = struct["resource_url"]
|
74
|
+
status = struct["status"]
|
47
75
|
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
48
76
|
completed = (DateTime.parse(parsed_json["completed"]) unless parsed_json["completed"].nil?)
|
49
|
-
audio_url = struct
|
50
|
-
|
51
|
-
|
77
|
+
audio_url = struct["audio_url"]
|
78
|
+
error = struct["error"]
|
79
|
+
new(
|
80
|
+
id: id,
|
81
|
+
resource_url: resource_url,
|
82
|
+
status: status,
|
83
|
+
created: created,
|
84
|
+
completed: completed,
|
85
|
+
audio_url: audio_url,
|
86
|
+
error: error,
|
87
|
+
additional_properties: struct
|
88
|
+
)
|
52
89
|
end
|
53
90
|
|
54
91
|
# Serialize an instance of TranscriptListItem to a JSON object
|
55
92
|
#
|
56
|
-
# @return [
|
93
|
+
# @return [String]
|
57
94
|
def to_json(*_args)
|
58
|
-
|
59
|
-
"id": @id,
|
60
|
-
"resource_url": @resource_url,
|
61
|
-
"status": @status,
|
62
|
-
"created": @created,
|
63
|
-
"completed": @completed,
|
64
|
-
"audio_url": @audio_url
|
65
|
-
}.to_json
|
95
|
+
@_field_set&.to_json
|
66
96
|
end
|
67
97
|
|
68
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
98
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
99
|
+
# hash and check each fields type against the current object's property
|
100
|
+
# definitions.
|
69
101
|
#
|
70
102
|
# @param obj [Object]
|
71
103
|
# @return [Void]
|
72
104
|
def self.validate_raw(obj:)
|
73
105
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
74
106
|
obj.resource_url.is_a?(String) != false || raise("Passed value for field obj.resource_url is not the expected type, validation failed.")
|
75
|
-
obj.status.is_a?(Transcripts::TranscriptStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
107
|
+
obj.status.is_a?(AssemblyAI::Transcripts::TranscriptStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
76
108
|
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
77
109
|
obj.completed.is_a?(DateTime) != false || raise("Passed value for field obj.completed is not the expected type, validation failed.")
|
78
110
|
obj.audio_url.is_a?(String) != false || raise("Passed value for field obj.audio_url is not the expected type, validation failed.")
|
111
|
+
obj.error&.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
|
79
112
|
end
|
80
113
|
end
|
81
114
|
end
|