assemblyai 1.0.0.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/assemblyai/files/client.rb +63 -0
- data/lib/assemblyai/files/types/uploaded_file.rb +47 -0
- data/lib/assemblyai/lemur/client.rb +390 -0
- data/lib/assemblyai/lemur/types/lemur_action_items_response.rb +52 -0
- data/lib/assemblyai/lemur/types/lemur_base_params.rb +99 -0
- data/lib/assemblyai/lemur/types/lemur_base_params_context.rb +75 -0
- data/lib/assemblyai/lemur/types/lemur_base_response.rb +47 -0
- data/lib/assemblyai/lemur/types/lemur_model.rb +13 -0
- data/lib/assemblyai/lemur/types/lemur_question.rb +74 -0
- data/lib/assemblyai/lemur/types/lemur_question_answer.rb +53 -0
- data/lib/assemblyai/lemur/types/lemur_question_answer_response.rb +56 -0
- data/lib/assemblyai/lemur/types/lemur_question_context.rb +75 -0
- data/lib/assemblyai/lemur/types/lemur_summary_response.rb +52 -0
- data/lib/assemblyai/lemur/types/lemur_task_response.rb +52 -0
- data/lib/assemblyai/lemur/types/purge_lemur_request_data_response.rb +58 -0
- data/lib/assemblyai/realtime/client.rb +61 -0
- data/lib/assemblyai/realtime/types/audio_data.rb +7 -0
- data/lib/assemblyai/realtime/types/audio_encoding.rb +8 -0
- data/lib/assemblyai/realtime/types/final_transcript.rb +107 -0
- data/lib/assemblyai/realtime/types/message_type.rb +13 -0
- data/lib/assemblyai/realtime/types/partial_transcript.rb +94 -0
- data/lib/assemblyai/realtime/types/realtime_base_message.rb +48 -0
- data/lib/assemblyai/realtime/types/realtime_base_transcript.rb +87 -0
- data/lib/assemblyai/realtime/types/realtime_error.rb +47 -0
- data/lib/assemblyai/realtime/types/realtime_message.rb +115 -0
- data/lib/assemblyai/realtime/types/realtime_temporary_token_response.rb +47 -0
- data/lib/assemblyai/realtime/types/realtime_transcript.rb +76 -0
- data/lib/assemblyai/realtime/types/realtime_transcript_type.rb +8 -0
- data/lib/assemblyai/realtime/types/session_begins.rb +58 -0
- data/lib/assemblyai/realtime/types/session_terminated.rb +47 -0
- data/lib/assemblyai/realtime/types/terminate_session.rb +56 -0
- data/lib/assemblyai/realtime/types/word.rb +62 -0
- data/lib/assemblyai/transcripts/client.rb +525 -0
- data/lib/assemblyai/transcripts/polling_client.rb +173 -0
- data/lib/assemblyai/transcripts/types/audio_intelligence_model_status.rb +8 -0
- data/lib/assemblyai/transcripts/types/auto_highlight_result.rb +66 -0
- data/lib/assemblyai/transcripts/types/auto_highlights_result.rb +53 -0
- data/lib/assemblyai/transcripts/types/chapter.rb +68 -0
- data/lib/assemblyai/transcripts/types/content_safety_label.rb +57 -0
- data/lib/assemblyai/transcripts/types/content_safety_label_result.rb +84 -0
- data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +75 -0
- data/lib/assemblyai/transcripts/types/entity.rb +69 -0
- data/lib/assemblyai/transcripts/types/entity_type.rb +38 -0
- data/lib/assemblyai/transcripts/types/page_details.rb +74 -0
- data/lib/assemblyai/transcripts/types/paragraphs_response.rb +67 -0
- data/lib/assemblyai/transcripts/types/pii_policy.rb +36 -0
- data/lib/assemblyai/transcripts/types/polling_options.rb +21 -0
- data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +8 -0
- data/lib/assemblyai/transcripts/types/redacted_audio_response.rb +53 -0
- data/lib/assemblyai/transcripts/types/redacted_audio_status.rb +7 -0
- data/lib/assemblyai/transcripts/types/sentences_response.rb +67 -0
- data/lib/assemblyai/transcripts/types/sentiment.rb +8 -0
- data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +82 -0
- data/lib/assemblyai/transcripts/types/severity_score_summary.rb +57 -0
- data/lib/assemblyai/transcripts/types/speech_model.rb +7 -0
- data/lib/assemblyai/transcripts/types/substitution_policy.rb +8 -0
- data/lib/assemblyai/transcripts/types/subtitle_format.rb +8 -0
- data/lib/assemblyai/transcripts/types/summary_model.rb +8 -0
- data/lib/assemblyai/transcripts/types/summary_type.rb +14 -0
- data/lib/assemblyai/transcripts/types/timestamp.rb +53 -0
- data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +68 -0
- data/lib/assemblyai/transcripts/types/topic_detection_result.rb +68 -0
- data/lib/assemblyai/transcripts/types/topic_detection_result_labels_item.rb +52 -0
- data/lib/assemblyai/transcripts/types/transcript.rb +454 -0
- data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +8 -0
- data/lib/assemblyai/transcripts/types/transcript_custom_spelling.rb +53 -0
- data/lib/assemblyai/transcripts/types/transcript_language_code.rb +29 -0
- data/lib/assemblyai/transcripts/types/transcript_list.rb +62 -0
- data/lib/assemblyai/transcripts/types/transcript_list_item.rb +82 -0
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +280 -0
- data/lib/assemblyai/transcripts/types/transcript_paragraph.rb +84 -0
- data/lib/assemblyai/transcripts/types/transcript_sentence.rb +84 -0
- data/lib/assemblyai/transcripts/types/transcript_status.rb +8 -0
- data/lib/assemblyai/transcripts/types/transcript_utterance.rb +84 -0
- data/lib/assemblyai/transcripts/types/transcript_word.rb +68 -0
- data/lib/assemblyai/transcripts/types/word_search_match.rb +63 -0
- data/lib/assemblyai/transcripts/types/word_search_response.rb +61 -0
- data/lib/assemblyai/transcripts/types/word_search_timestamp.rb +7 -0
- data/lib/assemblyai/types/error.rb +50 -0
- data/lib/assemblyai.rb +48 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +87 -0
- data/lib/types_export.rb +75 -0
- metadata +170 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module AssemblyAI
|
7
|
+
class Realtime
|
8
|
+
class SessionBegins
|
9
|
+
attr_reader :message_type, :session_id, :expires_at, :additional_properties
|
10
|
+
|
11
|
+
# @param message_type [String]
|
12
|
+
# @param session_id [String] Unique identifier for the established session
|
13
|
+
# @param expires_at [DateTime] Timestamp when this session will expire
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [Realtime::SessionBegins]
|
16
|
+
def initialize(message_type:, session_id:, expires_at:, additional_properties: nil)
|
17
|
+
# @type [String]
|
18
|
+
@message_type = message_type
|
19
|
+
# @type [String] Unique identifier for the established session
|
20
|
+
@session_id = session_id
|
21
|
+
# @type [DateTime] Timestamp when this session will expire
|
22
|
+
@expires_at = expires_at
|
23
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
@additional_properties = additional_properties
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of SessionBegins
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [Realtime::SessionBegins]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
parsed_json = JSON.parse(json_object)
|
34
|
+
message_type = struct.message_type
|
35
|
+
session_id = struct.session_id
|
36
|
+
expires_at = (DateTime.parse(parsed_json["expires_at"]) unless parsed_json["expires_at"].nil?)
|
37
|
+
new(message_type: message_type, session_id: session_id, expires_at: expires_at, additional_properties: struct)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Serialize an instance of SessionBegins to a JSON object
|
41
|
+
#
|
42
|
+
# @return [JSON]
|
43
|
+
def to_json(*_args)
|
44
|
+
{ "message_type": @message_type, "session_id": @session_id, "expires_at": @expires_at }.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
# 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.
|
48
|
+
#
|
49
|
+
# @param obj [Object]
|
50
|
+
# @return [Void]
|
51
|
+
def self.validate_raw(obj:)
|
52
|
+
obj.message_type.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
|
53
|
+
obj.session_id.is_a?(String) != false || raise("Passed value for field obj.session_id is not the expected type, validation failed.")
|
54
|
+
obj.expires_at.is_a?(DateTime) != false || raise("Passed value for field obj.expires_at is not the expected type, validation failed.")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module AssemblyAI
|
6
|
+
class Realtime
|
7
|
+
class SessionTerminated
|
8
|
+
attr_reader :message_type, :additional_properties
|
9
|
+
|
10
|
+
# @param message_type [String]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [Realtime::SessionTerminated]
|
13
|
+
def initialize(message_type:, additional_properties: nil)
|
14
|
+
# @type [String]
|
15
|
+
@message_type = message_type
|
16
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
@additional_properties = additional_properties
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserialize a JSON object to an instance of SessionTerminated
|
21
|
+
#
|
22
|
+
# @param json_object [JSON]
|
23
|
+
# @return [Realtime::SessionTerminated]
|
24
|
+
def self.from_json(json_object:)
|
25
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
+
JSON.parse(json_object)
|
27
|
+
message_type = struct.message_type
|
28
|
+
new(message_type: message_type, additional_properties: struct)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Serialize an instance of SessionTerminated to a JSON object
|
32
|
+
#
|
33
|
+
# @return [JSON]
|
34
|
+
def to_json(*_args)
|
35
|
+
{ "message_type": @message_type }.to_json
|
36
|
+
end
|
37
|
+
|
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.
|
39
|
+
#
|
40
|
+
# @param obj [Object]
|
41
|
+
# @return [Void]
|
42
|
+
def self.validate_raw(obj:)
|
43
|
+
obj.message_type.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "message_type"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module AssemblyAI
|
7
|
+
class Realtime
|
8
|
+
class TerminateSession
|
9
|
+
attr_reader :terminate_session, :message_type, :additional_properties
|
10
|
+
|
11
|
+
# @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
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [Realtime::TerminateSession]
|
15
|
+
def initialize(terminate_session:, message_type:, additional_properties: nil)
|
16
|
+
# @type [Boolean] Set to true to end your real-time session forever
|
17
|
+
@terminate_session = terminate_session
|
18
|
+
# @type [MESSAGE_TYPE] Describes the type of the message
|
19
|
+
@message_type = message_type
|
20
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
@additional_properties = additional_properties
|
22
|
+
end
|
23
|
+
|
24
|
+
# Deserialize a JSON object to an instance of TerminateSession
|
25
|
+
#
|
26
|
+
# @param json_object [JSON]
|
27
|
+
# @return [Realtime::TerminateSession]
|
28
|
+
def self.from_json(json_object:)
|
29
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
+
parsed_json = JSON.parse(json_object)
|
31
|
+
terminate_session = struct.terminate_session
|
32
|
+
message_type = Realtime::MESSAGE_TYPE.key(parsed_json["message_type"]) || parsed_json["message_type"]
|
33
|
+
new(terminate_session: terminate_session, message_type: message_type, additional_properties: struct)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Serialize an instance of TerminateSession to a JSON object
|
37
|
+
#
|
38
|
+
# @return [JSON]
|
39
|
+
def to_json(*_args)
|
40
|
+
{
|
41
|
+
"terminate_session": @terminate_session,
|
42
|
+
"message_type": Realtime::MESSAGE_TYPE[@message_type] || @message_type
|
43
|
+
}.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
# 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.
|
47
|
+
#
|
48
|
+
# @param obj [Object]
|
49
|
+
# @return [Void]
|
50
|
+
def self.validate_raw(obj:)
|
51
|
+
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
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module AssemblyAI
|
6
|
+
class Realtime
|
7
|
+
class Word
|
8
|
+
attr_reader :start, :end_, :confidence, :text, :additional_properties
|
9
|
+
|
10
|
+
# @param start [Integer] Start time of the word in milliseconds
|
11
|
+
# @param end_ [Integer] End time of the word in milliseconds
|
12
|
+
# @param confidence [Float] Confidence score of the word
|
13
|
+
# @param text [String] The word itself
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [Realtime::Word]
|
16
|
+
def initialize(start:, end_:, confidence:, text:, additional_properties: nil)
|
17
|
+
# @type [Integer] Start time of the word in milliseconds
|
18
|
+
@start = start
|
19
|
+
# @type [Integer] End time of the word in milliseconds
|
20
|
+
@end_ = end_
|
21
|
+
# @type [Float] Confidence score of the word
|
22
|
+
@confidence = confidence
|
23
|
+
# @type [String] The word itself
|
24
|
+
@text = text
|
25
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
@additional_properties = additional_properties
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of Word
|
30
|
+
#
|
31
|
+
# @param json_object [JSON]
|
32
|
+
# @return [Realtime::Word]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
JSON.parse(json_object)
|
36
|
+
start = struct.start
|
37
|
+
end_ = struct.end
|
38
|
+
confidence = struct.confidence
|
39
|
+
text = struct.text
|
40
|
+
new(start: start, end_: end_, confidence: confidence, text: text, additional_properties: struct)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Serialize an instance of Word to a JSON object
|
44
|
+
#
|
45
|
+
# @return [JSON]
|
46
|
+
def to_json(*_args)
|
47
|
+
{ "start": @start, "end": @end_, "confidence": @confidence, "text": @text }.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
# 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.
|
51
|
+
#
|
52
|
+
# @param obj [Object]
|
53
|
+
# @return [Void]
|
54
|
+
def self.validate_raw(obj:)
|
55
|
+
obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
56
|
+
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
57
|
+
obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
58
|
+
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|