assemblyai 1.0.0.pre.beta.7 → 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 +30 -14
- 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 +20 -11
- 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 +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/page_details.rb +59 -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 +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 -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 -17
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +60 -34
- 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 +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
@@ -2,60 +2,80 @@
|
|
2
2
|
|
3
3
|
require_relative "audio_intelligence_model_status"
|
4
4
|
require_relative "topic_detection_result"
|
5
|
+
require "ostruct"
|
5
6
|
require "json"
|
6
7
|
|
7
8
|
module AssemblyAI
|
8
9
|
class Transcripts
|
9
10
|
# The result of the Topic Detection model, if it is enabled.
|
10
|
-
#
|
11
|
+
# See [Topic Detection](https://www.assemblyai.com/docs/models/topic-detection)
|
12
|
+
# for more information.
|
11
13
|
class TopicDetectionModelResult
|
12
|
-
|
14
|
+
# @return [AssemblyAI::Transcripts::AudioIntelligenceModelStatus] The status of the Topic Detection model. Either success, or unavailable in the
|
15
|
+
# rare case that the model failed.
|
16
|
+
attr_reader :status
|
17
|
+
# @return [Array<AssemblyAI::Transcripts::TopicDetectionResult>] An array of results for the Topic Detection model
|
18
|
+
attr_reader :results
|
19
|
+
# @return [Hash{String => Float}] The overall relevance of topic to the entire audio file
|
20
|
+
attr_reader :summary
|
21
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
22
|
+
attr_reader :additional_properties
|
23
|
+
# @return [Object]
|
24
|
+
attr_reader :_field_set
|
25
|
+
protected :_field_set
|
13
26
|
|
14
|
-
|
15
|
-
|
27
|
+
OMIT = Object.new
|
28
|
+
|
29
|
+
# @param status [AssemblyAI::Transcripts::AudioIntelligenceModelStatus] The status of the Topic Detection model. Either success, or unavailable in the
|
30
|
+
# rare case that the model failed.
|
31
|
+
# @param results [Array<AssemblyAI::Transcripts::TopicDetectionResult>] An array of results for the Topic Detection model
|
16
32
|
# @param summary [Hash{String => Float}] The overall relevance of topic to the entire audio file
|
17
33
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
-
# @return [Transcripts::TopicDetectionModelResult]
|
34
|
+
# @return [AssemblyAI::Transcripts::TopicDetectionModelResult]
|
19
35
|
def initialize(status:, results:, summary:, additional_properties: nil)
|
20
|
-
# @type [Transcripts::AudioIntelligenceModelStatus] The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed.
|
21
36
|
@status = status
|
22
|
-
# @type [Array<Transcripts::TopicDetectionResult>] An array of results for the Topic Detection model
|
23
37
|
@results = results
|
24
|
-
# @type [Hash{String => Float}] The overall relevance of topic to the entire audio file
|
25
38
|
@summary = summary
|
26
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
27
39
|
@additional_properties = additional_properties
|
40
|
+
@_field_set = { "status": status, "results": results, "summary": summary }
|
28
41
|
end
|
29
42
|
|
30
43
|
# Deserialize a JSON object to an instance of TopicDetectionModelResult
|
31
44
|
#
|
32
|
-
# @param json_object [
|
33
|
-
# @return [Transcripts::TopicDetectionModelResult]
|
45
|
+
# @param json_object [String]
|
46
|
+
# @return [AssemblyAI::Transcripts::TopicDetectionModelResult]
|
34
47
|
def self.from_json(json_object:)
|
35
48
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
36
49
|
parsed_json = JSON.parse(json_object)
|
37
|
-
status = struct
|
50
|
+
status = struct["status"]
|
38
51
|
results = parsed_json["results"]&.map do |v|
|
39
52
|
v = v.to_json
|
40
|
-
Transcripts::TopicDetectionResult.from_json(json_object: v)
|
53
|
+
AssemblyAI::Transcripts::TopicDetectionResult.from_json(json_object: v)
|
41
54
|
end
|
42
|
-
summary = struct
|
43
|
-
new(
|
55
|
+
summary = struct["summary"]
|
56
|
+
new(
|
57
|
+
status: status,
|
58
|
+
results: results,
|
59
|
+
summary: summary,
|
60
|
+
additional_properties: struct
|
61
|
+
)
|
44
62
|
end
|
45
63
|
|
46
64
|
# Serialize an instance of TopicDetectionModelResult to a JSON object
|
47
65
|
#
|
48
|
-
# @return [
|
66
|
+
# @return [String]
|
49
67
|
def to_json(*_args)
|
50
|
-
|
68
|
+
@_field_set&.to_json
|
51
69
|
end
|
52
70
|
|
53
|
-
# 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.
|
54
74
|
#
|
55
75
|
# @param obj [Object]
|
56
76
|
# @return [Void]
|
57
77
|
def self.validate_raw(obj:)
|
58
|
-
obj.status.is_a?(Transcripts::AudioIntelligenceModelStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
78
|
+
obj.status.is_a?(AssemblyAI::Transcripts::AudioIntelligenceModelStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
59
79
|
obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
60
80
|
obj.summary.is_a?(Hash) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.")
|
61
81
|
end
|
@@ -2,66 +2,85 @@
|
|
2
2
|
|
3
3
|
require_relative "topic_detection_result_labels_item"
|
4
4
|
require_relative "timestamp"
|
5
|
+
require "ostruct"
|
5
6
|
require "json"
|
6
7
|
|
7
8
|
module AssemblyAI
|
8
9
|
class Transcripts
|
9
10
|
# The result of the topic detection model
|
10
11
|
class TopicDetectionResult
|
11
|
-
|
12
|
+
# @return [String] The text in the transcript in which a detected topic occurs
|
13
|
+
attr_reader :text
|
14
|
+
# @return [Array<AssemblyAI::Transcripts::TopicDetectionResultLabelsItem>]
|
15
|
+
attr_reader :labels
|
16
|
+
# @return [AssemblyAI::Transcripts::Timestamp]
|
17
|
+
attr_reader :timestamp
|
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
|
12
25
|
|
13
26
|
# @param text [String] The text in the transcript in which a detected topic occurs
|
14
|
-
# @param labels [Array<Transcripts::TopicDetectionResultLabelsItem>]
|
15
|
-
# @param timestamp [Transcripts::Timestamp]
|
27
|
+
# @param labels [Array<AssemblyAI::Transcripts::TopicDetectionResultLabelsItem>]
|
28
|
+
# @param timestamp [AssemblyAI::Transcripts::Timestamp]
|
16
29
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
-
# @return [Transcripts::TopicDetectionResult]
|
18
|
-
def initialize(text:, labels:
|
19
|
-
# @type [String] The text in the transcript in which a detected topic occurs
|
30
|
+
# @return [AssemblyAI::Transcripts::TopicDetectionResult]
|
31
|
+
def initialize(text:, labels: OMIT, timestamp: OMIT, additional_properties: nil)
|
20
32
|
@text = text
|
21
|
-
|
22
|
-
@
|
23
|
-
# @type [Transcripts::Timestamp]
|
24
|
-
@timestamp = timestamp
|
25
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
33
|
+
@labels = labels if labels != OMIT
|
34
|
+
@timestamp = timestamp if timestamp != OMIT
|
26
35
|
@additional_properties = additional_properties
|
36
|
+
@_field_set = { "text": text, "labels": labels, "timestamp": timestamp }.reject do |_k, v|
|
37
|
+
v == OMIT
|
38
|
+
end
|
27
39
|
end
|
28
40
|
|
29
41
|
# Deserialize a JSON object to an instance of TopicDetectionResult
|
30
42
|
#
|
31
|
-
# @param json_object [
|
32
|
-
# @return [Transcripts::TopicDetectionResult]
|
43
|
+
# @param json_object [String]
|
44
|
+
# @return [AssemblyAI::Transcripts::TopicDetectionResult]
|
33
45
|
def self.from_json(json_object:)
|
34
46
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
47
|
parsed_json = JSON.parse(json_object)
|
36
|
-
text = struct
|
48
|
+
text = struct["text"]
|
37
49
|
labels = parsed_json["labels"]&.map do |v|
|
38
50
|
v = v.to_json
|
39
|
-
Transcripts::TopicDetectionResultLabelsItem.from_json(json_object: v)
|
51
|
+
AssemblyAI::Transcripts::TopicDetectionResultLabelsItem.from_json(json_object: v)
|
40
52
|
end
|
41
53
|
if parsed_json["timestamp"].nil?
|
42
54
|
timestamp = nil
|
43
55
|
else
|
44
56
|
timestamp = parsed_json["timestamp"].to_json
|
45
|
-
timestamp = Transcripts::Timestamp.from_json(json_object: timestamp)
|
57
|
+
timestamp = AssemblyAI::Transcripts::Timestamp.from_json(json_object: timestamp)
|
46
58
|
end
|
47
|
-
new(
|
59
|
+
new(
|
60
|
+
text: text,
|
61
|
+
labels: labels,
|
62
|
+
timestamp: timestamp,
|
63
|
+
additional_properties: struct
|
64
|
+
)
|
48
65
|
end
|
49
66
|
|
50
67
|
# Serialize an instance of TopicDetectionResult to a JSON object
|
51
68
|
#
|
52
|
-
# @return [
|
69
|
+
# @return [String]
|
53
70
|
def to_json(*_args)
|
54
|
-
|
71
|
+
@_field_set&.to_json
|
55
72
|
end
|
56
73
|
|
57
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
74
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
75
|
+
# hash and check each fields type against the current object's property
|
76
|
+
# definitions.
|
58
77
|
#
|
59
78
|
# @param obj [Object]
|
60
79
|
# @return [Void]
|
61
80
|
def self.validate_raw(obj:)
|
62
81
|
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
63
82
|
obj.labels&.is_a?(Array) != false || raise("Passed value for field obj.labels is not the expected type, validation failed.")
|
64
|
-
obj.timestamp.nil? || Transcripts::Timestamp.validate_raw(obj: obj.timestamp)
|
83
|
+
obj.timestamp.nil? || AssemblyAI::Transcripts::Timestamp.validate_raw(obj: obj.timestamp)
|
65
84
|
end
|
66
85
|
end
|
67
86
|
end
|
@@ -1,45 +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
8
|
class TopicDetectionResultLabelsItem
|
8
|
-
|
9
|
+
# @return [Float] How relevant the detected topic is of a detected topic
|
10
|
+
attr_reader :relevance
|
11
|
+
# @return [String] The IAB taxonomical label for the label of the detected topic, where > denotes
|
12
|
+
# supertopic/subtopic relationship
|
13
|
+
attr_reader :label
|
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
|
9
21
|
|
10
22
|
# @param relevance [Float] How relevant the detected topic is of a detected topic
|
11
|
-
# @param label [String] The IAB taxonomical label for the label of the detected topic, where > denotes
|
23
|
+
# @param label [String] The IAB taxonomical label for the label of the detected topic, where > denotes
|
24
|
+
# supertopic/subtopic relationship
|
12
25
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
-
# @return [Transcripts::TopicDetectionResultLabelsItem]
|
26
|
+
# @return [AssemblyAI::Transcripts::TopicDetectionResultLabelsItem]
|
14
27
|
def initialize(relevance:, label:, additional_properties: nil)
|
15
|
-
# @type [Float] How relevant the detected topic is of a detected topic
|
16
28
|
@relevance = relevance
|
17
|
-
# @type [String] The IAB taxonomical label for the label of the detected topic, where > denotes supertopic/subtopic relationship
|
18
29
|
@label = label
|
19
|
-
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
20
30
|
@additional_properties = additional_properties
|
31
|
+
@_field_set = { "relevance": relevance, "label": label }
|
21
32
|
end
|
22
33
|
|
23
34
|
# Deserialize a JSON object to an instance of TopicDetectionResultLabelsItem
|
24
35
|
#
|
25
|
-
# @param json_object [
|
26
|
-
# @return [Transcripts::TopicDetectionResultLabelsItem]
|
36
|
+
# @param json_object [String]
|
37
|
+
# @return [AssemblyAI::Transcripts::TopicDetectionResultLabelsItem]
|
27
38
|
def self.from_json(json_object:)
|
28
39
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
40
|
+
relevance = struct["relevance"]
|
41
|
+
label = struct["label"]
|
42
|
+
new(
|
43
|
+
relevance: relevance,
|
44
|
+
label: label,
|
45
|
+
additional_properties: struct
|
46
|
+
)
|
33
47
|
end
|
34
48
|
|
35
49
|
# Serialize an instance of TopicDetectionResultLabelsItem to a JSON object
|
36
50
|
#
|
37
|
-
# @return [
|
51
|
+
# @return [String]
|
38
52
|
def to_json(*_args)
|
39
|
-
|
53
|
+
@_field_set&.to_json
|
40
54
|
end
|
41
55
|
|
42
|
-
# 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.
|
43
59
|
#
|
44
60
|
# @param obj [Object]
|
45
61
|
# @return [Void]
|