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,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module AssemblyAI
|
6
|
+
class Transcripts
|
7
|
+
class TranscriptWord
|
8
|
+
attr_reader :confidence, :start, :end_, :text, :speaker, :additional_properties
|
9
|
+
|
10
|
+
# @param confidence [Float]
|
11
|
+
# @param start [Integer]
|
12
|
+
# @param end_ [Integer]
|
13
|
+
# @param text [String]
|
14
|
+
# @param speaker [String] The speaker of the sentence if [Speaker Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, else null
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [Transcripts::TranscriptWord]
|
17
|
+
def initialize(confidence:, start:, end_:, text:, speaker: nil, additional_properties: nil)
|
18
|
+
# @type [Float]
|
19
|
+
@confidence = confidence
|
20
|
+
# @type [Integer]
|
21
|
+
@start = start
|
22
|
+
# @type [Integer]
|
23
|
+
@end_ = end_
|
24
|
+
# @type [String]
|
25
|
+
@text = text
|
26
|
+
# @type [String] The speaker of the sentence if [Speaker Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is enabled, else null
|
27
|
+
@speaker = speaker
|
28
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
@additional_properties = additional_properties
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deserialize a JSON object to an instance of TranscriptWord
|
33
|
+
#
|
34
|
+
# @param json_object [JSON]
|
35
|
+
# @return [Transcripts::TranscriptWord]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
JSON.parse(json_object)
|
39
|
+
confidence = struct.confidence
|
40
|
+
start = struct.start
|
41
|
+
end_ = struct.end
|
42
|
+
text = struct.text
|
43
|
+
speaker = struct.speaker
|
44
|
+
new(confidence: confidence, start: start, end_: end_, text: text, speaker: speaker,
|
45
|
+
additional_properties: struct)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Serialize an instance of TranscriptWord to a JSON object
|
49
|
+
#
|
50
|
+
# @return [JSON]
|
51
|
+
def to_json(*_args)
|
52
|
+
{ "confidence": @confidence, "start": @start, "end": @end_, "text": @text, "speaker": @speaker }.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# 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.
|
56
|
+
#
|
57
|
+
# @param obj [Object]
|
58
|
+
# @return [Void]
|
59
|
+
def self.validate_raw(obj:)
|
60
|
+
obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
61
|
+
obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
62
|
+
obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
63
|
+
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
64
|
+
obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "word_search_timestamp"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module AssemblyAI
|
7
|
+
class Transcripts
|
8
|
+
class WordSearchMatch
|
9
|
+
attr_reader :text, :count, :timestamps, :indexes, :additional_properties
|
10
|
+
|
11
|
+
# @param text [String] The matched word
|
12
|
+
# @param count [Integer] The total amount of times the word is in the transcript
|
13
|
+
# @param timestamps [Array<Transcripts::WORD_SEARCH_TIMESTAMP>] An array of timestamps
|
14
|
+
# @param indexes [Array<Integer>] An array of all index locations for that word within the `words` array of the completed transcript
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [Transcripts::WordSearchMatch]
|
17
|
+
def initialize(text:, count:, timestamps:, indexes:, additional_properties: nil)
|
18
|
+
# @type [String] The matched word
|
19
|
+
@text = text
|
20
|
+
# @type [Integer] The total amount of times the word is in the transcript
|
21
|
+
@count = count
|
22
|
+
# @type [Array<Transcripts::WORD_SEARCH_TIMESTAMP>] An array of timestamps
|
23
|
+
@timestamps = timestamps
|
24
|
+
# @type [Array<Integer>] An array of all index locations for that word within the `words` array of the completed transcript
|
25
|
+
@indexes = indexes
|
26
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
@additional_properties = additional_properties
|
28
|
+
end
|
29
|
+
|
30
|
+
# Deserialize a JSON object to an instance of WordSearchMatch
|
31
|
+
#
|
32
|
+
# @param json_object [JSON]
|
33
|
+
# @return [Transcripts::WordSearchMatch]
|
34
|
+
def self.from_json(json_object:)
|
35
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
36
|
+
JSON.parse(json_object)
|
37
|
+
text = struct.text
|
38
|
+
count = struct.count
|
39
|
+
timestamps = struct.timestamps
|
40
|
+
indexes = struct.indexes
|
41
|
+
new(text: text, count: count, timestamps: timestamps, indexes: indexes, additional_properties: struct)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Serialize an instance of WordSearchMatch to a JSON object
|
45
|
+
#
|
46
|
+
# @return [JSON]
|
47
|
+
def to_json(*_args)
|
48
|
+
{ "text": @text, "count": @count, "timestamps": @timestamps, "indexes": @indexes }.to_json
|
49
|
+
end
|
50
|
+
|
51
|
+
# 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.
|
52
|
+
#
|
53
|
+
# @param obj [Object]
|
54
|
+
# @return [Void]
|
55
|
+
def self.validate_raw(obj:)
|
56
|
+
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
57
|
+
obj.count.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
|
58
|
+
obj.timestamps.is_a?(Array) != false || raise("Passed value for field obj.timestamps is not the expected type, validation failed.")
|
59
|
+
obj.indexes.is_a?(Array) != false || raise("Passed value for field obj.indexes is not the expected type, validation failed.")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "word_search_match"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module AssemblyAI
|
7
|
+
class Transcripts
|
8
|
+
class WordSearchResponse
|
9
|
+
attr_reader :id, :total_count, :matches, :additional_properties
|
10
|
+
|
11
|
+
# @param id [String] The ID of the transcript
|
12
|
+
# @param total_count [Integer] The total count of all matched instances. For e.g., word 1 matched 2 times, and word 2 matched 3 times, `total_count` will equal 5.
|
13
|
+
# @param matches [Array<Transcripts::WordSearchMatch>] The matches of the search
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [Transcripts::WordSearchResponse]
|
16
|
+
def initialize(id:, total_count:, matches:, additional_properties: nil)
|
17
|
+
# @type [String] The ID of the transcript
|
18
|
+
@id = id
|
19
|
+
# @type [Integer] The total count of all matched instances. For e.g., word 1 matched 2 times, and word 2 matched 3 times, `total_count` will equal 5.
|
20
|
+
@total_count = total_count
|
21
|
+
# @type [Array<Transcripts::WordSearchMatch>] The matches of the search
|
22
|
+
@matches = matches
|
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 WordSearchResponse
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [Transcripts::WordSearchResponse]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
parsed_json = JSON.parse(json_object)
|
34
|
+
id = struct.id
|
35
|
+
total_count = struct.total_count
|
36
|
+
matches = parsed_json["matches"]&.map do |v|
|
37
|
+
v = v.to_json
|
38
|
+
Transcripts::WordSearchMatch.from_json(json_object: v)
|
39
|
+
end
|
40
|
+
new(id: id, total_count: total_count, matches: matches, additional_properties: struct)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Serialize an instance of WordSearchResponse to a JSON object
|
44
|
+
#
|
45
|
+
# @return [JSON]
|
46
|
+
def to_json(*_args)
|
47
|
+
{ "id": @id, "total_count": @total_count, "matches": @matches }.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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
56
|
+
obj.total_count.is_a?(Integer) != false || raise("Passed value for field obj.total_count is not the expected type, validation failed.")
|
57
|
+
obj.matches.is_a?(Array) != false || raise("Passed value for field obj.matches is not the expected type, validation failed.")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module AssemblyAI
|
6
|
+
class Error
|
7
|
+
attr_reader :error, :status, :additional_properties
|
8
|
+
|
9
|
+
# @param error [String] Error message
|
10
|
+
# @param status [String]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [Error]
|
13
|
+
def initialize(error:, status: nil, additional_properties: nil)
|
14
|
+
# @type [String] Error message
|
15
|
+
@error = error
|
16
|
+
# @type [String]
|
17
|
+
@status = status
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of Error
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [Error]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
error = struct.error
|
30
|
+
status = struct.status
|
31
|
+
new(error: error, status: status, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of Error to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "error": @error, "status": @status }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# 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.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.error.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
|
47
|
+
obj.status&.is_a?(String) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/assemblyai.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "environment"
|
4
|
+
require_relative "types_export"
|
5
|
+
require_relative "requests"
|
6
|
+
require_relative "assemblyai/files/client"
|
7
|
+
require_relative "assemblyai/transcripts/client"
|
8
|
+
require_relative "assemblyai/transcripts/polling_client"
|
9
|
+
require_relative "assemblyai/realtime/client"
|
10
|
+
require_relative "assemblyai/lemur/client"
|
11
|
+
|
12
|
+
module AssemblyAI
|
13
|
+
class Client
|
14
|
+
attr_reader :files, :transcripts, :realtime, :lemur
|
15
|
+
|
16
|
+
# @param environment [Environment]
|
17
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
18
|
+
# @param timeout_in_seconds [Long]
|
19
|
+
# @param api_key [String]
|
20
|
+
# @return [Client]
|
21
|
+
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil)
|
22
|
+
@request_client = RequestClient.new(environment: environment, max_retries: max_retries,
|
23
|
+
timeout_in_seconds: timeout_in_seconds, api_key: api_key)
|
24
|
+
@files = FilesClient.new(request_client: @request_client)
|
25
|
+
@transcripts = TranscriptsClient.new(request_client: @request_client)
|
26
|
+
@realtime = RealtimeClient.new(request_client: @request_client)
|
27
|
+
@lemur = LemurClient.new(request_client: @request_client)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class AsyncClient
|
32
|
+
attr_reader :files, :transcripts, :realtime, :lemur
|
33
|
+
|
34
|
+
# @param environment [Environment]
|
35
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
36
|
+
# @param timeout_in_seconds [Long]
|
37
|
+
# @param api_key [String]
|
38
|
+
# @return [AsyncClient]
|
39
|
+
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil)
|
40
|
+
@async_request_client = AsyncRequestClient.new(environment: environment, max_retries: max_retries,
|
41
|
+
timeout_in_seconds: timeout_in_seconds, api_key: api_key)
|
42
|
+
@files = AsyncFilesClient.new(request_client: @async_request_client)
|
43
|
+
@transcripts = AsyncTranscriptsClient.new(request_client: @async_request_client)
|
44
|
+
@realtime = AsyncRealtimeClient.new(request_client: @async_request_client)
|
45
|
+
@lemur = AsyncLemurClient.new(request_client: @async_request_client)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/environment.rb
ADDED
data/lib/gemconfig.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AssemblyAI
|
4
|
+
module Gemconfig
|
5
|
+
VERSION = ""
|
6
|
+
AUTHORS = [""].freeze
|
7
|
+
EMAIL = ""
|
8
|
+
SUMMARY = ""
|
9
|
+
DESCRIPTION = ""
|
10
|
+
HOMEPAGE = "https://github.com/AssemblyAI/assemblyai-ruby-sdk"
|
11
|
+
SOURCE_CODE_URI = "https://github.com/AssemblyAI/assemblyai-ruby-sdk"
|
12
|
+
CHANGELOG_URI = "https://github.com/AssemblyAI/assemblyai-ruby-sdk/blob/master/CHANGELOG.md"
|
13
|
+
end
|
14
|
+
end
|
data/lib/requests.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "environment"
|
4
|
+
require "faraday"
|
5
|
+
require "faraday/retry"
|
6
|
+
require "async/http/faraday"
|
7
|
+
|
8
|
+
module AssemblyAI
|
9
|
+
class RequestClient
|
10
|
+
attr_reader :headers, :base_url, :conn
|
11
|
+
|
12
|
+
# @param environment [Environment]
|
13
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
14
|
+
# @param timeout_in_seconds [Long]
|
15
|
+
# @param api_key [String]
|
16
|
+
# @return [RequestClient]
|
17
|
+
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil)
|
18
|
+
@default_environment = environment
|
19
|
+
@base_url = environment
|
20
|
+
@headers = {
|
21
|
+
"X-Fern-Language": "Ruby",
|
22
|
+
"X-Fern-SDK-Name": "AssemblyAI",
|
23
|
+
"X-Fern-SDK-Version": "1.0.0-beta",
|
24
|
+
"Authorization": api_key.to_s
|
25
|
+
}
|
26
|
+
@conn = Faraday.new(@base_url, headers: @headers) do |faraday|
|
27
|
+
faraday.request :json
|
28
|
+
faraday.response :raise_error, include_request: true
|
29
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
30
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class AsyncRequestClient
|
36
|
+
attr_reader :headers, :base_url, :conn
|
37
|
+
|
38
|
+
# @param environment [Environment]
|
39
|
+
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
40
|
+
# @param timeout_in_seconds [Long]
|
41
|
+
# @param api_key [String]
|
42
|
+
# @return [AsyncRequestClient]
|
43
|
+
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil)
|
44
|
+
@default_environment = environment
|
45
|
+
@base_url = environment
|
46
|
+
@headers = {
|
47
|
+
"X-Fern-Language": "Ruby",
|
48
|
+
"X-Fern-SDK-Name": "AssemblyAI",
|
49
|
+
"X-Fern-SDK-Version": "1.0.0-beta",
|
50
|
+
"Authorization": api_key.to_s
|
51
|
+
}
|
52
|
+
@conn = Faraday.new(@base_url, headers: @headers) do |faraday|
|
53
|
+
faraday.request :json
|
54
|
+
faraday.response :raise_error, include_request: true
|
55
|
+
faraday.adapter :async_http
|
56
|
+
faraday.request :retry, { max: max_retries } unless max_retries.nil?
|
57
|
+
faraday.options.timeout = timeout_in_seconds unless timeout_in_seconds.nil?
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Additional options for request-specific configuration when calling APIs via the SDK.
|
63
|
+
class RequestOptions
|
64
|
+
attr_reader :api_key, :additional_headers, :additional_query_parameters, :additional_body_parameters,
|
65
|
+
:timeout_in_seconds
|
66
|
+
|
67
|
+
# @param api_key [String]
|
68
|
+
# @param additional_headers [Hash{String => Object}]
|
69
|
+
# @param additional_query_parameters [Hash{String => Object}]
|
70
|
+
# @param additional_body_parameters [Hash{String => Object}]
|
71
|
+
# @param timeout_in_seconds [Long]
|
72
|
+
# @return [RequestOptions]
|
73
|
+
def initialize(api_key: nil, additional_headers: nil, additional_query_parameters: nil,
|
74
|
+
additional_body_parameters: nil, timeout_in_seconds: nil)
|
75
|
+
# @type [String]
|
76
|
+
@api_key = api_key
|
77
|
+
# @type [Hash{String => Object}]
|
78
|
+
@additional_headers = additional_headers
|
79
|
+
# @type [Hash{String => Object}]
|
80
|
+
@additional_query_parameters = additional_query_parameters
|
81
|
+
# @type [Hash{String => Object}]
|
82
|
+
@additional_body_parameters = additional_body_parameters
|
83
|
+
# @type [Long]
|
84
|
+
@timeout_in_seconds = timeout_in_seconds
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/lib/types_export.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "assemblyai/files/types/uploaded_file"
|
4
|
+
require_relative "assemblyai/transcripts/types/redacted_audio_response"
|
5
|
+
require_relative "assemblyai/transcripts/types/redacted_audio_status"
|
6
|
+
require_relative "assemblyai/transcripts/types/subtitle_format"
|
7
|
+
require_relative "assemblyai/transcripts/types/word_search_response"
|
8
|
+
require_relative "assemblyai/transcripts/types/word_search_match"
|
9
|
+
require_relative "assemblyai/transcripts/types/word_search_timestamp"
|
10
|
+
require_relative "assemblyai/transcripts/types/timestamp"
|
11
|
+
require_relative "assemblyai/transcripts/types/transcript_optional_params"
|
12
|
+
require_relative "assemblyai/transcripts/types/summary_model"
|
13
|
+
require_relative "assemblyai/transcripts/types/summary_type"
|
14
|
+
require_relative "assemblyai/transcripts/types/transcript_boost_param"
|
15
|
+
require_relative "assemblyai/transcripts/types/transcript_custom_spelling"
|
16
|
+
require_relative "assemblyai/transcripts/types/transcript_utterance"
|
17
|
+
require_relative "assemblyai/transcripts/types/substitution_policy"
|
18
|
+
require_relative "assemblyai/transcripts/types/redact_pii_audio_quality"
|
19
|
+
require_relative "assemblyai/transcripts/types/pii_policy"
|
20
|
+
require_relative "assemblyai/transcripts/types/speech_model"
|
21
|
+
require_relative "assemblyai/transcripts/types/transcript_language_code"
|
22
|
+
require_relative "assemblyai/transcripts/types/transcript_status"
|
23
|
+
require_relative "assemblyai/transcripts/types/transcript"
|
24
|
+
require_relative "assemblyai/transcripts/types/topic_detection_model_result"
|
25
|
+
require_relative "assemblyai/transcripts/types/content_safety_labels_result"
|
26
|
+
require_relative "assemblyai/transcripts/types/chapter"
|
27
|
+
require_relative "assemblyai/transcripts/types/entity"
|
28
|
+
require_relative "assemblyai/transcripts/types/entity_type"
|
29
|
+
require_relative "assemblyai/transcripts/types/sentiment_analysis_result"
|
30
|
+
require_relative "assemblyai/transcripts/types/sentiment"
|
31
|
+
require_relative "assemblyai/transcripts/types/topic_detection_result_labels_item"
|
32
|
+
require_relative "assemblyai/transcripts/types/topic_detection_result"
|
33
|
+
require_relative "assemblyai/transcripts/types/content_safety_label"
|
34
|
+
require_relative "assemblyai/transcripts/types/content_safety_label_result"
|
35
|
+
require_relative "assemblyai/transcripts/types/severity_score_summary"
|
36
|
+
require_relative "assemblyai/transcripts/types/auto_highlights_result"
|
37
|
+
require_relative "assemblyai/transcripts/types/auto_highlight_result"
|
38
|
+
require_relative "assemblyai/transcripts/types/transcript_word"
|
39
|
+
require_relative "assemblyai/transcripts/types/transcript_sentence"
|
40
|
+
require_relative "assemblyai/transcripts/types/sentences_response"
|
41
|
+
require_relative "assemblyai/transcripts/types/transcript_paragraph"
|
42
|
+
require_relative "assemblyai/transcripts/types/paragraphs_response"
|
43
|
+
require_relative "assemblyai/transcripts/types/page_details"
|
44
|
+
require_relative "assemblyai/transcripts/types/transcript_list_item"
|
45
|
+
require_relative "assemblyai/transcripts/types/transcript_list"
|
46
|
+
require_relative "assemblyai/transcripts/types/audio_intelligence_model_status"
|
47
|
+
require_relative "assemblyai/realtime/types/realtime_temporary_token_response"
|
48
|
+
require_relative "assemblyai/realtime/types/realtime_base_message"
|
49
|
+
require_relative "assemblyai/realtime/types/realtime_message"
|
50
|
+
require_relative "assemblyai/realtime/types/realtime_error"
|
51
|
+
require_relative "assemblyai/realtime/types/message_type"
|
52
|
+
require_relative "assemblyai/realtime/types/realtime_transcript_type"
|
53
|
+
require_relative "assemblyai/realtime/types/realtime_transcript"
|
54
|
+
require_relative "assemblyai/realtime/types/session_begins"
|
55
|
+
require_relative "assemblyai/realtime/types/session_terminated"
|
56
|
+
require_relative "assemblyai/realtime/types/realtime_base_transcript"
|
57
|
+
require_relative "assemblyai/realtime/types/partial_transcript"
|
58
|
+
require_relative "assemblyai/realtime/types/final_transcript"
|
59
|
+
require_relative "assemblyai/realtime/types/word"
|
60
|
+
require_relative "assemblyai/realtime/types/audio_data"
|
61
|
+
require_relative "assemblyai/realtime/types/terminate_session"
|
62
|
+
require_relative "assemblyai/realtime/types/audio_encoding"
|
63
|
+
require_relative "assemblyai/lemur/types/purge_lemur_request_data_response"
|
64
|
+
require_relative "assemblyai/lemur/types/lemur_base_response"
|
65
|
+
require_relative "assemblyai/lemur/types/lemur_summary_response"
|
66
|
+
require_relative "assemblyai/lemur/types/lemur_question_answer_response"
|
67
|
+
require_relative "assemblyai/lemur/types/lemur_question_answer"
|
68
|
+
require_relative "assemblyai/lemur/types/lemur_action_items_response"
|
69
|
+
require_relative "assemblyai/lemur/types/lemur_task_response"
|
70
|
+
require_relative "assemblyai/lemur/types/lemur_base_params_context"
|
71
|
+
require_relative "assemblyai/lemur/types/lemur_base_params"
|
72
|
+
require_relative "assemblyai/lemur/types/lemur_question_context"
|
73
|
+
require_relative "assemblyai/lemur/types/lemur_question"
|
74
|
+
require_relative "assemblyai/lemur/types/lemur_model"
|
75
|
+
require_relative "assemblyai/types/error"
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: assemblyai
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.pre.beta
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ''
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: async-http-faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.12'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday-retry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.2'
|
55
|
+
description: ''
|
56
|
+
email: ''
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- lib/assemblyai.rb
|
62
|
+
- lib/assemblyai/files/client.rb
|
63
|
+
- lib/assemblyai/files/types/uploaded_file.rb
|
64
|
+
- lib/assemblyai/lemur/client.rb
|
65
|
+
- lib/assemblyai/lemur/types/lemur_action_items_response.rb
|
66
|
+
- lib/assemblyai/lemur/types/lemur_base_params.rb
|
67
|
+
- lib/assemblyai/lemur/types/lemur_base_params_context.rb
|
68
|
+
- lib/assemblyai/lemur/types/lemur_base_response.rb
|
69
|
+
- lib/assemblyai/lemur/types/lemur_model.rb
|
70
|
+
- lib/assemblyai/lemur/types/lemur_question.rb
|
71
|
+
- lib/assemblyai/lemur/types/lemur_question_answer.rb
|
72
|
+
- lib/assemblyai/lemur/types/lemur_question_answer_response.rb
|
73
|
+
- lib/assemblyai/lemur/types/lemur_question_context.rb
|
74
|
+
- lib/assemblyai/lemur/types/lemur_summary_response.rb
|
75
|
+
- lib/assemblyai/lemur/types/lemur_task_response.rb
|
76
|
+
- lib/assemblyai/lemur/types/purge_lemur_request_data_response.rb
|
77
|
+
- lib/assemblyai/realtime/client.rb
|
78
|
+
- lib/assemblyai/realtime/types/audio_data.rb
|
79
|
+
- lib/assemblyai/realtime/types/audio_encoding.rb
|
80
|
+
- lib/assemblyai/realtime/types/final_transcript.rb
|
81
|
+
- lib/assemblyai/realtime/types/message_type.rb
|
82
|
+
- lib/assemblyai/realtime/types/partial_transcript.rb
|
83
|
+
- lib/assemblyai/realtime/types/realtime_base_message.rb
|
84
|
+
- lib/assemblyai/realtime/types/realtime_base_transcript.rb
|
85
|
+
- lib/assemblyai/realtime/types/realtime_error.rb
|
86
|
+
- lib/assemblyai/realtime/types/realtime_message.rb
|
87
|
+
- lib/assemblyai/realtime/types/realtime_temporary_token_response.rb
|
88
|
+
- lib/assemblyai/realtime/types/realtime_transcript.rb
|
89
|
+
- lib/assemblyai/realtime/types/realtime_transcript_type.rb
|
90
|
+
- lib/assemblyai/realtime/types/session_begins.rb
|
91
|
+
- lib/assemblyai/realtime/types/session_terminated.rb
|
92
|
+
- lib/assemblyai/realtime/types/terminate_session.rb
|
93
|
+
- lib/assemblyai/realtime/types/word.rb
|
94
|
+
- lib/assemblyai/transcripts/client.rb
|
95
|
+
- lib/assemblyai/transcripts/polling_client.rb
|
96
|
+
- lib/assemblyai/transcripts/types/audio_intelligence_model_status.rb
|
97
|
+
- lib/assemblyai/transcripts/types/auto_highlight_result.rb
|
98
|
+
- lib/assemblyai/transcripts/types/auto_highlights_result.rb
|
99
|
+
- lib/assemblyai/transcripts/types/chapter.rb
|
100
|
+
- lib/assemblyai/transcripts/types/content_safety_label.rb
|
101
|
+
- lib/assemblyai/transcripts/types/content_safety_label_result.rb
|
102
|
+
- lib/assemblyai/transcripts/types/content_safety_labels_result.rb
|
103
|
+
- lib/assemblyai/transcripts/types/entity.rb
|
104
|
+
- lib/assemblyai/transcripts/types/entity_type.rb
|
105
|
+
- lib/assemblyai/transcripts/types/page_details.rb
|
106
|
+
- lib/assemblyai/transcripts/types/paragraphs_response.rb
|
107
|
+
- lib/assemblyai/transcripts/types/pii_policy.rb
|
108
|
+
- lib/assemblyai/transcripts/types/polling_options.rb
|
109
|
+
- lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb
|
110
|
+
- lib/assemblyai/transcripts/types/redacted_audio_response.rb
|
111
|
+
- lib/assemblyai/transcripts/types/redacted_audio_status.rb
|
112
|
+
- lib/assemblyai/transcripts/types/sentences_response.rb
|
113
|
+
- lib/assemblyai/transcripts/types/sentiment.rb
|
114
|
+
- lib/assemblyai/transcripts/types/sentiment_analysis_result.rb
|
115
|
+
- lib/assemblyai/transcripts/types/severity_score_summary.rb
|
116
|
+
- lib/assemblyai/transcripts/types/speech_model.rb
|
117
|
+
- lib/assemblyai/transcripts/types/substitution_policy.rb
|
118
|
+
- lib/assemblyai/transcripts/types/subtitle_format.rb
|
119
|
+
- lib/assemblyai/transcripts/types/summary_model.rb
|
120
|
+
- lib/assemblyai/transcripts/types/summary_type.rb
|
121
|
+
- lib/assemblyai/transcripts/types/timestamp.rb
|
122
|
+
- lib/assemblyai/transcripts/types/topic_detection_model_result.rb
|
123
|
+
- lib/assemblyai/transcripts/types/topic_detection_result.rb
|
124
|
+
- lib/assemblyai/transcripts/types/topic_detection_result_labels_item.rb
|
125
|
+
- lib/assemblyai/transcripts/types/transcript.rb
|
126
|
+
- lib/assemblyai/transcripts/types/transcript_boost_param.rb
|
127
|
+
- lib/assemblyai/transcripts/types/transcript_custom_spelling.rb
|
128
|
+
- lib/assemblyai/transcripts/types/transcript_language_code.rb
|
129
|
+
- lib/assemblyai/transcripts/types/transcript_list.rb
|
130
|
+
- lib/assemblyai/transcripts/types/transcript_list_item.rb
|
131
|
+
- lib/assemblyai/transcripts/types/transcript_optional_params.rb
|
132
|
+
- lib/assemblyai/transcripts/types/transcript_paragraph.rb
|
133
|
+
- lib/assemblyai/transcripts/types/transcript_sentence.rb
|
134
|
+
- lib/assemblyai/transcripts/types/transcript_status.rb
|
135
|
+
- lib/assemblyai/transcripts/types/transcript_utterance.rb
|
136
|
+
- lib/assemblyai/transcripts/types/transcript_word.rb
|
137
|
+
- lib/assemblyai/transcripts/types/word_search_match.rb
|
138
|
+
- lib/assemblyai/transcripts/types/word_search_response.rb
|
139
|
+
- lib/assemblyai/transcripts/types/word_search_timestamp.rb
|
140
|
+
- lib/assemblyai/types/error.rb
|
141
|
+
- lib/environment.rb
|
142
|
+
- lib/gemconfig.rb
|
143
|
+
- lib/requests.rb
|
144
|
+
- lib/types_export.rb
|
145
|
+
homepage: https://github.com/AssemblyAI/assemblyai-ruby-sdk
|
146
|
+
licenses: []
|
147
|
+
metadata:
|
148
|
+
homepage_uri: https://github.com/AssemblyAI/assemblyai-ruby-sdk
|
149
|
+
source_code_uri: https://github.com/AssemblyAI/assemblyai-ruby-sdk
|
150
|
+
changelog_uri: https://github.com/AssemblyAI/assemblyai-ruby-sdk/blob/master/CHANGELOG.md
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.7.0
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 1.3.1
|
165
|
+
requirements: []
|
166
|
+
rubygems_version: 3.1.6
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: ''
|
170
|
+
test_files: []
|