From 32203ad08597a5025fcb5d67da0384bb452a7c3a Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:25:16 +0000 Subject: [PATCH 1/4] SDK regeneration --- lib/assemblyai/lemur/types/lemur_model.rb | 2 +- lib/assemblyai/transcripts/client.rb | 30 ++++++++----- .../types/content_safety_labels_result.rb | 4 +- .../transcripts/types/paragraphs_response.rb | 16 +++---- .../transcripts/types/sentences_response.rb | 16 +++---- .../types/sentiment_analysis_result.rb | 13 +++++- .../types/topic_detection_result.rb | 4 +- .../transcripts/types/transcript.rb | 26 +++++++++-- .../transcripts/types/transcript_list.rb | 8 ++-- .../transcripts/types/transcript_list_item.rb | 24 +++++----- .../types/transcript_optional_params.rb | 28 +++++++++--- .../transcripts/types/transcript_paragraph.rb | 44 +++++-------------- .../transcripts/types/transcript_sentence.rb | 33 +++++++++----- .../transcripts/types/transcript_utterance.rb | 16 ++++++- .../transcripts/types/transcript_word.rb | 32 +++++++++----- 15 files changed, 182 insertions(+), 114 deletions(-) diff --git a/lib/assemblyai/lemur/types/lemur_model.rb b/lib/assemblyai/lemur/types/lemur_model.rb index ebb4a4c..b512981 100644 --- a/lib/assemblyai/lemur/types/lemur_model.rb +++ b/lib/assemblyai/lemur/types/lemur_model.rb @@ -9,7 +9,7 @@ class LemurModel ANTHROPIC_CLAUDE3_HAIKU = "anthropic/claude-3-haiku" ANTHROPIC_CLAUDE3_SONNET = "anthropic/claude-3-sonnet" ANTHROPIC_CLAUDE2_1 = "anthropic/claude-2-1" - ANTHROPIC_CLAUDE2 = "anthropic/claude-2" + ANTHROPIC_CLAUDE2_0 = "anthropic/claude-2" DEFAULT = "default" ANTHROPIC_CLAUDE_INSTANT1_2 = "anthropic/claude-instant-1-2" BASIC = "basic" diff --git a/lib/assemblyai/transcripts/client.rb b/lib/assemblyai/transcripts/client.rb index 472c6d3..0bbab9c 100644 --- a/lib/assemblyai/transcripts/client.rb +++ b/lib/assemblyai/transcripts/client.rb @@ -35,7 +35,7 @@ def initialize(request_client:) # Transcripts are sorted from newest to oldest. The previous URL always points to # a page with older transcripts. # - # @param limit [Long] Maximum amount of transcripts to retrieve + # @param limit [Integer] Maximum amount of transcripts to retrieve # @param status [AssemblyAI::Transcripts::TranscriptStatus] Filter by transcript status # @param created_on [String] Only get transcripts created on this date # @param before_id [String] Get transcripts that were created before this transcript ID @@ -83,12 +83,16 @@ def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false # @param format_text [Boolean] Enable Text Formatting, can be true or false # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false + # @param multichannel [Boolean] Enable + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # transcription, can be true or false. # @param dual_channel [Boolean] Enable [Dual # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) # transcription, can be true or false. - # @param webhook_url [String] The URL to which we send webhook requests. We sends two different types of - # webhook requests. One request when a transcript is completed or failed, and one - # request when the redacted audio is ready if redact_pii_audio is enabled. + # @param webhook_url [String] The URL to which we send webhook requests. + # We sends two different types of webhook requests. + # One request when a transcript is completed or failed, and one request when the + # redacted audio is ready if redact_pii_audio is enabled. # @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook # requests # @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook @@ -158,7 +162,7 @@ def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil # ) # api.transcripts.submit(audio_url: "https://assembly.ai/wildfires.mp3") def submit(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil, - punctuate: nil, format_text: nil, disfluencies: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil) + punctuate: nil, format_text: nil, disfluencies: nil, multichannel: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil) response = @request_client.conn.post do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil? @@ -172,6 +176,7 @@ def submit(audio_url:, language_code: nil, language_detection: nil, language_con punctuate: punctuate, format_text: format_text, disfluencies: disfluencies, + multichannel: multichannel, dual_channel: dual_channel, webhook_url: webhook_url, webhook_auth_header_name: webhook_auth_header_name, @@ -380,7 +385,7 @@ def initialize(request_client:) # Transcripts are sorted from newest to oldest. The previous URL always points to # a page with older transcripts. # - # @param limit [Long] Maximum amount of transcripts to retrieve + # @param limit [Integer] Maximum amount of transcripts to retrieve # @param status [AssemblyAI::Transcripts::TranscriptStatus] Filter by transcript status # @param created_on [String] Only get transcripts created on this date # @param before_id [String] Get transcripts that were created before this transcript ID @@ -430,12 +435,16 @@ def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false # @param format_text [Boolean] Enable Text Formatting, can be true or false # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false + # @param multichannel [Boolean] Enable + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # transcription, can be true or false. # @param dual_channel [Boolean] Enable [Dual # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) # transcription, can be true or false. - # @param webhook_url [String] The URL to which we send webhook requests. We sends two different types of - # webhook requests. One request when a transcript is completed or failed, and one - # request when the redacted audio is ready if redact_pii_audio is enabled. + # @param webhook_url [String] The URL to which we send webhook requests. + # We sends two different types of webhook requests. + # One request when a transcript is completed or failed, and one request when the + # redacted audio is ready if redact_pii_audio is enabled. # @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook # requests # @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook @@ -505,7 +514,7 @@ def list(limit: nil, status: nil, created_on: nil, before_id: nil, after_id: nil # ) # api.transcripts.submit(audio_url: "https://assembly.ai/wildfires.mp3") def submit(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil, - punctuate: nil, format_text: nil, disfluencies: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil) + punctuate: nil, format_text: nil, disfluencies: nil, multichannel: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil) Async do response = @request_client.conn.post do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -520,6 +529,7 @@ def submit(audio_url:, language_code: nil, language_detection: nil, language_con punctuate: punctuate, format_text: format_text, disfluencies: disfluencies, + multichannel: multichannel, dual_channel: dual_channel, webhook_url: webhook_url, webhook_auth_header_name: webhook_auth_header_name, diff --git a/lib/assemblyai/transcripts/types/content_safety_labels_result.rb b/lib/assemblyai/transcripts/types/content_safety_labels_result.rb index 0b7770b..2cd2915 100644 --- a/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +++ b/lib/assemblyai/transcripts/types/content_safety_labels_result.rb @@ -15,7 +15,7 @@ class ContentSafetyLabelsResult # @return [AssemblyAI::Transcripts::AudioIntelligenceModelStatus] The status of the Content Moderation model. Either success, or unavailable in # the rare case that the model failed. attr_reader :status - # @return [Array] + # @return [Array] An array of results for the Content Moderation model attr_reader :results # @return [Hash{String => Float}] A summary of the Content Moderation confidence results for the entire audio file attr_reader :summary @@ -31,7 +31,7 @@ class ContentSafetyLabelsResult # @param status [AssemblyAI::Transcripts::AudioIntelligenceModelStatus] The status of the Content Moderation model. Either success, or unavailable in # the rare case that the model failed. - # @param results [Array] + # @param results [Array] An array of results for the Content Moderation model # @param summary [Hash{String => Float}] A summary of the Content Moderation confidence results for the entire audio file # @param severity_score_summary [Hash{String => AssemblyAI::Transcripts::SeverityScoreSummary}] A summary of the Content Moderation severity results for the entire audio file # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition diff --git a/lib/assemblyai/transcripts/types/paragraphs_response.rb b/lib/assemblyai/transcripts/types/paragraphs_response.rb index 3566571..283e5d1 100644 --- a/lib/assemblyai/transcripts/types/paragraphs_response.rb +++ b/lib/assemblyai/transcripts/types/paragraphs_response.rb @@ -7,13 +7,13 @@ module AssemblyAI class Transcripts class ParagraphsResponse - # @return [String] + # @return [String] The unique identifier of your transcript attr_reader :id - # @return [Float] + # @return [Float] The confidence score for the transcript attr_reader :confidence - # @return [Float] + # @return [Float] The duration of the audio file in seconds attr_reader :audio_duration - # @return [Array] + # @return [Array] An array of paragraphs in the transcript attr_reader :paragraphs # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties @@ -23,10 +23,10 @@ class ParagraphsResponse OMIT = Object.new - # @param id [String] - # @param confidence [Float] - # @param audio_duration [Float] - # @param paragraphs [Array] + # @param id [String] The unique identifier of your transcript + # @param confidence [Float] The confidence score for the transcript + # @param audio_duration [Float] The duration of the audio file in seconds + # @param paragraphs [Array] An array of paragraphs in the transcript # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::ParagraphsResponse] def initialize(id:, confidence:, audio_duration:, paragraphs:, additional_properties: nil) diff --git a/lib/assemblyai/transcripts/types/sentences_response.rb b/lib/assemblyai/transcripts/types/sentences_response.rb index 1c8ec7d..93fab41 100644 --- a/lib/assemblyai/transcripts/types/sentences_response.rb +++ b/lib/assemblyai/transcripts/types/sentences_response.rb @@ -7,13 +7,13 @@ module AssemblyAI class Transcripts class SentencesResponse - # @return [String] + # @return [String] The unique identifier for the transcript attr_reader :id - # @return [Float] + # @return [Float] The confidence score for the transcript attr_reader :confidence - # @return [Float] + # @return [Float] The duration of the audio file in seconds attr_reader :audio_duration - # @return [Array] + # @return [Array] An array of sentences in the transcript attr_reader :sentences # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties @@ -23,10 +23,10 @@ class SentencesResponse OMIT = Object.new - # @param id [String] - # @param confidence [Float] - # @param audio_duration [Float] - # @param sentences [Array] + # @param id [String] The unique identifier for the transcript + # @param confidence [Float] The confidence score for the transcript + # @param audio_duration [Float] The duration of the audio file in seconds + # @param sentences [Array] An array of sentences in the transcript # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::SentencesResponse] def initialize(id:, confidence:, audio_duration:, sentences:, additional_properties: nil) diff --git a/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb b/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb index 5541137..c6e7d7c 100644 --- a/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +++ b/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb @@ -18,6 +18,9 @@ class SentimentAnalysisResult attr_reader :sentiment # @return [Float] The confidence score for the detected sentiment of the sentence, from 0 to 1 attr_reader :confidence + # @return [String] The channel of this utterance. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. + attr_reader :channel # @return [String] The speaker of the sentence if [Speaker # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is # enabled, else null @@ -35,17 +38,21 @@ class SentimentAnalysisResult # @param end_ [Integer] The ending time, in milliseconds, of the sentence # @param sentiment [AssemblyAI::Transcripts::Sentiment] The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE # @param confidence [Float] The confidence score for the detected sentiment of the sentence, from 0 to 1 + # @param channel [String] The channel of this utterance. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. # @param speaker [String] The speaker of the sentence if [Speaker # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is # enabled, else null # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::SentimentAnalysisResult] - def initialize(text:, start:, end_:, sentiment:, confidence:, speaker: OMIT, additional_properties: nil) + def initialize(text:, start:, end_:, sentiment:, confidence:, channel: OMIT, speaker: OMIT, + additional_properties: nil) @text = text @start = start @end_ = end_ @sentiment = sentiment @confidence = confidence + @channel = channel if channel != OMIT @speaker = speaker if speaker != OMIT @additional_properties = additional_properties @_field_set = { @@ -54,6 +61,7 @@ def initialize(text:, start:, end_:, sentiment:, confidence:, speaker: OMIT, add "end": end_, "sentiment": sentiment, "confidence": confidence, + "channel": channel, "speaker": speaker }.reject do |_k, v| v == OMIT @@ -71,6 +79,7 @@ def self.from_json(json_object:) end_ = struct["end"] sentiment = struct["sentiment"] confidence = struct["confidence"] + channel = struct["channel"] speaker = struct["speaker"] new( text: text, @@ -78,6 +87,7 @@ def self.from_json(json_object:) end_: end_, sentiment: sentiment, confidence: confidence, + channel: channel, speaker: speaker, additional_properties: struct ) @@ -102,6 +112,7 @@ def self.validate_raw(obj:) obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.") obj.sentiment.is_a?(AssemblyAI::Transcripts::Sentiment) != false || raise("Passed value for field obj.sentiment is not the expected type, validation failed.") obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.") + obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.") end end diff --git a/lib/assemblyai/transcripts/types/topic_detection_result.rb b/lib/assemblyai/transcripts/types/topic_detection_result.rb index 2a83d8d..0ff11c8 100644 --- a/lib/assemblyai/transcripts/types/topic_detection_result.rb +++ b/lib/assemblyai/transcripts/types/topic_detection_result.rb @@ -11,7 +11,7 @@ class Transcripts class TopicDetectionResult # @return [String] The text in the transcript in which a detected topic occurs attr_reader :text - # @return [Array] + # @return [Array] An array of detected topics in the text attr_reader :labels # @return [AssemblyAI::Transcripts::Timestamp] attr_reader :timestamp @@ -24,7 +24,7 @@ class TopicDetectionResult OMIT = Object.new # @param text [String] The text in the transcript in which a detected topic occurs - # @param labels [Array] + # @param labels [Array] An array of detected topics in the text # @param timestamp [AssemblyAI::Transcripts::Timestamp] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TopicDetectionResult] diff --git a/lib/assemblyai/transcripts/types/transcript.rb b/lib/assemblyai/transcripts/types/transcript.rb index 83375f5..832d6ba 100644 --- a/lib/assemblyai/transcripts/types/transcript.rb +++ b/lib/assemblyai/transcripts/types/transcript.rb @@ -40,7 +40,6 @@ class Transcript attr_reader :language_detection # @return [Float] The confidence threshold for the automatically detected language. # An error will be returned if the language confidence is below this threshold. - # Defaults to 0. attr_reader :language_confidence_threshold # @return [Float] The confidence score for the detected language, between 0.0 (low confidence) and # 1.0 (high confidence) @@ -72,6 +71,13 @@ class Transcript attr_reader :format_text # @return [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false attr_reader :disfluencies + # @return [Boolean] Whether [Multichannel + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # was enabled in the transcription request, either true or false + attr_reader :multichannel + # @return [Integer] The number of audio channels in the audio file. This is only present when + # multichannel is enabled. + attr_reader :audio_channels # @return [Boolean] Whether [Dual channel # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) # was enabled in the transcription request, either true or false @@ -224,7 +230,6 @@ class Transcript # is enabled, either true or false # @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language. # An error will be returned if the language confidence is below this threshold. - # Defaults to 0. # @param language_confidence [Float] The confidence score for the detected language, between 0.0 (low confidence) and # 1.0 (high confidence) # @param speech_model [AssemblyAI::Transcripts::SpeechModel] @@ -245,6 +250,11 @@ class Transcript # @param punctuate [Boolean] Whether Automatic Punctuation is enabled, either true or false # @param format_text [Boolean] Whether Text Formatting is enabled, either true or false # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false + # @param multichannel [Boolean] Whether [Multichannel + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # was enabled in the transcription request, either true or false + # @param audio_channels [Integer] The number of audio channels in the audio file. This is only present when + # multichannel is enabled. # @param dual_channel [Boolean] Whether [Dual channel # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) # was enabled in the transcription request, either true or false @@ -337,7 +347,7 @@ class Transcript # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::Transcript] def initialize(id:, audio_url:, status:, webhook_auth:, auto_highlights:, redact_pii:, summarization:, language_model:, acoustic_model:, language_code: OMIT, language_detection: OMIT, - language_confidence_threshold: OMIT, language_confidence: OMIT, speech_model: OMIT, text: OMIT, words: OMIT, utterances: OMIT, confidence: OMIT, audio_duration: OMIT, punctuate: OMIT, format_text: OMIT, disfluencies: OMIT, dual_channel: OMIT, webhook_url: OMIT, webhook_status_code: OMIT, webhook_auth_header_name: OMIT, speed_boost: OMIT, auto_highlights_result: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_labels: OMIT, iab_categories: OMIT, iab_categories_result: OMIT, custom_spelling: OMIT, auto_chapters: OMIT, chapters: OMIT, summary_type: OMIT, summary_model: OMIT, summary: OMIT, custom_topics: OMIT, topics: OMIT, sentiment_analysis: OMIT, sentiment_analysis_results: OMIT, entity_detection: OMIT, entities: OMIT, speech_threshold: OMIT, throttled: OMIT, error: OMIT, additional_properties: nil) + language_confidence_threshold: OMIT, language_confidence: OMIT, speech_model: OMIT, text: OMIT, words: OMIT, utterances: OMIT, confidence: OMIT, audio_duration: OMIT, punctuate: OMIT, format_text: OMIT, disfluencies: OMIT, multichannel: OMIT, audio_channels: OMIT, dual_channel: OMIT, webhook_url: OMIT, webhook_status_code: OMIT, webhook_auth_header_name: OMIT, speed_boost: OMIT, auto_highlights_result: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_labels: OMIT, iab_categories: OMIT, iab_categories_result: OMIT, custom_spelling: OMIT, auto_chapters: OMIT, chapters: OMIT, summary_type: OMIT, summary_model: OMIT, summary: OMIT, custom_topics: OMIT, topics: OMIT, sentiment_analysis: OMIT, sentiment_analysis_results: OMIT, entity_detection: OMIT, entities: OMIT, speech_threshold: OMIT, throttled: OMIT, error: OMIT, additional_properties: nil) @id = id @audio_url = audio_url @status = status @@ -354,6 +364,8 @@ def initialize(id:, audio_url:, status:, webhook_auth:, auto_highlights:, redact @punctuate = punctuate if punctuate != OMIT @format_text = format_text if format_text != OMIT @disfluencies = disfluencies if disfluencies != OMIT + @multichannel = multichannel if multichannel != OMIT + @audio_channels = audio_channels if audio_channels != OMIT @dual_channel = dual_channel if dual_channel != OMIT @webhook_url = webhook_url if webhook_url != OMIT @webhook_status_code = webhook_status_code if webhook_status_code != OMIT @@ -414,6 +426,8 @@ def initialize(id:, audio_url:, status:, webhook_auth:, auto_highlights:, redact "punctuate": punctuate, "format_text": format_text, "disfluencies": disfluencies, + "multichannel": multichannel, + "audio_channels": audio_channels, "dual_channel": dual_channel, "webhook_url": webhook_url, "webhook_status_code": webhook_status_code, @@ -490,6 +504,8 @@ def self.from_json(json_object:) punctuate = struct["punctuate"] format_text = struct["format_text"] disfluencies = struct["disfluencies"] + multichannel = struct["multichannel"] + audio_channels = struct["audio_channels"] dual_channel = struct["dual_channel"] webhook_url = struct["webhook_url"] webhook_status_code = struct["webhook_status_code"] @@ -576,6 +592,8 @@ def self.from_json(json_object:) punctuate: punctuate, format_text: format_text, disfluencies: disfluencies, + multichannel: multichannel, + audio_channels: audio_channels, dual_channel: dual_channel, webhook_url: webhook_url, webhook_status_code: webhook_status_code, @@ -652,6 +670,8 @@ def self.validate_raw(obj:) obj.punctuate&.is_a?(Boolean) != false || raise("Passed value for field obj.punctuate is not the expected type, validation failed.") obj.format_text&.is_a?(Boolean) != false || raise("Passed value for field obj.format_text is not the expected type, validation failed.") obj.disfluencies&.is_a?(Boolean) != false || raise("Passed value for field obj.disfluencies is not the expected type, validation failed.") + obj.multichannel&.is_a?(Boolean) != false || raise("Passed value for field obj.multichannel is not the expected type, validation failed.") + obj.audio_channels&.is_a?(Integer) != false || raise("Passed value for field obj.audio_channels is not the expected type, validation failed.") obj.dual_channel&.is_a?(Boolean) != false || raise("Passed value for field obj.dual_channel is not the expected type, validation failed.") obj.webhook_url&.is_a?(String) != false || raise("Passed value for field obj.webhook_url is not the expected type, validation failed.") obj.webhook_status_code&.is_a?(Integer) != false || raise("Passed value for field obj.webhook_status_code is not the expected type, validation failed.") diff --git a/lib/assemblyai/transcripts/types/transcript_list.rb b/lib/assemblyai/transcripts/types/transcript_list.rb index 0d11965..e627102 100644 --- a/lib/assemblyai/transcripts/types/transcript_list.rb +++ b/lib/assemblyai/transcripts/types/transcript_list.rb @@ -10,9 +10,9 @@ class Transcripts # A list of transcripts. Transcripts are sorted from newest to oldest. The # previous URL always points to a page with older transcripts. class TranscriptList - # @return [AssemblyAI::Transcripts::PageDetails] + # @return [AssemblyAI::Transcripts::PageDetails] Details of the transcript page attr_reader :page_details - # @return [Array] + # @return [Array] An array of transcripts attr_reader :transcripts # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties @@ -22,8 +22,8 @@ class TranscriptList OMIT = Object.new - # @param page_details [AssemblyAI::Transcripts::PageDetails] - # @param transcripts [Array] + # @param page_details [AssemblyAI::Transcripts::PageDetails] Details of the transcript page + # @param transcripts [Array] An array of transcripts # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TranscriptList] def initialize(page_details:, transcripts:, additional_properties: nil) diff --git a/lib/assemblyai/transcripts/types/transcript_list_item.rb b/lib/assemblyai/transcripts/types/transcript_list_item.rb index f6d1f90..b4d94e1 100644 --- a/lib/assemblyai/transcripts/types/transcript_list_item.rb +++ b/lib/assemblyai/transcripts/types/transcript_list_item.rb @@ -8,17 +8,17 @@ module AssemblyAI class Transcripts class TranscriptListItem - # @return [String] + # @return [String] The unique identifier for the transcript attr_reader :id - # @return [String] + # @return [String] The URL to retrieve the transcript attr_reader :resource_url - # @return [AssemblyAI::Transcripts::TranscriptStatus] + # @return [AssemblyAI::Transcripts::TranscriptStatus] The status of the transcript attr_reader :status - # @return [DateTime] + # @return [DateTime] The date and time the transcript was created attr_reader :created - # @return [DateTime] + # @return [DateTime] The date and time the transcript was completed attr_reader :completed - # @return [String] + # @return [String] The URL to the audio file attr_reader :audio_url # @return [String] Error message of why the transcript failed attr_reader :error @@ -30,12 +30,12 @@ class TranscriptListItem OMIT = Object.new - # @param id [String] - # @param resource_url [String] - # @param status [AssemblyAI::Transcripts::TranscriptStatus] - # @param created [DateTime] - # @param completed [DateTime] - # @param audio_url [String] + # @param id [String] The unique identifier for the transcript + # @param resource_url [String] The URL to retrieve the transcript + # @param status [AssemblyAI::Transcripts::TranscriptStatus] The status of the transcript + # @param created [DateTime] The date and time the transcript was created + # @param completed [DateTime] The date and time the transcript was completed + # @param audio_url [String] The URL to the audio file # @param error [String] Error message of why the transcript failed # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TranscriptListItem] diff --git a/lib/assemblyai/transcripts/types/transcript_optional_params.rb b/lib/assemblyai/transcripts/types/transcript_optional_params.rb index 60eedb0..51c503e 100644 --- a/lib/assemblyai/transcripts/types/transcript_optional_params.rb +++ b/lib/assemblyai/transcripts/types/transcript_optional_params.rb @@ -34,13 +34,18 @@ class TranscriptOptionalParams attr_reader :format_text # @return [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false attr_reader :disfluencies + # @return [Boolean] Enable + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # transcription, can be true or false. + attr_reader :multichannel # @return [Boolean] Enable [Dual # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) # transcription, can be true or false. attr_reader :dual_channel - # @return [String] The URL to which we send webhook requests. We sends two different types of - # webhook requests. One request when a transcript is completed or failed, and one - # request when the redacted audio is ready if redact_pii_audio is enabled. + # @return [String] The URL to which we send webhook requests. + # We sends two different types of webhook requests. + # One request when a transcript is completed or failed, and one request when the + # redacted audio is ready if redact_pii_audio is enabled. attr_reader :webhook_url # @return [String] The header name to be sent with the transcript completed or failed webhook # requests @@ -145,12 +150,16 @@ class TranscriptOptionalParams # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false # @param format_text [Boolean] Enable Text Formatting, can be true or false # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false + # @param multichannel [Boolean] Enable + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # transcription, can be true or false. # @param dual_channel [Boolean] Enable [Dual # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) # transcription, can be true or false. - # @param webhook_url [String] The URL to which we send webhook requests. We sends two different types of - # webhook requests. One request when a transcript is completed or failed, and one - # request when the redacted audio is ready if redact_pii_audio is enabled. + # @param webhook_url [String] The URL to which we send webhook requests. + # We sends two different types of webhook requests. + # One request when a transcript is completed or failed, and one request when the + # redacted audio is ready if redact_pii_audio is enabled. # @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook # requests # @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook @@ -210,7 +219,7 @@ class TranscriptOptionalParams # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TranscriptOptionalParams] def initialize(language_code: OMIT, language_detection: OMIT, language_confidence_threshold: OMIT, - speech_model: OMIT, punctuate: OMIT, format_text: OMIT, disfluencies: OMIT, dual_channel: OMIT, webhook_url: OMIT, webhook_auth_header_name: OMIT, webhook_auth_header_value: OMIT, auto_highlights: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_confidence: OMIT, iab_categories: OMIT, custom_spelling: OMIT, sentiment_analysis: OMIT, auto_chapters: OMIT, entity_detection: OMIT, speech_threshold: OMIT, summarization: OMIT, summary_model: OMIT, summary_type: OMIT, custom_topics: OMIT, topics: OMIT, additional_properties: nil) + speech_model: OMIT, punctuate: OMIT, format_text: OMIT, disfluencies: OMIT, multichannel: OMIT, dual_channel: OMIT, webhook_url: OMIT, webhook_auth_header_name: OMIT, webhook_auth_header_value: OMIT, auto_highlights: OMIT, audio_start_from: OMIT, audio_end_at: OMIT, word_boost: OMIT, boost_param: OMIT, filter_profanity: OMIT, redact_pii: OMIT, redact_pii_audio: OMIT, redact_pii_audio_quality: OMIT, redact_pii_policies: OMIT, redact_pii_sub: OMIT, speaker_labels: OMIT, speakers_expected: OMIT, content_safety: OMIT, content_safety_confidence: OMIT, iab_categories: OMIT, custom_spelling: OMIT, sentiment_analysis: OMIT, auto_chapters: OMIT, entity_detection: OMIT, speech_threshold: OMIT, summarization: OMIT, summary_model: OMIT, summary_type: OMIT, custom_topics: OMIT, topics: OMIT, additional_properties: nil) @language_code = language_code if language_code != OMIT @language_detection = language_detection if language_detection != OMIT @language_confidence_threshold = language_confidence_threshold if language_confidence_threshold != OMIT @@ -218,6 +227,7 @@ def initialize(language_code: OMIT, language_detection: OMIT, language_confidenc @punctuate = punctuate if punctuate != OMIT @format_text = format_text if format_text != OMIT @disfluencies = disfluencies if disfluencies != OMIT + @multichannel = multichannel if multichannel != OMIT @dual_channel = dual_channel if dual_channel != OMIT @webhook_url = webhook_url if webhook_url != OMIT @webhook_auth_header_name = webhook_auth_header_name if webhook_auth_header_name != OMIT @@ -257,6 +267,7 @@ def initialize(language_code: OMIT, language_detection: OMIT, language_confidenc "punctuate": punctuate, "format_text": format_text, "disfluencies": disfluencies, + "multichannel": multichannel, "dual_channel": dual_channel, "webhook_url": webhook_url, "webhook_auth_header_name": webhook_auth_header_name, @@ -306,6 +317,7 @@ def self.from_json(json_object:) punctuate = struct["punctuate"] format_text = struct["format_text"] disfluencies = struct["disfluencies"] + multichannel = struct["multichannel"] dual_channel = struct["dual_channel"] webhook_url = struct["webhook_url"] webhook_auth_header_name = struct["webhook_auth_header_name"] @@ -347,6 +359,7 @@ def self.from_json(json_object:) punctuate: punctuate, format_text: format_text, disfluencies: disfluencies, + multichannel: multichannel, dual_channel: dual_channel, webhook_url: webhook_url, webhook_auth_header_name: webhook_auth_header_name, @@ -402,6 +415,7 @@ def self.validate_raw(obj:) obj.punctuate&.is_a?(Boolean) != false || raise("Passed value for field obj.punctuate is not the expected type, validation failed.") obj.format_text&.is_a?(Boolean) != false || raise("Passed value for field obj.format_text is not the expected type, validation failed.") obj.disfluencies&.is_a?(Boolean) != false || raise("Passed value for field obj.disfluencies is not the expected type, validation failed.") + obj.multichannel&.is_a?(Boolean) != false || raise("Passed value for field obj.multichannel is not the expected type, validation failed.") obj.dual_channel&.is_a?(Boolean) != false || raise("Passed value for field obj.dual_channel is not the expected type, validation failed.") obj.webhook_url&.is_a?(String) != false || raise("Passed value for field obj.webhook_url is not the expected type, validation failed.") obj.webhook_auth_header_name&.is_a?(String) != false || raise("Passed value for field obj.webhook_auth_header_name is not the expected type, validation failed.") diff --git a/lib/assemblyai/transcripts/types/transcript_paragraph.rb b/lib/assemblyai/transcripts/types/transcript_paragraph.rb index 4649c9b..3633e89 100644 --- a/lib/assemblyai/transcripts/types/transcript_paragraph.rb +++ b/lib/assemblyai/transcripts/types/transcript_paragraph.rb @@ -7,20 +7,16 @@ module AssemblyAI class Transcripts class TranscriptParagraph - # @return [String] + # @return [String] The transcript of the paragraph attr_reader :text - # @return [Integer] + # @return [Integer] The starting time, in milliseconds, of the paragraph attr_reader :start - # @return [Integer] + # @return [Integer] The ending time, in milliseconds, of the paragraph attr_reader :end_ - # @return [Float] + # @return [Float] The confidence score for the transcript of this paragraph attr_reader :confidence - # @return [Array] + # @return [Array] An array of words in the paragraph attr_reader :words - # @return [String] The speaker of the sentence if [Speaker - # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is - # enabled, else null - attr_reader :speaker # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -29,34 +25,21 @@ class TranscriptParagraph OMIT = Object.new - # @param text [String] - # @param start [Integer] - # @param end_ [Integer] - # @param confidence [Float] - # @param words [Array] - # @param speaker [String] The speaker of the sentence if [Speaker - # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is - # enabled, else null + # @param text [String] The transcript of the paragraph + # @param start [Integer] The starting time, in milliseconds, of the paragraph + # @param end_ [Integer] The ending time, in milliseconds, of the paragraph + # @param confidence [Float] The confidence score for the transcript of this paragraph + # @param words [Array] An array of words in the paragraph # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TranscriptParagraph] - def initialize(text:, start:, end_:, confidence:, words:, speaker: OMIT, additional_properties: nil) + def initialize(text:, start:, end_:, confidence:, words:, additional_properties: nil) @text = text @start = start @end_ = end_ @confidence = confidence @words = words - @speaker = speaker if speaker != OMIT @additional_properties = additional_properties - @_field_set = { - "text": text, - "start": start, - "end": end_, - "confidence": confidence, - "words": words, - "speaker": speaker - }.reject do |_k, v| - v == OMIT - end + @_field_set = { "text": text, "start": start, "end": end_, "confidence": confidence, "words": words } end # Deserialize a JSON object to an instance of TranscriptParagraph @@ -74,14 +57,12 @@ def self.from_json(json_object:) v = v.to_json AssemblyAI::Transcripts::TranscriptWord.from_json(json_object: v) end - speaker = struct["speaker"] new( text: text, start: start, end_: end_, confidence: confidence, words: words, - speaker: speaker, additional_properties: struct ) end @@ -105,7 +86,6 @@ def self.validate_raw(obj:) obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.") obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.") obj.words.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.") - obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.") end end end diff --git a/lib/assemblyai/transcripts/types/transcript_sentence.rb b/lib/assemblyai/transcripts/types/transcript_sentence.rb index 867db3f..3c052a5 100644 --- a/lib/assemblyai/transcripts/types/transcript_sentence.rb +++ b/lib/assemblyai/transcripts/types/transcript_sentence.rb @@ -7,16 +7,19 @@ module AssemblyAI class Transcripts class TranscriptSentence - # @return [String] + # @return [String] The transcript of the sentence attr_reader :text - # @return [Integer] + # @return [Integer] The starting time, in milliseconds, for the sentence attr_reader :start - # @return [Integer] + # @return [Integer] The ending time, in milliseconds, for the sentence attr_reader :end_ - # @return [Float] + # @return [Float] The confidence score for the transcript of this sentence attr_reader :confidence - # @return [Array] + # @return [Array] An array of words in the sentence attr_reader :words + # @return [String] The channel of the sentence. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. + attr_reader :channel # @return [String] The speaker of the sentence if [Speaker # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is # enabled, else null @@ -29,22 +32,26 @@ class TranscriptSentence OMIT = Object.new - # @param text [String] - # @param start [Integer] - # @param end_ [Integer] - # @param confidence [Float] - # @param words [Array] + # @param text [String] The transcript of the sentence + # @param start [Integer] The starting time, in milliseconds, for the sentence + # @param end_ [Integer] The ending time, in milliseconds, for the sentence + # @param confidence [Float] The confidence score for the transcript of this sentence + # @param words [Array] An array of words in the sentence + # @param channel [String] The channel of the sentence. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. # @param speaker [String] The speaker of the sentence if [Speaker # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is # enabled, else null # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TranscriptSentence] - def initialize(text:, start:, end_:, confidence:, words:, speaker: OMIT, additional_properties: nil) + def initialize(text:, start:, end_:, confidence:, words:, channel: OMIT, speaker: OMIT, + additional_properties: nil) @text = text @start = start @end_ = end_ @confidence = confidence @words = words + @channel = channel if channel != OMIT @speaker = speaker if speaker != OMIT @additional_properties = additional_properties @_field_set = { @@ -53,6 +60,7 @@ def initialize(text:, start:, end_:, confidence:, words:, speaker: OMIT, additio "end": end_, "confidence": confidence, "words": words, + "channel": channel, "speaker": speaker }.reject do |_k, v| v == OMIT @@ -74,6 +82,7 @@ def self.from_json(json_object:) v = v.to_json AssemblyAI::Transcripts::TranscriptWord.from_json(json_object: v) end + channel = struct["channel"] speaker = struct["speaker"] new( text: text, @@ -81,6 +90,7 @@ def self.from_json(json_object:) end_: end_, confidence: confidence, words: words, + channel: channel, speaker: speaker, additional_properties: struct ) @@ -105,6 +115,7 @@ def self.validate_raw(obj:) obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.") obj.confidence.is_a?(Float) != false || raise("Passed value for field obj.confidence is not the expected type, validation failed.") obj.words.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.") + obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.") end end diff --git a/lib/assemblyai/transcripts/types/transcript_utterance.rb b/lib/assemblyai/transcripts/types/transcript_utterance.rb index a39cf54..fadc0f1 100644 --- a/lib/assemblyai/transcripts/types/transcript_utterance.rb +++ b/lib/assemblyai/transcripts/types/transcript_utterance.rb @@ -17,6 +17,9 @@ class TranscriptUtterance attr_reader :text # @return [Array] The words in the utterance. attr_reader :words + # @return [String] The channel of this utterance. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. + attr_reader :channel # @return [String] The speaker of this utterance, where each speaker is assigned a sequential # capital letter - e.g. "A" for Speaker A, "B" for Speaker B, etc. attr_reader :speaker @@ -33,16 +36,19 @@ class TranscriptUtterance # @param end_ [Integer] The ending time, in milliseconds, of the utterance in the audio file # @param text [String] The text for this utterance # @param words [Array] The words in the utterance. + # @param channel [String] The channel of this utterance. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. # @param speaker [String] The speaker of this utterance, where each speaker is assigned a sequential # capital letter - e.g. "A" for Speaker A, "B" for Speaker B, etc. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TranscriptUtterance] - def initialize(confidence:, start:, end_:, text:, words:, speaker:, additional_properties: nil) + def initialize(confidence:, start:, end_:, text:, words:, speaker:, channel: OMIT, additional_properties: nil) @confidence = confidence @start = start @end_ = end_ @text = text @words = words + @channel = channel if channel != OMIT @speaker = speaker @additional_properties = additional_properties @_field_set = { @@ -51,8 +57,11 @@ def initialize(confidence:, start:, end_:, text:, words:, speaker:, additional_p "end": end_, "text": text, "words": words, + "channel": channel, "speaker": speaker - } + }.reject do |_k, v| + v == OMIT + end end # Deserialize a JSON object to an instance of TranscriptUtterance @@ -70,6 +79,7 @@ def self.from_json(json_object:) v = v.to_json AssemblyAI::Transcripts::TranscriptWord.from_json(json_object: v) end + channel = struct["channel"] speaker = struct["speaker"] new( confidence: confidence, @@ -77,6 +87,7 @@ def self.from_json(json_object:) end_: end_, text: text, words: words, + channel: channel, speaker: speaker, additional_properties: struct ) @@ -101,6 +112,7 @@ def self.validate_raw(obj:) obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.") obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.") obj.words.is_a?(Array) != false || raise("Passed value for field obj.words is not the expected type, validation failed.") + obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.speaker.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.") end end diff --git a/lib/assemblyai/transcripts/types/transcript_word.rb b/lib/assemblyai/transcripts/types/transcript_word.rb index 8c70991..7c53047 100644 --- a/lib/assemblyai/transcripts/types/transcript_word.rb +++ b/lib/assemblyai/transcripts/types/transcript_word.rb @@ -6,15 +6,18 @@ module AssemblyAI class Transcripts class TranscriptWord - # @return [Float] + # @return [Float] The confidence score for the transcript of this word attr_reader :confidence - # @return [Integer] + # @return [Integer] The starting time, in milliseconds, for the word attr_reader :start - # @return [Integer] + # @return [Integer] The ending time, in milliseconds, for the word attr_reader :end_ - # @return [String] + # @return [String] The text of the word attr_reader :text - # @return [String] The speaker of the sentence if [Speaker + # @return [String] The channel of the word. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. + attr_reader :channel + # @return [String] The speaker of the word if [Speaker # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is # enabled, else null attr_reader :speaker @@ -26,20 +29,23 @@ class TranscriptWord OMIT = Object.new - # @param confidence [Float] - # @param start [Integer] - # @param end_ [Integer] - # @param text [String] - # @param speaker [String] The speaker of the sentence if [Speaker + # @param confidence [Float] The confidence score for the transcript of this word + # @param start [Integer] The starting time, in milliseconds, for the word + # @param end_ [Integer] The ending time, in milliseconds, for the word + # @param text [String] The text of the word + # @param channel [String] The channel of the word. The left and right channels are channels 1 and 2. + # Additional channels increment the channel number sequentially. + # @param speaker [String] The speaker of the word if [Speaker # Diarization](https://www.assemblyai.com/docs/models/speaker-diarization) is # enabled, else null # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [AssemblyAI::Transcripts::TranscriptWord] - def initialize(confidence:, start:, end_:, text:, speaker: OMIT, additional_properties: nil) + def initialize(confidence:, start:, end_:, text:, channel: OMIT, speaker: OMIT, additional_properties: nil) @confidence = confidence @start = start @end_ = end_ @text = text + @channel = channel if channel != OMIT @speaker = speaker if speaker != OMIT @additional_properties = additional_properties @_field_set = { @@ -47,6 +53,7 @@ def initialize(confidence:, start:, end_:, text:, speaker: OMIT, additional_prop "start": start, "end": end_, "text": text, + "channel": channel, "speaker": speaker }.reject do |_k, v| v == OMIT @@ -63,12 +70,14 @@ def self.from_json(json_object:) start = struct["start"] end_ = struct["end"] text = struct["text"] + channel = struct["channel"] speaker = struct["speaker"] new( confidence: confidence, start: start, end_: end_, text: text, + channel: channel, speaker: speaker, additional_properties: struct ) @@ -92,6 +101,7 @@ def self.validate_raw(obj:) obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.") obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.") obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.") + obj.channel&.is_a?(String) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.speaker&.is_a?(String) != false || raise("Passed value for field obj.speaker is not the expected type, validation failed.") end end From 67f51079af34300034fcfdb9ea8b4ca1f7ed88f5 Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:03:01 -0400 Subject: [PATCH 2/4] Add multichannel integration test --- lib/assemblyai/transcripts/polling_client.rb | 216 +++++++++++++------ test/test_assemblyai.rb | 32 +++ 2 files changed, 180 insertions(+), 68 deletions(-) diff --git a/lib/assemblyai/transcripts/polling_client.rb b/lib/assemblyai/transcripts/polling_client.rb index 370ed75..8c5f84d 100644 --- a/lib/assemblyai/transcripts/polling_client.rb +++ b/lib/assemblyai/transcripts/polling_client.rb @@ -26,53 +26,93 @@ class TranscriptsClient # Create a transcript from an audio or video file that is accessible via a URL. # .transcribe polls for completion of the transcription, while the .submit function does not. # - # @param speech_model [Transcripts::SpeechModel] - # @param language_code [Transcripts::TranscriptLanguageCode] + # @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode] + # @param language_detection [Boolean] Enable [Automatic language + # www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection), + # either true or false. + # @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language. + # An error will be returned if the language confidence is below this threshold. + # Defaults to 0. + # @param speech_model [AssemblyAI::Transcripts::SpeechModel] # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false # @param format_text [Boolean] Enable Text Formatting, can be true or false - # @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false. - # @param webhook_url [String] The URL to which AssemblyAI send webhooks upon transcription completion - # @param webhook_auth_header_name [String] The header name which should be sent back with webhook calls - # @param webhook_auth_header_value [String] Specify a header name and value to send back with a webhook call for added security - # @param auto_highlights [Boolean] Whether Key Phrases is enabled, either true or false + # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false + # @param multichannel [Boolean] Enable + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # transcription, can be true or false. + # @param dual_channel [Boolean] Enable [Dual + # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) + # transcription, can be true or false. + # @param webhook_url [String] The URL to which we send webhook requests. + # We sends two different types of webhook requests. + # One request when a transcript is completed or failed, and one request when the + # redacted audio is ready if redact_pii_audio is enabled. + # @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook + # requests + # @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook + # requests for added security + # @param auto_highlights [Boolean] Enable Key Phrases, either true or false # @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file # @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file # @param word_boost [Array] The list of custom vocabulary to boost transcription probability for - # @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value + # @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words # @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false - # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false - # @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be true or false. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details. - # @param redact_pii_audio_quality [Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details. - # @param redact_pii_policies [Array] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details. - # @param redact_pii_sub [Transcripts::SubstitutionPolicy] - # @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false - # @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for more details. - # @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false - # @param content_safety_confidence [Integer] The confidence threshold for content moderation. Values must be between 25 and 100. - # @param iab_categories [Boolean] Enable [Topic Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true or false - # @param language_detection [Boolean] Whether [Automatic language detection](https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection) was enabled in the transcription request, either true or false. - # @param custom_spelling [Array] Customize how words are spelled and formatted using to and from valuesRequest of type Array, as a Hash + # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or + # false + # @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be + # true or false. See [PII + # redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more + # details. + # @param redact_pii_audio_quality [AssemblyAI::Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently + # supports mp3 (default) and wav. See [PII + # redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more + # details. + # @param redact_pii_policies [Array] The list of PII Redaction policies to enable. See [PII + # redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more + # details. + # @param redact_pii_sub [AssemblyAI::Transcripts::SubstitutionPolicy] + # @param speaker_labels [Boolean] Enable [Speaker + # diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be + # true or false + # @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify, + # up to 10. See [Speaker + # diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for + # more details. + # @param content_safety [Boolean] Enable [Content + # Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be + # true or false + # @param content_safety_confidence [Integer] The confidence threshold for the Content Moderation model. Values must be + # between 25 and 100. + # @param iab_categories [Boolean] Enable [Topic + # Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true + # or false + # @param custom_spelling [Array] Customize how words are spelled and formatted using to and from valuesRequest of type Array, as a Hash # * :from (Array) # * :to (String) - # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false - # @param sentiment_analysis [Boolean] Enable [Sentiment Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be true or false - # @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters), can be true or false - # @param entity_detection [Boolean] Enable [Entity Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true or false + # @param sentiment_analysis [Boolean] Enable [Sentiment + # Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be + # true or false + # @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters), + # can be true or false + # @param entity_detection [Boolean] Enable [Entity + # Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true + # or false # @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech. - # Valid values are in the range [0, 1] inclusive. - # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false - # @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript - # @param summary_type [Transcripts::SummaryType] The type of summary - # @param custom_topics [Boolean] Whether custom topics is enabled, either true or false - # @param topics [Array] The list of custom topics provided, if custom topics is enabled + # Valid values are in the range [0, 1] inclusive. + # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), + # can be true or false + # @param summary_model [AssemblyAI::Transcripts::SummaryModel] The model to summarize the transcript + # @param summary_type [AssemblyAI::Transcripts::SummaryType] The type of summary + # @param custom_topics [Boolean] Enable custom topics, either true or false + # @param topics [Array] The list of custom topics # @param audio_url [String] The URL of the audio or video file to transcribe. - # @param request_options [RequestOptions] + # @param request_options [AssemblyAI::RequestOptions] # @param polling_options [Transcripts::PollingOptions] Configuration options for polling requests. # @return [Transcripts::Transcript] - def transcribe(audio_url:, speech_model: nil, language_code: nil, punctuate: nil, format_text: nil, dual_channel: nil, - webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, language_detection: nil, custom_spelling: nil, disfluencies: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new) + def transcribe(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil, + punctuate: nil, format_text: nil, disfluencies: nil, multichannel: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new) transcript = submit(audio_url: audio_url, speech_model: speech_model, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel, - 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, request_options: request_options) + 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, language_confidence_threshold: language_confidence_threshold, custom_spelling: custom_spelling, disfluencies: disfluencies, multichannel: multichannel, 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, request_options: request_options) wait_until_ready(transcript_id: transcript.id, polling_options: polling_options) end @@ -102,54 +142,94 @@ class AsyncTranscriptsClient # Create a transcript from an audio or video file that is accessible via a URL. # .transcribe polls for completion of the transcription, while the .submit function does not. # - # @param speech_model [Transcripts::SpeechModel] - # @param language_code [Transcripts::TranscriptLanguageCode] + # @param language_code [AssemblyAI::Transcripts::TranscriptLanguageCode] + # @param language_detection [Boolean] Enable [Automatic language + # www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection), + # either true or false. + # @param language_confidence_threshold [Float] The confidence threshold for the automatically detected language. + # An error will be returned if the language confidence is below this threshold. + # Defaults to 0. + # @param speech_model [AssemblyAI::Transcripts::SpeechModel] # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false # @param format_text [Boolean] Enable Text Formatting, can be true or false - # @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false. - # @param webhook_url [String] The URL to which AssemblyAI send webhooks upon transcription completion - # @param webhook_auth_header_name [String] The header name which should be sent back with webhook calls - # @param webhook_auth_header_value [String] Specify a header name and value to send back with a webhook call for added security - # @param auto_highlights [Boolean] Whether Key Phrases is enabled, either true or false + # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false + # @param multichannel [Boolean] Enable + # ://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription) + # transcription, can be true or false. + # @param dual_channel [Boolean] Enable [Dual + # ://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) + # transcription, can be true or false. + # @param webhook_url [String] The URL to which we send webhook requests. + # We sends two different types of webhook requests. + # One request when a transcript is completed or failed, and one request when the + # redacted audio is ready if redact_pii_audio is enabled. + # @param webhook_auth_header_name [String] The header name to be sent with the transcript completed or failed webhook + # requests + # @param webhook_auth_header_value [String] The header value to send back with the transcript completed or failed webhook + # requests for added security + # @param auto_highlights [Boolean] Enable Key Phrases, either true or false # @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file # @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file # @param word_boost [Array] The list of custom vocabulary to boost transcription probability for - # @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value + # @param boost_param [AssemblyAI::Transcripts::TranscriptBoostParam] How much to boost specified words # @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false - # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false - # @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be true or false. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details. - # @param redact_pii_audio_quality [Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details. - # @param redact_pii_policies [Array] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details. - # @param redact_pii_sub [Transcripts::SubstitutionPolicy] - # @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false - # @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify, up to 10. See [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for more details. - # @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false - # @param content_safety_confidence [Integer] The confidence threshold for content moderation. Values must be between 25 and 100. - # @param iab_categories [Boolean] Enable [Topic Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true or false - # @param language_detection [Boolean] Whether [Automatic language detection](https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection) was enabled in the transcription request, either true or false. - # @param custom_spelling [Array] Customize how words are spelled and formatted using to and from valuesRequest of type Array, as a Hash + # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or + # false + # @param redact_pii_audio [Boolean] Generate a copy of the original media file with spoken PII "beeped" out, can be + # true or false. See [PII + # redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more + # details. + # @param redact_pii_audio_quality [AssemblyAI::Transcripts::RedactPiiAudioQuality] Controls the filetype of the audio created by redact_pii_audio. Currently + # supports mp3 (default) and wav. See [PII + # redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more + # details. + # @param redact_pii_policies [Array] The list of PII Redaction policies to enable. See [PII + # redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more + # details. + # @param redact_pii_sub [AssemblyAI::Transcripts::SubstitutionPolicy] + # @param speaker_labels [Boolean] Enable [Speaker + # diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be + # true or false + # @param speakers_expected [Integer] Tells the speaker label model how many speakers it should attempt to identify, + # up to 10. See [Speaker + # diarization](https://www.assemblyai.com/docs/models/speaker-diarization) for + # more details. + # @param content_safety [Boolean] Enable [Content + # Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be + # true or false + # @param content_safety_confidence [Integer] The confidence threshold for the Content Moderation model. Values must be + # between 25 and 100. + # @param iab_categories [Boolean] Enable [Topic + # Detection](https://www.assemblyai.com/docs/models/topic-detection), can be true + # or false + # @param custom_spelling [Array] Customize how words are spelled and formatted using to and from valuesRequest of type Array, as a Hash # * :from (Array) # * :to (String) - # @param disfluencies [Boolean] Transcribe Filler Words, like "umm", in your media file; can be true or false - # @param sentiment_analysis [Boolean] Enable [Sentiment Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be true or false - # @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters), can be true or false - # @param entity_detection [Boolean] Enable [Entity Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true or false + # @param sentiment_analysis [Boolean] Enable [Sentiment + # Analysis](https://www.assemblyai.com/docs/models/sentiment-analysis), can be + # true or false + # @param auto_chapters [Boolean] Enable [Auto Chapters](https://www.assemblyai.com/docs/models/auto-chapters), + # can be true or false + # @param entity_detection [Boolean] Enable [Entity + # Detection](https://www.assemblyai.com/docs/models/entity-detection), can be true + # or false # @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech. - # Valid values are in the range [0, 1] inclusive. - # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false - # @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript - # @param summary_type [Transcripts::SummaryType] The type of summary - # @param custom_topics [Boolean] Whether custom topics is enabled, either true or false - # @param topics [Array] The list of custom topics provided, if custom topics is enabled + # Valid values are in the range [0, 1] inclusive. + # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), + # can be true or false + # @param summary_model [AssemblyAI::Transcripts::SummaryModel] The model to summarize the transcript + # @param summary_type [AssemblyAI::Transcripts::SummaryType] The type of summary + # @param custom_topics [Boolean] Enable custom topics, either true or false + # @param topics [Array] The list of custom topics # @param audio_url [String] The URL of the audio or video file to transcribe. - # @param request_options [RequestOptions] + # @param request_options [AssemblyAI::RequestOptions] # @param polling_options [Transcripts::PollingOptions] Configuration options for polling requests. # @return [Transcripts::Transcript] - def transcribe(audio_url:, speech_model: nil, language_code: nil, punctuate: nil, format_text: nil, dual_channel: nil, - webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, language_detection: nil, custom_spelling: nil, disfluencies: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new) + def transcribe(audio_url:, language_code: nil, language_detection: nil, language_confidence_threshold: nil, speech_model: nil, + punctuate: nil, format_text: nil, disfluencies: nil, multichannel: nil, dual_channel: nil, webhook_url: nil, webhook_auth_header_name: nil, webhook_auth_header_value: nil, auto_highlights: nil, audio_start_from: nil, audio_end_at: nil, word_boost: nil, boost_param: nil, filter_profanity: nil, redact_pii: nil, redact_pii_audio: nil, redact_pii_audio_quality: nil, redact_pii_policies: nil, redact_pii_sub: nil, speaker_labels: nil, speakers_expected: nil, content_safety: nil, content_safety_confidence: nil, iab_categories: nil, custom_spelling: nil, sentiment_analysis: nil, auto_chapters: nil, entity_detection: nil, speech_threshold: nil, summarization: nil, summary_model: nil, summary_type: nil, custom_topics: nil, topics: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new) Async do transcript = submit(audio_url: audio_url, speech_model: speech_model, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel, - 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, request_options: request_options).wait + 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, language_confidence_threshold: language_confidence_threshold, custom_spelling: custom_spelling, disfluencies: disfluencies, multichannel: multichannel, 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, request_options: request_options) wait_until_ready(transcript_id: transcript.id, polling_options: polling_options).wait end end diff --git a/test/test_assemblyai.rb b/test/test_assemblyai.rb index 29a9d39..3591480 100644 --- a/test/test_assemblyai.rb +++ b/test/test_assemblyai.rb @@ -122,4 +122,36 @@ def test_lemur assert lemur_task.to_json == lemur_task2.to_json end + + def test_transcribe_multichannel_audio + transcript = client.transcripts.transcribe( + audio_url: "https://assemblyai-test.s3.us-west-2.amazonaws.com/e2e_tests/en_7dot1_audio_channels.wav", + multichannel: true + ) + + expected_output = %w[One. Two. Three. Four. Five. Six. Seven. Eight.] + + assert_equal true, transcript.multichannel + assert_equal expected_output.length, transcript.words.length + assert_equal expected_output.length, transcript.utterances.length + + words = transcript.words + utterances = transcript.utterances + + expected_output.each_with_index do |expected_word, i| + channel_string = (i + 1).to_s + + assert_equal expected_word, words[i].text + assert_equal channel_string, words[i].speaker + assert_equal channel_string, words[i].channel + + assert_equal expected_word, utterances[i].text + assert_equal channel_string, utterances[i].speaker + assert_equal channel_string, utterances[i].channel + assert_equal 1, utterances[i].words.length + assert_equal expected_word, utterances[i].words[0].text + assert_equal channel_string, utterances[i].words[0].speaker + assert_equal channel_string, utterances[i].words[0].channel + end + end end From 77ed1aead4625f6edd57b62a2187dd21d281e088 Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:04:06 -0400 Subject: [PATCH 3/4] Add back ANTHROPIC_CLAUDE2 --- lib/assemblyai/lemur/types/lemur_model.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/assemblyai/lemur/types/lemur_model.rb b/lib/assemblyai/lemur/types/lemur_model.rb index b512981..937efa6 100644 --- a/lib/assemblyai/lemur/types/lemur_model.rb +++ b/lib/assemblyai/lemur/types/lemur_model.rb @@ -9,6 +9,7 @@ class LemurModel ANTHROPIC_CLAUDE3_HAIKU = "anthropic/claude-3-haiku" ANTHROPIC_CLAUDE3_SONNET = "anthropic/claude-3-sonnet" ANTHROPIC_CLAUDE2_1 = "anthropic/claude-2-1" + ANTHROPIC_CLAUDE2 = "anthropic/claude-2" ANTHROPIC_CLAUDE2_0 = "anthropic/claude-2" DEFAULT = "default" ANTHROPIC_CLAUDE_INSTANT1_2 = "anthropic/claude-instant-1-2" From 60476c4f0662139e78489209b4cdd5925e5953ed Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:04:31 -0400 Subject: [PATCH 4/4] Add back ANTHROPIC_CLAUDE2, update version --- lib/gemconfig.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gemconfig.rb b/lib/gemconfig.rb index 4829b6b..bf8a68b 100644 --- a/lib/gemconfig.rb +++ b/lib/gemconfig.rb @@ -2,7 +2,7 @@ module AssemblyAI module Gemconfig - VERSION = "1.1.0" + VERSION = "1.2.0" AUTHORS = ["AssemblyAI"].freeze EMAIL = "support@assemblyai.com" SUMMARY = "AssemblyAI Ruby SDK"