assemblyai 1.0.0.pre.beta.11 → 1.0.0.pre.beta.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assemblyai/lemur/client.rb +2 -2
- data/lib/assemblyai/lemur/types/lemur_action_items_response.rb +2 -2
- data/lib/assemblyai/lemur/types/lemur_response.rb +4 -32
- data/lib/assemblyai/lemur/types/lemur_string_response.rb +80 -0
- data/lib/assemblyai/lemur/types/lemur_summary_response.rb +2 -2
- data/lib/assemblyai/{streaming/types/streaming.rb → realtime/types/realtime.rb} +2 -2
- data/lib/assemblyai/{streaming → realtime}/types/receive_message.rb +8 -8
- data/lib/assemblyai/{streaming → realtime}/types/send_message.rb +5 -5
- data/lib/assemblyai/transcripts/polling_client.rb +20 -8
- data/lib/assemblyai/transcripts/types/paragraphs_response.rb +3 -3
- data/lib/assemblyai/transcripts/types/redacted_audio_notification.rb +9 -0
- data/lib/assemblyai/transcripts/types/sentences_response.rb +3 -3
- data/lib/assemblyai/transcripts/types/transcript.rb +19 -11
- data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +14 -8
- data/lib/assemblyai/transcripts/types/transcript_webhook_notification.rb +61 -0
- data/lib/assemblyai.rb +8 -6
- data/lib/gemconfig.rb +5 -4
- data/lib/requests.rb +12 -7
- data/lib/types_export.rb +11 -8
- data/lib/user_agent.rb +69 -0
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57111906829dc5c8b672c47fcfac95d6e6e05d6fd3df8523d16c5299f09e5aaf
|
4
|
+
data.tar.gz: 0300a4db2f0fa441594d7053f5232e06aaf70fddba251abe6664f4fbe4c1a617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501408f75273f6695433ea50640fa988db643e729341d70e1cc9275b0f3c26731d3321d62b3b610ccdbc6791ee8fc4a7824d448c3060d9f403ed7bf0e2e550ec
|
7
|
+
data.tar.gz: 4ee7018bf271a68a4fdec8c7676253188375ee9f00fb40a7d34d284fc93b87a0e3a31e702f5883031cb27712674abc9aa8462ad289ce7dd8aba4b66eb98f93a5
|
@@ -230,7 +230,7 @@ module AssemblyAI
|
|
230
230
|
# @param request_id [String] The ID of the LeMUR request you previously made.
|
231
231
|
# This would be found in the response of the original request.
|
232
232
|
# @param request_options [AssemblyAI::RequestOptions]
|
233
|
-
# @return [AssemblyAI::Lemur::
|
233
|
+
# @return [AssemblyAI::Lemur::LemurStringResponse, AssemblyAI::Lemur::LemurQuestionAnswerResponse]
|
234
234
|
# @example
|
235
235
|
# api = AssemblyAI::Client.new(
|
236
236
|
# environment: AssemblyAI::Environment::DEFAULT,
|
@@ -499,7 +499,7 @@ module AssemblyAI
|
|
499
499
|
# @param request_id [String] The ID of the LeMUR request you previously made.
|
500
500
|
# This would be found in the response of the original request.
|
501
501
|
# @param request_options [AssemblyAI::RequestOptions]
|
502
|
-
# @return [AssemblyAI::Lemur::
|
502
|
+
# @return [AssemblyAI::Lemur::LemurStringResponse, AssemblyAI::Lemur::LemurQuestionAnswerResponse]
|
503
503
|
# @example
|
504
504
|
# api = AssemblyAI::Client.new(
|
505
505
|
# environment: AssemblyAI::Environment::DEFAULT,
|
@@ -7,7 +7,7 @@ require "json"
|
|
7
7
|
module AssemblyAI
|
8
8
|
class Lemur
|
9
9
|
class LemurActionItemsResponse
|
10
|
-
# @return [String] The response generated by LeMUR
|
10
|
+
# @return [String] The response generated by LeMUR.
|
11
11
|
attr_reader :response
|
12
12
|
# @return [String] The ID of the LeMUR request
|
13
13
|
attr_reader :request_id
|
@@ -21,7 +21,7 @@ module AssemblyAI
|
|
21
21
|
|
22
22
|
OMIT = Object.new
|
23
23
|
|
24
|
-
# @param response [String] The response generated by LeMUR
|
24
|
+
# @param response [String] The response generated by LeMUR.
|
25
25
|
# @param request_id [String] The ID of the LeMUR request
|
26
26
|
# @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
|
27
27
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
@@ -1,10 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "json"
|
4
|
-
require_relative "
|
5
|
-
require_relative "lemur_summary_response"
|
4
|
+
require_relative "lemur_string_response"
|
6
5
|
require_relative "lemur_question_answer_response"
|
7
|
-
require_relative "lemur_action_items_response"
|
8
6
|
|
9
7
|
module AssemblyAI
|
10
8
|
class Lemur
|
@@ -16,16 +14,8 @@ module AssemblyAI
|
|
16
14
|
def self.from_json(json_object:)
|
17
15
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
18
16
|
begin
|
19
|
-
AssemblyAI::Lemur::
|
20
|
-
return AssemblyAI::Lemur::
|
21
|
-
|
22
|
-
return nil
|
23
|
-
rescue StandardError
|
24
|
-
# noop
|
25
|
-
end
|
26
|
-
begin
|
27
|
-
AssemblyAI::Lemur::LemurSummaryResponse.validate_raw(obj: struct)
|
28
|
-
return AssemblyAI::Lemur::LemurSummaryResponse.from_json(json_object: json_object) unless json_object.nil?
|
17
|
+
AssemblyAI::Lemur::LemurStringResponse.validate_raw(obj: struct)
|
18
|
+
return AssemblyAI::Lemur::LemurStringResponse.from_json(json_object: json_object) unless json_object.nil?
|
29
19
|
|
30
20
|
return nil
|
31
21
|
rescue StandardError
|
@@ -41,14 +31,6 @@ module AssemblyAI
|
|
41
31
|
rescue StandardError
|
42
32
|
# noop
|
43
33
|
end
|
44
|
-
begin
|
45
|
-
AssemblyAI::Lemur::LemurActionItemsResponse.validate_raw(obj: struct)
|
46
|
-
return AssemblyAI::Lemur::LemurActionItemsResponse.from_json(json_object: json_object) unless json_object.nil?
|
47
|
-
|
48
|
-
return nil
|
49
|
-
rescue StandardError
|
50
|
-
# noop
|
51
|
-
end
|
52
34
|
struct
|
53
35
|
end
|
54
36
|
|
@@ -60,12 +42,7 @@ module AssemblyAI
|
|
60
42
|
# @return [Void]
|
61
43
|
def self.validate_raw(obj:)
|
62
44
|
begin
|
63
|
-
return AssemblyAI::Lemur::
|
64
|
-
rescue StandardError
|
65
|
-
# noop
|
66
|
-
end
|
67
|
-
begin
|
68
|
-
return AssemblyAI::Lemur::LemurSummaryResponse.validate_raw(obj: obj)
|
45
|
+
return AssemblyAI::Lemur::LemurStringResponse.validate_raw(obj: obj)
|
69
46
|
rescue StandardError
|
70
47
|
# noop
|
71
48
|
end
|
@@ -74,11 +51,6 @@ module AssemblyAI
|
|
74
51
|
rescue StandardError
|
75
52
|
# noop
|
76
53
|
end
|
77
|
-
begin
|
78
|
-
return AssemblyAI::Lemur::LemurActionItemsResponse.validate_raw(obj: obj)
|
79
|
-
rescue StandardError
|
80
|
-
# noop
|
81
|
-
end
|
82
54
|
raise("Passed value matched no type within the union, validation failed.")
|
83
55
|
end
|
84
56
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lemur_usage"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module AssemblyAI
|
8
|
+
class Lemur
|
9
|
+
class LemurStringResponse
|
10
|
+
# @return [String] The response generated by LeMUR.
|
11
|
+
attr_reader :response
|
12
|
+
# @return [String] The ID of the LeMUR request
|
13
|
+
attr_reader :request_id
|
14
|
+
# @return [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
|
15
|
+
attr_reader :usage
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
attr_reader :additional_properties
|
18
|
+
# @return [Object]
|
19
|
+
attr_reader :_field_set
|
20
|
+
protected :_field_set
|
21
|
+
|
22
|
+
OMIT = Object.new
|
23
|
+
|
24
|
+
# @param response [String] The response generated by LeMUR.
|
25
|
+
# @param request_id [String] The ID of the LeMUR request
|
26
|
+
# @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [AssemblyAI::Lemur::LemurStringResponse]
|
29
|
+
def initialize(response:, request_id:, usage:, additional_properties: nil)
|
30
|
+
@response = response
|
31
|
+
@request_id = request_id
|
32
|
+
@usage = usage
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "response": response, "request_id": request_id, "usage": usage }
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of LemurStringResponse
|
38
|
+
#
|
39
|
+
# @param json_object [String]
|
40
|
+
# @return [AssemblyAI::Lemur::LemurStringResponse]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
response = struct["response"]
|
45
|
+
request_id = struct["request_id"]
|
46
|
+
if parsed_json["usage"].nil?
|
47
|
+
usage = nil
|
48
|
+
else
|
49
|
+
usage = parsed_json["usage"].to_json
|
50
|
+
usage = AssemblyAI::Lemur::LemurUsage.from_json(json_object: usage)
|
51
|
+
end
|
52
|
+
new(
|
53
|
+
response: response,
|
54
|
+
request_id: request_id,
|
55
|
+
usage: usage,
|
56
|
+
additional_properties: struct
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Serialize an instance of LemurStringResponse to a JSON object
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
def to_json(*_args)
|
64
|
+
@_field_set&.to_json
|
65
|
+
end
|
66
|
+
|
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.
|
70
|
+
#
|
71
|
+
# @param obj [Object]
|
72
|
+
# @return [Void]
|
73
|
+
def self.validate_raw(obj:)
|
74
|
+
obj.response.is_a?(String) != false || raise("Passed value for field obj.response is not the expected type, validation failed.")
|
75
|
+
obj.request_id.is_a?(String) != false || raise("Passed value for field obj.request_id is not the expected type, validation failed.")
|
76
|
+
AssemblyAI::Lemur::LemurUsage.validate_raw(obj: obj.usage)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -7,7 +7,7 @@ require "json"
|
|
7
7
|
module AssemblyAI
|
8
8
|
class Lemur
|
9
9
|
class LemurSummaryResponse
|
10
|
-
# @return [String] The response generated by LeMUR
|
10
|
+
# @return [String] The response generated by LeMUR.
|
11
11
|
attr_reader :response
|
12
12
|
# @return [String] The ID of the LeMUR request
|
13
13
|
attr_reader :request_id
|
@@ -21,7 +21,7 @@ module AssemblyAI
|
|
21
21
|
|
22
22
|
OMIT = Object.new
|
23
23
|
|
24
|
-
# @param response [String] The response generated by LeMUR
|
24
|
+
# @param response [String] The response generated by LeMUR.
|
25
25
|
# @param request_id [String] The ID of the LeMUR request
|
26
26
|
# @param usage [AssemblyAI::Lemur::LemurUsage] The usage numbers for the LeMUR request
|
27
27
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "json"
|
4
|
-
require_relative "
|
5
|
-
require_relative "
|
6
|
-
require_relative "
|
7
|
-
require_relative "
|
8
|
-
require_relative "
|
9
|
-
require_relative "
|
4
|
+
require_relative "session_begins"
|
5
|
+
require_relative "partial_transcript"
|
6
|
+
require_relative "final_transcript"
|
7
|
+
require_relative "session_information"
|
8
|
+
require_relative "session_terminated"
|
9
|
+
require_relative "realtime_error"
|
10
10
|
|
11
11
|
module AssemblyAI
|
12
|
-
class
|
12
|
+
class Realtime
|
13
13
|
# Receive messages from the WebSocket
|
14
14
|
class ReceiveMessage
|
15
15
|
# Deserialize a JSON object to an instance of ReceiveMessage
|
16
16
|
#
|
17
17
|
# @param json_object [String]
|
18
|
-
# @return [AssemblyAI::
|
18
|
+
# @return [AssemblyAI::Realtime::ReceiveMessage]
|
19
19
|
def self.from_json(json_object:)
|
20
20
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
21
21
|
begin
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "json"
|
4
|
-
require_relative "
|
5
|
-
require_relative "
|
6
|
-
require_relative "
|
4
|
+
require_relative "terminate_session"
|
5
|
+
require_relative "force_end_utterance"
|
6
|
+
require_relative "configure_end_utterance_silence_threshold"
|
7
7
|
|
8
8
|
module AssemblyAI
|
9
|
-
class
|
9
|
+
class Realtime
|
10
10
|
# Send messages to the WebSocket
|
11
11
|
class SendMessage
|
12
12
|
# Deserialize a JSON object to an instance of SendMessage
|
13
13
|
#
|
14
14
|
# @param json_object [String]
|
15
|
-
# @return [AssemblyAI::
|
15
|
+
# @return [AssemblyAI::Realtime::SendMessage]
|
16
16
|
def self.from_json(json_object:)
|
17
17
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
18
18
|
begin
|
@@ -75,10 +75,15 @@ module AssemblyAI
|
|
75
75
|
deprecate_conformer2(speech_model: speech_model)
|
76
76
|
transcript = submit(audio_url: audio_url, speech_model: speech_model, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel,
|
77
77
|
webhook_url: webhook_url, webhook_auth_header_name: webhook_auth_header_name, webhook_auth_header_value: webhook_auth_header_value, auto_highlights: auto_highlights, audio_start_from: audio_start_from, audio_end_at: audio_end_at, word_boost: word_boost, boost_param: boost_param, filter_profanity: filter_profanity, redact_pii: redact_pii, redact_pii_audio: redact_pii_audio, redact_pii_audio_quality: redact_pii_audio_quality, redact_pii_policies: redact_pii_policies, redact_pii_sub: redact_pii_sub, speaker_labels: speaker_labels, speakers_expected: speakers_expected, content_safety: content_safety, content_safety_confidence: content_safety_confidence, iab_categories: iab_categories, language_detection: language_detection, custom_spelling: custom_spelling, disfluencies: disfluencies, sentiment_analysis: sentiment_analysis, auto_chapters: auto_chapters, entity_detection: entity_detection, speech_threshold: speech_threshold, summarization: summarization, summary_model: summary_model, summary_type: summary_type, custom_topics: custom_topics, topics: topics, additional_properties: additional_properties, request_options: request_options)
|
78
|
-
|
78
|
+
wait_until_ready(transcript_id: transcript.id, polling_options: polling_options)
|
79
79
|
end
|
80
80
|
|
81
|
-
|
81
|
+
# Wait until the transcript is ready. The transcript is ready when the "status" is "completed".
|
82
|
+
#
|
83
|
+
# @param transcript_id [String] ID of the transcript
|
84
|
+
# @param polling_options [PollingOptions]
|
85
|
+
# @return [Transcripts::Transcript]
|
86
|
+
def wait_until_ready(transcript_id:, polling_options: Transcripts::PollingOptions.new)
|
82
87
|
start_time = Time.now
|
83
88
|
timeout_in_seconds = polling_options.timeout / 1000 if polling_options.timeout.positive?
|
84
89
|
loop do
|
@@ -97,7 +102,8 @@ module AssemblyAI
|
|
97
102
|
def deprecate_conformer2(speech_model: nil)
|
98
103
|
warn "[DEPRECATION] `conformer-2` is deprecated. Please use `best` or `nano` instead." if speech_model == "conformer-2"
|
99
104
|
end
|
100
|
-
|
105
|
+
|
106
|
+
private :deprecate_conformer2
|
101
107
|
end
|
102
108
|
|
103
109
|
# :nodoc:
|
@@ -155,18 +161,23 @@ module AssemblyAI
|
|
155
161
|
Async do
|
156
162
|
transcript = submit(audio_url: audio_url, speech_model: speech_model, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel,
|
157
163
|
webhook_url: webhook_url, webhook_auth_header_name: webhook_auth_header_name, webhook_auth_header_value: webhook_auth_header_value, auto_highlights: auto_highlights, audio_start_from: audio_start_from, audio_end_at: audio_end_at, word_boost: word_boost, boost_param: boost_param, filter_profanity: filter_profanity, redact_pii: redact_pii, redact_pii_audio: redact_pii_audio, redact_pii_audio_quality: redact_pii_audio_quality, redact_pii_policies: redact_pii_policies, redact_pii_sub: redact_pii_sub, speaker_labels: speaker_labels, speakers_expected: speakers_expected, content_safety: content_safety, content_safety_confidence: content_safety_confidence, iab_categories: iab_categories, language_detection: language_detection, custom_spelling: custom_spelling, disfluencies: disfluencies, sentiment_analysis: sentiment_analysis, auto_chapters: auto_chapters, entity_detection: entity_detection, speech_threshold: speech_threshold, summarization: summarization, summary_model: summary_model, summary_type: summary_type, custom_topics: custom_topics, topics: topics, additional_properties: additional_properties, request_options: request_options).wait
|
158
|
-
|
164
|
+
wait_until_ready(transcript_id: transcript.id, polling_options: polling_options).wait
|
159
165
|
end
|
160
166
|
end
|
161
167
|
|
162
|
-
|
168
|
+
# Wait until the transcript is ready. The transcript is ready when the "status" is "completed".
|
169
|
+
#
|
170
|
+
# @param transcript_id [String] ID of the transcript
|
171
|
+
# @param polling_options [PollingOptions]
|
172
|
+
# @return [Transcripts::Transcript]
|
173
|
+
def wait_until_ready(transcript_id:, polling_options: Transcripts::PollingOptions.new)
|
163
174
|
Async do
|
164
175
|
start_time = Time.now
|
165
176
|
timeout_in_seconds = polling_options.timeout / 1000 if polling_options.timeout.positive?
|
166
177
|
loop do
|
167
|
-
transcript = get(transcript_id: transcript_id)
|
178
|
+
transcript = get(transcript_id: transcript_id)
|
168
179
|
if transcript.status == Transcripts::TranscriptStatus::COMPLETED || transcript.status == Transcripts::TranscriptStatus::ERROR
|
169
|
-
|
180
|
+
return transcript
|
170
181
|
elsif polling_options.timeout.positive? && Time.now - start_time > timeout_in_seconds
|
171
182
|
raise StandardError, "Polling timeout"
|
172
183
|
end
|
@@ -180,6 +191,7 @@ module AssemblyAI
|
|
180
191
|
def deprecate_conformer2(speech_model:)
|
181
192
|
warn "[DEPRECATION] `conformer-2` is deprecated. Please use `best` or `nano` instead." if speech_model == "conformer-2"
|
182
193
|
end
|
183
|
-
|
194
|
+
|
195
|
+
private :deprecate_conformer2
|
184
196
|
end
|
185
197
|
end
|
@@ -11,7 +11,7 @@ module AssemblyAI
|
|
11
11
|
attr_reader :id
|
12
12
|
# @return [Float]
|
13
13
|
attr_reader :confidence
|
14
|
-
# @return [
|
14
|
+
# @return [Integer]
|
15
15
|
attr_reader :audio_duration
|
16
16
|
# @return [Array<AssemblyAI::Transcripts::TranscriptParagraph>]
|
17
17
|
attr_reader :paragraphs
|
@@ -25,7 +25,7 @@ module AssemblyAI
|
|
25
25
|
|
26
26
|
# @param id [String]
|
27
27
|
# @param confidence [Float]
|
28
|
-
# @param audio_duration [
|
28
|
+
# @param audio_duration [Integer]
|
29
29
|
# @param paragraphs [Array<AssemblyAI::Transcripts::TranscriptParagraph>]
|
30
30
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
31
31
|
# @return [AssemblyAI::Transcripts::ParagraphsResponse]
|
@@ -77,7 +77,7 @@ module AssemblyAI
|
|
77
77
|
def self.validate_raw(obj:)
|
78
78
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
79
79
|
obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
80
|
-
obj.audio_duration.is_a?(
|
80
|
+
obj.audio_duration.is_a?(Integer) != false || raise("Passed value for field obj.audio_duration is not the expected type, validation failed.")
|
81
81
|
obj.paragraphs.is_a?(Array) != false || raise("Passed value for field obj.paragraphs is not the expected type, validation failed.")
|
82
82
|
end
|
83
83
|
end
|
@@ -11,7 +11,7 @@ module AssemblyAI
|
|
11
11
|
attr_reader :id
|
12
12
|
# @return [Float]
|
13
13
|
attr_reader :confidence
|
14
|
-
# @return [
|
14
|
+
# @return [Integer]
|
15
15
|
attr_reader :audio_duration
|
16
16
|
# @return [Array<AssemblyAI::Transcripts::TranscriptSentence>]
|
17
17
|
attr_reader :sentences
|
@@ -25,7 +25,7 @@ module AssemblyAI
|
|
25
25
|
|
26
26
|
# @param id [String]
|
27
27
|
# @param confidence [Float]
|
28
|
-
# @param audio_duration [
|
28
|
+
# @param audio_duration [Integer]
|
29
29
|
# @param sentences [Array<AssemblyAI::Transcripts::TranscriptSentence>]
|
30
30
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
31
31
|
# @return [AssemblyAI::Transcripts::SentencesResponse]
|
@@ -77,7 +77,7 @@ module AssemblyAI
|
|
77
77
|
def self.validate_raw(obj:)
|
78
78
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
79
79
|
obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
80
|
-
obj.audio_duration.is_a?(
|
80
|
+
obj.audio_duration.is_a?(Integer) != false || raise("Passed value for field obj.audio_duration is not the expected type, validation failed.")
|
81
81
|
obj.sentences.is_a?(Array) != false || raise("Passed value for field obj.sentences is not the expected type, validation failed.")
|
82
82
|
end
|
83
83
|
end
|
@@ -55,7 +55,7 @@ module AssemblyAI
|
|
55
55
|
# @return [Float] The confidence score for the transcript, between 0.0 (low confidence) and 1.0
|
56
56
|
# (high confidence)
|
57
57
|
attr_reader :confidence
|
58
|
-
# @return [
|
58
|
+
# @return [Integer] The duration of this transcript object's media file, in seconds
|
59
59
|
attr_reader :audio_duration
|
60
60
|
# @return [Boolean] Whether Automatic Punctuation is enabled, either true or false
|
61
61
|
attr_reader :punctuate
|
@@ -67,14 +67,18 @@ module AssemblyAI
|
|
67
67
|
attr_reader :dual_channel
|
68
68
|
# @return [AssemblyAI::Transcripts::SpeechModel]
|
69
69
|
attr_reader :speech_model
|
70
|
-
# @return [String] The URL to which we send
|
70
|
+
# @return [String] The URL to which we send webhook requests.
|
71
|
+
# We sends two different types of webhook requests.
|
72
|
+
# One request when a transcript is completed or failed, and one request when the
|
73
|
+
# redacted audio is ready if redact_pii_audio is enabled.
|
71
74
|
attr_reader :webhook_url
|
72
|
-
# @return [Integer] The status code we received from your server when delivering
|
73
|
-
# webhook URL was provided
|
75
|
+
# @return [Integer] The status code we received from your server when delivering the transcript
|
76
|
+
# completed or failed webhook request, if a webhook URL was provided
|
74
77
|
attr_reader :webhook_status_code
|
75
78
|
# @return [Boolean] Whether webhook authentication details were provided
|
76
79
|
attr_reader :webhook_auth
|
77
|
-
# @return [String] The header name
|
80
|
+
# @return [String] The header name to be sent with the transcript completed or failed webhook
|
81
|
+
# requests
|
78
82
|
attr_reader :webhook_auth_header_name
|
79
83
|
# @return [Boolean] Whether speed boost is enabled
|
80
84
|
attr_reader :speed_boost
|
@@ -223,18 +227,22 @@ module AssemblyAI
|
|
223
227
|
# more information.
|
224
228
|
# @param confidence [Float] The confidence score for the transcript, between 0.0 (low confidence) and 1.0
|
225
229
|
# (high confidence)
|
226
|
-
# @param audio_duration [
|
230
|
+
# @param audio_duration [Integer] The duration of this transcript object's media file, in seconds
|
227
231
|
# @param punctuate [Boolean] Whether Automatic Punctuation is enabled, either true or false
|
228
232
|
# @param format_text [Boolean] Whether Text Formatting is enabled, either true or false
|
229
233
|
# @param dual_channel [Boolean] Whether [Dual channel
|
230
234
|
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
231
235
|
# was enabled in the transcription request, either true or false
|
232
236
|
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
233
|
-
# @param webhook_url [String] The URL to which we send
|
234
|
-
#
|
235
|
-
#
|
237
|
+
# @param webhook_url [String] The URL to which we send webhook requests.
|
238
|
+
# We sends two different types of webhook requests.
|
239
|
+
# One request when a transcript is completed or failed, and one request when the
|
240
|
+
# redacted audio is ready if redact_pii_audio is enabled.
|
241
|
+
# @param webhook_status_code [Integer] The status code we received from your server when delivering the transcript
|
242
|
+
# completed or failed webhook request, if a webhook URL was provided
|
236
243
|
# @param webhook_auth [Boolean] Whether webhook authentication details were provided
|
237
|
-
# @param webhook_auth_header_name [String] The header name
|
244
|
+
# @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook
|
245
|
+
# requests
|
238
246
|
# @param speed_boost [Boolean] Whether speed boost is enabled
|
239
247
|
# @param auto_highlights [Boolean] Whether Key Phrases is enabled, either true or false
|
240
248
|
# @param auto_highlights_result [AssemblyAI::Transcripts::AutoHighlightsResult]
|
@@ -618,7 +626,7 @@ module AssemblyAI
|
|
618
626
|
obj.words&.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.")
|
619
627
|
obj.utterances&.is_a?(Array) != false || raise("Passed value for field obj.utterances is not the expected type, validation failed.")
|
620
628
|
obj.confidence&.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.")
|
621
|
-
obj.audio_duration&.is_a?(
|
629
|
+
obj.audio_duration&.is_a?(Integer) != false || raise("Passed value for field obj.audio_duration is not the expected type, validation failed.")
|
622
630
|
obj.punctuate&.is_a?(Boolean) != false || raise("Passed value for field obj.punctuate is not the expected type, validation failed.")
|
623
631
|
obj.format_text&.is_a?(Boolean) != false || raise("Passed value for field obj.format_text is not the expected type, validation failed.")
|
624
632
|
obj.dual_channel&.is_a?(Boolean) != false || raise("Passed value for field obj.dual_channel is not the expected type, validation failed.")
|
@@ -28,12 +28,15 @@ module AssemblyAI
|
|
28
28
|
attr_reader :dual_channel
|
29
29
|
# @return [AssemblyAI::Transcripts::SpeechModel]
|
30
30
|
attr_reader :speech_model
|
31
|
-
# @return [String] The URL to which
|
31
|
+
# @return [String] The URL to which we send webhook requests. We sends two different types of
|
32
|
+
# webhook requests. One request when a transcript is completed or failed, and one
|
33
|
+
# request when the redacted audio is ready if redact_pii_audio is enabled.
|
32
34
|
attr_reader :webhook_url
|
33
|
-
# @return [String] The header name
|
35
|
+
# @return [String] The header name to be sent with the transcript completed or failed webhook
|
36
|
+
# requests
|
34
37
|
attr_reader :webhook_auth_header_name
|
35
|
-
# @return [String]
|
36
|
-
# security
|
38
|
+
# @return [String] The header value to send back with the transcript completed or failed webhook
|
39
|
+
# requests for added security
|
37
40
|
attr_reader :webhook_auth_header_value
|
38
41
|
# @return [Boolean] Enable Key Phrases, either true or false
|
39
42
|
attr_reader :auto_highlights
|
@@ -134,10 +137,13 @@ module AssemblyAI
|
|
134
137
|
# ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription)
|
135
138
|
# transcription, can be true or false.
|
136
139
|
# @param speech_model [AssemblyAI::Transcripts::SpeechModel]
|
137
|
-
# @param webhook_url [String] The URL to which
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
140
|
+
# @param webhook_url [String] The URL to which we send webhook requests. We sends two different types of
|
141
|
+
# webhook requests. One request when a transcript is completed or failed, and one
|
142
|
+
# request when the redacted audio is ready if redact_pii_audio is enabled.
|
143
|
+
# @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook
|
144
|
+
# requests
|
145
|
+
# @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook
|
146
|
+
# requests for added security
|
141
147
|
# @param auto_highlights [Boolean] Enable Key Phrases, either true or false
|
142
148
|
# @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
|
143
149
|
# @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "transcript_ready_notification"
|
5
|
+
require_relative "redacted_audio_response"
|
6
|
+
|
7
|
+
module AssemblyAI
|
8
|
+
class Transcripts
|
9
|
+
# The notifications sent to the webhook URL.
|
10
|
+
class TranscriptWebhookNotification
|
11
|
+
# Deserialize a JSON object to an instance of TranscriptWebhookNotification
|
12
|
+
#
|
13
|
+
# @param json_object [String]
|
14
|
+
# @return [AssemblyAI::Transcripts::TranscriptWebhookNotification]
|
15
|
+
def self.from_json(json_object:)
|
16
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
17
|
+
begin
|
18
|
+
AssemblyAI::Transcripts::TranscriptReadyNotification.validate_raw(obj: struct)
|
19
|
+
unless json_object.nil?
|
20
|
+
return AssemblyAI::Transcripts::TranscriptReadyNotification.from_json(json_object: json_object)
|
21
|
+
end
|
22
|
+
|
23
|
+
return nil
|
24
|
+
rescue StandardError
|
25
|
+
# noop
|
26
|
+
end
|
27
|
+
begin
|
28
|
+
AssemblyAI::Transcripts::RedactedAudioResponse.validate_raw(obj: struct)
|
29
|
+
unless json_object.nil?
|
30
|
+
return AssemblyAI::Transcripts::RedactedAudioResponse.from_json(json_object: json_object)
|
31
|
+
end
|
32
|
+
|
33
|
+
return nil
|
34
|
+
rescue StandardError
|
35
|
+
# noop
|
36
|
+
end
|
37
|
+
struct
|
38
|
+
end
|
39
|
+
|
40
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
41
|
+
# hash and check each fields type against the current object's property
|
42
|
+
# definitions.
|
43
|
+
#
|
44
|
+
# @param obj [Object]
|
45
|
+
# @return [Void]
|
46
|
+
def self.validate_raw(obj:)
|
47
|
+
begin
|
48
|
+
return AssemblyAI::Transcripts::TranscriptReadyNotification.validate_raw(obj: obj)
|
49
|
+
rescue StandardError
|
50
|
+
# noop
|
51
|
+
end
|
52
|
+
begin
|
53
|
+
return AssemblyAI::Transcripts::RedactedAudioResponse.validate_raw(obj: obj)
|
54
|
+
rescue StandardError
|
55
|
+
# noop
|
56
|
+
end
|
57
|
+
raise("Passed value matched no type within the union, validation failed.")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/assemblyai.rb
CHANGED
@@ -14,14 +14,15 @@ module AssemblyAI
|
|
14
14
|
class Client
|
15
15
|
attr_reader :files, :transcripts, :realtime, :lemur
|
16
16
|
|
17
|
+
# @param api_key [String]
|
17
18
|
# @param environment [Environment]
|
18
19
|
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
19
20
|
# @param timeout_in_seconds [Long]
|
20
|
-
# @param
|
21
|
+
# @param user_agent [AssemblyAI::UserAgent]
|
21
22
|
# @return [Client]
|
22
|
-
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil)
|
23
|
+
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil, user_agent: nil)
|
23
24
|
@request_client = RequestClient.new(environment: environment, max_retries: max_retries,
|
24
|
-
timeout_in_seconds: timeout_in_seconds, api_key: api_key)
|
25
|
+
timeout_in_seconds: timeout_in_seconds, api_key: api_key, user_agent: user_agent)
|
25
26
|
@files = FilesClient.new(request_client: @request_client)
|
26
27
|
@transcripts = TranscriptsClient.new(request_client: @request_client)
|
27
28
|
@realtime = RealtimeClient.new(request_client: @request_client)
|
@@ -32,14 +33,15 @@ module AssemblyAI
|
|
32
33
|
class AsyncClient
|
33
34
|
attr_reader :files, :transcripts, :realtime, :lemur
|
34
35
|
|
36
|
+
# @param api_key [String]
|
35
37
|
# @param environment [Environment]
|
36
38
|
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
37
39
|
# @param timeout_in_seconds [Long]
|
38
|
-
# @param
|
40
|
+
# @param user_agent [AssemblyAI::UserAgent]
|
39
41
|
# @return [AsyncClient]
|
40
|
-
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil)
|
42
|
+
def initialize(api_key:, environment: Environment::DEFAULT, max_retries: nil, timeout_in_seconds: nil, user_agent: nil)
|
41
43
|
@async_request_client = AsyncRequestClient.new(environment: environment, max_retries: max_retries,
|
42
|
-
timeout_in_seconds: timeout_in_seconds, api_key: api_key)
|
44
|
+
timeout_in_seconds: timeout_in_seconds, api_key: api_key, user_agent: user_agent)
|
43
45
|
@files = AsyncFilesClient.new(request_client: @async_request_client)
|
44
46
|
@transcripts = AsyncTranscriptsClient.new(request_client: @async_request_client)
|
45
47
|
@realtime = AsyncRealtimeClient.new(request_client: @async_request_client)
|
data/lib/gemconfig.rb
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
module AssemblyAI
|
4
4
|
module Gemconfig
|
5
|
-
VERSION = ""
|
5
|
+
VERSION = "1.0.0-beta.13"
|
6
6
|
AUTHORS = [""].freeze
|
7
|
-
EMAIL = ""
|
8
|
-
SUMMARY = ""
|
9
|
-
DESCRIPTION = "
|
7
|
+
EMAIL = "support@assemblyai.com"
|
8
|
+
SUMMARY = "AssemblyAI Ruby SDK"
|
9
|
+
DESCRIPTION = "The AssemblyAI Ruby SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async, audio intelligence models, as well as the latest LeMUR models.
|
10
|
+
The Ruby SDK does not support Streaming STT at this time."
|
10
11
|
HOMEPAGE = "https://github.com/AssemblyAI/assemblyai-ruby-sdk"
|
11
12
|
SOURCE_CODE_URI = "https://github.com/AssemblyAI/assemblyai-ruby-sdk"
|
12
13
|
CHANGELOG_URI = "https://github.com/AssemblyAI/assemblyai-ruby-sdk/blob/master/CHANGELOG.md"
|
data/lib/requests.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "environment"
|
4
|
+
require_relative "user_agent"
|
4
5
|
require "faraday"
|
5
6
|
require "faraday/retry"
|
6
7
|
require "async/http/faraday"
|
@@ -16,21 +17,23 @@ module AssemblyAI
|
|
16
17
|
# @return [String]
|
17
18
|
attr_reader :default_environment
|
18
19
|
|
20
|
+
# @param api_key [String]
|
19
21
|
# @param environment [AssemblyAI::Environment]
|
20
22
|
# @param base_url [String]
|
21
23
|
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
22
24
|
# @param timeout_in_seconds [Long]
|
23
|
-
# @param
|
25
|
+
# @param user_agent [AssemblyAI::UserAgent]
|
24
26
|
# @return [AssemblyAI::RequestClient]
|
25
27
|
def initialize(api_key:, environment: AssemblyAI::Environment::DEFAULT, base_url: nil, max_retries: nil,
|
26
|
-
timeout_in_seconds: nil)
|
28
|
+
timeout_in_seconds: nil, user_agent: nil)
|
27
29
|
@default_environment = environment
|
28
30
|
@base_url = environment || base_url
|
29
31
|
@headers = {
|
30
32
|
"X-Fern-Language": "Ruby",
|
31
33
|
"X-Fern-SDK-Name": "assemblyai",
|
32
|
-
"X-Fern-SDK-Version":
|
33
|
-
"Authorization": api_key.to_s
|
34
|
+
"X-Fern-SDK-Version": AssemblyAI::Gemconfig::VERSION,
|
35
|
+
"Authorization": api_key.to_s,
|
36
|
+
"User-Agent": AssemblyAI::UserAgent.merge(AssemblyAI::DefaultUserAgent.instance.user_agent, user_agent).serialize
|
34
37
|
}
|
35
38
|
@conn = Faraday.new(headers: @headers) do |faraday|
|
36
39
|
faraday.request :json
|
@@ -62,16 +65,18 @@ module AssemblyAI
|
|
62
65
|
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
|
63
66
|
# @param timeout_in_seconds [Long]
|
64
67
|
# @param api_key [String]
|
68
|
+
# @param user_agent [AssemblyAI::UserAgent]
|
65
69
|
# @return [AssemblyAI::AsyncRequestClient]
|
66
70
|
def initialize(api_key:, environment: AssemblyAI::Environment::DEFAULT, base_url: nil, max_retries: nil,
|
67
|
-
timeout_in_seconds: nil)
|
71
|
+
timeout_in_seconds: nil, user_agent: nil)
|
68
72
|
@default_environment = environment
|
69
73
|
@base_url = environment || base_url
|
70
74
|
@headers = {
|
71
75
|
"X-Fern-Language": "Ruby",
|
72
76
|
"X-Fern-SDK-Name": "assemblyai",
|
73
|
-
"X-Fern-SDK-Version":
|
74
|
-
"Authorization": api_key.to_s
|
77
|
+
"X-Fern-SDK-Version": AssemblyAI::Gemconfig::VERSION,
|
78
|
+
"Authorization": api_key.to_s,
|
79
|
+
"User-Agent": AssemblyAI::UserAgent.merge(AssemblyAI::DefaultUserAgent.instance.user_agent, user_agent).serialize
|
75
80
|
}
|
76
81
|
@conn = Faraday.new(headers: @headers) do |faraday|
|
77
82
|
faraday.request :json
|
data/lib/types_export.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require_relative "assemblyai/files/types/uploaded_file"
|
4
4
|
require_relative "assemblyai/transcripts/types/transcript_ready_notification"
|
5
5
|
require_relative "assemblyai/transcripts/types/redacted_audio_response"
|
6
|
+
require_relative "assemblyai/transcripts/types/redacted_audio_notification"
|
7
|
+
require_relative "assemblyai/transcripts/types/transcript_webhook_notification"
|
6
8
|
require_relative "assemblyai/transcripts/types/redacted_audio_status"
|
7
9
|
require_relative "assemblyai/transcripts/types/subtitle_format"
|
8
10
|
require_relative "assemblyai/transcripts/types/word_search_response"
|
@@ -46,31 +48,35 @@ require_relative "assemblyai/transcripts/types/page_details"
|
|
46
48
|
require_relative "assemblyai/transcripts/types/transcript_list_item"
|
47
49
|
require_relative "assemblyai/transcripts/types/transcript_list"
|
48
50
|
require_relative "assemblyai/transcripts/types/audio_intelligence_model_status"
|
49
|
-
require_relative "assemblyai/realtime/types/
|
51
|
+
require_relative "assemblyai/realtime/types/realtime"
|
50
52
|
require_relative "assemblyai/realtime/types/session_begins"
|
51
53
|
require_relative "assemblyai/realtime/types/partial_transcript"
|
52
54
|
require_relative "assemblyai/realtime/types/final_transcript"
|
53
55
|
require_relative "assemblyai/realtime/types/session_information"
|
54
56
|
require_relative "assemblyai/realtime/types/session_terminated"
|
55
57
|
require_relative "assemblyai/realtime/types/realtime_error"
|
58
|
+
require_relative "assemblyai/realtime/types/receive_message"
|
59
|
+
require_relative "assemblyai/realtime/types/terminate_session"
|
60
|
+
require_relative "assemblyai/realtime/types/force_end_utterance"
|
61
|
+
require_relative "assemblyai/realtime/types/configure_end_utterance_silence_threshold"
|
62
|
+
require_relative "assemblyai/realtime/types/send_message"
|
63
|
+
require_relative "assemblyai/realtime/types/realtime_base_message"
|
56
64
|
require_relative "assemblyai/realtime/types/realtime_message"
|
57
65
|
require_relative "assemblyai/realtime/types/message_type"
|
58
66
|
require_relative "assemblyai/realtime/types/realtime_transcript_type"
|
59
67
|
require_relative "assemblyai/realtime/types/realtime_transcript"
|
60
68
|
require_relative "assemblyai/realtime/types/realtime_base_transcript"
|
61
69
|
require_relative "assemblyai/realtime/types/word"
|
62
|
-
require_relative "assemblyai/realtime/types/force_end_utterance"
|
63
|
-
require_relative "assemblyai/realtime/types/configure_end_utterance_silence_threshold"
|
64
|
-
require_relative "assemblyai/realtime/types/terminate_session"
|
65
70
|
require_relative "assemblyai/realtime/types/audio_encoding"
|
66
71
|
require_relative "assemblyai/realtime/types/realtime_temporary_token_response"
|
67
72
|
require_relative "assemblyai/lemur/types/purge_lemur_request_data_response"
|
68
73
|
require_relative "assemblyai/lemur/types/lemur_base_response"
|
74
|
+
require_relative "assemblyai/lemur/types/lemur_string_response"
|
69
75
|
require_relative "assemblyai/lemur/types/lemur_task_response"
|
70
76
|
require_relative "assemblyai/lemur/types/lemur_summary_response"
|
77
|
+
require_relative "assemblyai/lemur/types/lemur_action_items_response"
|
71
78
|
require_relative "assemblyai/lemur/types/lemur_question_answer_response"
|
72
79
|
require_relative "assemblyai/lemur/types/lemur_question_answer"
|
73
|
-
require_relative "assemblyai/lemur/types/lemur_action_items_response"
|
74
80
|
require_relative "assemblyai/lemur/types/lemur_response"
|
75
81
|
require_relative "assemblyai/lemur/types/lemur_base_params_context"
|
76
82
|
require_relative "assemblyai/lemur/types/lemur_base_params"
|
@@ -78,7 +84,4 @@ require_relative "assemblyai/lemur/types/lemur_question_context"
|
|
78
84
|
require_relative "assemblyai/lemur/types/lemur_question"
|
79
85
|
require_relative "assemblyai/lemur/types/lemur_model"
|
80
86
|
require_relative "assemblyai/lemur/types/lemur_usage"
|
81
|
-
require_relative "assemblyai/streaming/types/streaming"
|
82
|
-
require_relative "assemblyai/streaming/types/receive_message"
|
83
|
-
require_relative "assemblyai/streaming/types/send_message"
|
84
87
|
require_relative "assemblyai/types/error"
|
data/lib/user_agent.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "singleton"
|
4
|
+
|
5
|
+
module AssemblyAI
|
6
|
+
class UserAgentItem
|
7
|
+
attr_reader :name, :value, :version
|
8
|
+
|
9
|
+
def initialize(name:, version:)
|
10
|
+
@name = name
|
11
|
+
@version = version
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class UserAgent
|
16
|
+
attr_reader :user_agent_items
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@user_agent_items = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
# @param key [String]
|
23
|
+
# @param user_agent_item [AssemblyAI::UserAgentItem]
|
24
|
+
def add_item(key, user_agent_item)
|
25
|
+
if user_agent_item.nil?
|
26
|
+
@user_agent_items.delete(key)
|
27
|
+
else
|
28
|
+
@user_agent_items[key] = user_agent_item
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param user_agent1 [AssemblyAI::UserAgent]
|
33
|
+
# @param user_agent2 [AssemblyAI::UserAgent]
|
34
|
+
# @return [AssemblyAI::UserAgent]
|
35
|
+
def self.merge(user_agent1, user_agent2)
|
36
|
+
merged_user_agent = UserAgent.new
|
37
|
+
|
38
|
+
user_agent1&.user_agent_items&.each do |key, item|
|
39
|
+
merged_user_agent.add_item(key, item)
|
40
|
+
end
|
41
|
+
|
42
|
+
user_agent2&.user_agent_items&.each do |key, item|
|
43
|
+
merged_user_agent.add_item(key, item)
|
44
|
+
end
|
45
|
+
|
46
|
+
merged_user_agent
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [String]
|
50
|
+
def serialize
|
51
|
+
serialized_items = @user_agent_items.map do |key, item|
|
52
|
+
"#{key}=#{item.name}/#{item.version}"
|
53
|
+
end.join(" ")
|
54
|
+
|
55
|
+
"AssemblyAI/1.0 (#{serialized_items})"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class DefaultUserAgent
|
60
|
+
include Singleton
|
61
|
+
|
62
|
+
attr_reader :user_agent
|
63
|
+
|
64
|
+
def initialize
|
65
|
+
@user_agent = UserAgent.new
|
66
|
+
@user_agent.add_item("sdk", UserAgentItem.new(name: "Ruby", version: AssemblyAI::Gemconfig::VERSION))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assemblyai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.beta.
|
4
|
+
version: 1.0.0.pre.beta.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http-faraday
|
@@ -90,8 +90,10 @@ dependencies:
|
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '3.0'
|
93
|
-
description:
|
94
|
-
|
93
|
+
description: |-
|
94
|
+
The AssemblyAI Ruby SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async, audio intelligence models, as well as the latest LeMUR models.
|
95
|
+
The Ruby SDK does not support Streaming STT at this time.
|
96
|
+
email: support@assemblyai.com
|
95
97
|
executables: []
|
96
98
|
extensions: []
|
97
99
|
extra_rdoc_files: []
|
@@ -110,6 +112,7 @@ files:
|
|
110
112
|
- lib/assemblyai/lemur/types/lemur_question_answer_response.rb
|
111
113
|
- lib/assemblyai/lemur/types/lemur_question_context.rb
|
112
114
|
- lib/assemblyai/lemur/types/lemur_response.rb
|
115
|
+
- lib/assemblyai/lemur/types/lemur_string_response.rb
|
113
116
|
- lib/assemblyai/lemur/types/lemur_summary_response.rb
|
114
117
|
- lib/assemblyai/lemur/types/lemur_task_response.rb
|
115
118
|
- lib/assemblyai/lemur/types/lemur_usage.rb
|
@@ -121,6 +124,7 @@ files:
|
|
121
124
|
- lib/assemblyai/realtime/types/force_end_utterance.rb
|
122
125
|
- lib/assemblyai/realtime/types/message_type.rb
|
123
126
|
- lib/assemblyai/realtime/types/partial_transcript.rb
|
127
|
+
- lib/assemblyai/realtime/types/realtime.rb
|
124
128
|
- lib/assemblyai/realtime/types/realtime_base_message.rb
|
125
129
|
- lib/assemblyai/realtime/types/realtime_base_transcript.rb
|
126
130
|
- lib/assemblyai/realtime/types/realtime_error.rb
|
@@ -128,14 +132,13 @@ files:
|
|
128
132
|
- lib/assemblyai/realtime/types/realtime_temporary_token_response.rb
|
129
133
|
- lib/assemblyai/realtime/types/realtime_transcript.rb
|
130
134
|
- lib/assemblyai/realtime/types/realtime_transcript_type.rb
|
135
|
+
- lib/assemblyai/realtime/types/receive_message.rb
|
136
|
+
- lib/assemblyai/realtime/types/send_message.rb
|
131
137
|
- lib/assemblyai/realtime/types/session_begins.rb
|
132
138
|
- lib/assemblyai/realtime/types/session_information.rb
|
133
139
|
- lib/assemblyai/realtime/types/session_terminated.rb
|
134
140
|
- lib/assemblyai/realtime/types/terminate_session.rb
|
135
141
|
- lib/assemblyai/realtime/types/word.rb
|
136
|
-
- lib/assemblyai/streaming/types/receive_message.rb
|
137
|
-
- lib/assemblyai/streaming/types/send_message.rb
|
138
|
-
- lib/assemblyai/streaming/types/streaming.rb
|
139
142
|
- lib/assemblyai/transcripts/client.rb
|
140
143
|
- lib/assemblyai/transcripts/list_by_url_client.rb
|
141
144
|
- lib/assemblyai/transcripts/polling_client.rb
|
@@ -153,6 +156,7 @@ files:
|
|
153
156
|
- lib/assemblyai/transcripts/types/pii_policy.rb
|
154
157
|
- lib/assemblyai/transcripts/types/polling_options.rb
|
155
158
|
- lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb
|
159
|
+
- lib/assemblyai/transcripts/types/redacted_audio_notification.rb
|
156
160
|
- lib/assemblyai/transcripts/types/redacted_audio_response.rb
|
157
161
|
- lib/assemblyai/transcripts/types/redacted_audio_status.rb
|
158
162
|
- lib/assemblyai/transcripts/types/sentences_response.rb
|
@@ -181,6 +185,7 @@ files:
|
|
181
185
|
- lib/assemblyai/transcripts/types/transcript_sentence.rb
|
182
186
|
- lib/assemblyai/transcripts/types/transcript_status.rb
|
183
187
|
- lib/assemblyai/transcripts/types/transcript_utterance.rb
|
188
|
+
- lib/assemblyai/transcripts/types/transcript_webhook_notification.rb
|
184
189
|
- lib/assemblyai/transcripts/types/transcript_word.rb
|
185
190
|
- lib/assemblyai/transcripts/types/word_search_match.rb
|
186
191
|
- lib/assemblyai/transcripts/types/word_search_response.rb
|
@@ -190,6 +195,7 @@ files:
|
|
190
195
|
- lib/gemconfig.rb
|
191
196
|
- lib/requests.rb
|
192
197
|
- lib/types_export.rb
|
198
|
+
- lib/user_agent.rb
|
193
199
|
homepage: https://github.com/AssemblyAI/assemblyai-ruby-sdk
|
194
200
|
licenses: []
|
195
201
|
metadata:
|
@@ -214,5 +220,5 @@ requirements: []
|
|
214
220
|
rubygems_version: 3.1.6
|
215
221
|
signing_key:
|
216
222
|
specification_version: 4
|
217
|
-
summary:
|
223
|
+
summary: AssemblyAI Ruby SDK
|
218
224
|
test_files: []
|