assemblyai 1.0.0.pre.beta → 1.0.0.pre.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assemblyai/lemur/client.rb +16 -16
  3. data/lib/assemblyai/lemur/types/lemur_base_params.rb +5 -5
  4. data/lib/assemblyai/lemur/types/lemur_base_params_context.rb +3 -29
  5. data/lib/assemblyai/lemur/types/lemur_model.rb +7 -7
  6. data/lib/assemblyai/lemur/types/lemur_question_context.rb +3 -29
  7. data/lib/assemblyai/realtime/types/audio_encoding.rb +5 -2
  8. data/lib/assemblyai/realtime/types/configure_end_utterance_silence_threshold.rb +48 -0
  9. data/lib/assemblyai/realtime/types/force_end_utterance.rb +48 -0
  10. data/lib/assemblyai/realtime/types/message_type.rb +6 -7
  11. data/lib/assemblyai/realtime/types/realtime_base_message.rb +6 -6
  12. data/lib/assemblyai/realtime/types/realtime_message.rb +6 -35
  13. data/lib/assemblyai/realtime/types/realtime_transcript.rb +3 -29
  14. data/lib/assemblyai/realtime/types/realtime_transcript_type.rb +4 -2
  15. data/lib/assemblyai/realtime/types/terminate_session.rb +5 -14
  16. data/lib/assemblyai/transcripts/client.rb +20 -20
  17. data/lib/assemblyai/transcripts/list_by_url_client.rb +57 -0
  18. data/lib/assemblyai/transcripts/polling_client.rb +27 -25
  19. data/lib/assemblyai/transcripts/types/audio_intelligence_model_status.rb +5 -2
  20. data/lib/assemblyai/transcripts/types/content_safety_labels_result.rb +5 -5
  21. data/lib/assemblyai/transcripts/types/entity.rb +6 -11
  22. data/lib/assemblyai/transcripts/types/entity_type.rb +32 -32
  23. data/lib/assemblyai/transcripts/types/pii_policy.rb +29 -30
  24. data/lib/assemblyai/transcripts/types/polling_options.rb +14 -15
  25. data/lib/assemblyai/transcripts/types/redact_pii_audio_quality.rb +5 -2
  26. data/lib/assemblyai/transcripts/types/sentiment.rb +5 -2
  27. data/lib/assemblyai/transcripts/types/sentiment_analysis_result.rb +6 -6
  28. data/lib/assemblyai/transcripts/types/speech_model.rb +4 -1
  29. data/lib/assemblyai/transcripts/types/substitution_policy.rb +5 -2
  30. data/lib/assemblyai/transcripts/types/subtitle_format.rb +5 -2
  31. data/lib/assemblyai/transcripts/types/summary_model.rb +6 -2
  32. data/lib/assemblyai/transcripts/types/summary_type.rb +8 -8
  33. data/lib/assemblyai/transcripts/types/topic_detection_model_result.rb +5 -9
  34. data/lib/assemblyai/transcripts/types/transcript.rb +26 -29
  35. data/lib/assemblyai/transcripts/types/transcript_boost_param.rb +6 -2
  36. data/lib/assemblyai/transcripts/types/transcript_language_code.rb +24 -23
  37. data/lib/assemblyai/transcripts/types/transcript_list_item.rb +5 -5
  38. data/lib/assemblyai/transcripts/types/transcript_optional_params.rb +36 -39
  39. data/lib/assemblyai/transcripts/types/transcript_ready_notification.rb +54 -0
  40. data/lib/assemblyai/transcripts/types/transcript_ready_status.rb +11 -0
  41. data/lib/assemblyai/transcripts/types/transcript_status.rb +7 -2
  42. data/lib/assemblyai.rb +1 -0
  43. data/lib/requests.rb +28 -2
  44. data/lib/types_export.rb +9 -5
  45. metadata +57 -14
@@ -1,22 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "message_type"
4
3
  require "json"
5
4
 
6
5
  module AssemblyAI
7
6
  class Realtime
8
7
  class TerminateSession
9
- attr_reader :terminate_session, :message_type, :additional_properties
8
+ attr_reader :terminate_session, :additional_properties
10
9
 
11
10
  # @param terminate_session [Boolean] Set to true to end your real-time session forever
12
- # @param message_type [MESSAGE_TYPE] Describes the type of the message
13
11
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
12
  # @return [Realtime::TerminateSession]
15
- def initialize(terminate_session:, message_type:, additional_properties: nil)
13
+ def initialize(terminate_session:, additional_properties: nil)
16
14
  # @type [Boolean] Set to true to end your real-time session forever
17
15
  @terminate_session = terminate_session
18
- # @type [MESSAGE_TYPE] Describes the type of the message
19
- @message_type = message_type
20
16
  # @type [OpenStruct] Additional properties unmapped to the current class definition
21
17
  @additional_properties = additional_properties
22
18
  end
@@ -27,20 +23,16 @@ module AssemblyAI
27
23
  # @return [Realtime::TerminateSession]
28
24
  def self.from_json(json_object:)
29
25
  struct = JSON.parse(json_object, object_class: OpenStruct)
30
- parsed_json = JSON.parse(json_object)
26
+ JSON.parse(json_object)
31
27
  terminate_session = struct.terminate_session
32
- message_type = Realtime::MESSAGE_TYPE.key(parsed_json["message_type"]) || parsed_json["message_type"]
33
- new(terminate_session: terminate_session, message_type: message_type, additional_properties: struct)
28
+ new(terminate_session: terminate_session, additional_properties: struct)
34
29
  end
35
30
 
36
31
  # Serialize an instance of TerminateSession to a JSON object
37
32
  #
38
33
  # @return [JSON]
39
34
  def to_json(*_args)
40
- {
41
- "terminate_session": @terminate_session,
42
- "message_type": Realtime::MESSAGE_TYPE[@message_type] || @message_type
43
- }.to_json
35
+ { "terminate_session": @terminate_session }.to_json
44
36
  end
45
37
 
46
38
  # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
@@ -49,7 +41,6 @@ module AssemblyAI
49
41
  # @return [Void]
50
42
  def self.validate_raw(obj:)
51
43
  obj.terminate_session.is_a?(Boolean) != false || raise("Passed value for field obj.terminate_session is not the expected type, validation failed.")
52
- obj.message_type.is_a?(Realtime::MESSAGE_TYPE) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
53
44
  end
54
45
  end
55
46
  end
@@ -34,7 +34,7 @@ module AssemblyAI
34
34
  # Retrieve a list of transcripts you created
35
35
  #
36
36
  # @param limit [Integer] Maximum amount of transcripts to retrieve
37
- # @param status [TRANSCRIPT_STATUS] Filter by transcript status
37
+ # @param status [Transcripts::TranscriptStatus] Filter by transcript status
38
38
  # @param created_on [String] Only get transcripts created on this date
39
39
  # @param before_id [String] Get transcripts that were created before this transcript ID
40
40
  # @param after_id [String] Get transcripts that were created after this transcript ID
@@ -62,8 +62,8 @@ module AssemblyAI
62
62
 
63
63
  # Create a transcript from an audio or video file that is accessible via a URL.
64
64
  #
65
- # @param speech_model [Transcripts::SPEECH_MODEL]
66
- # @param language_code [TRANSCRIPT_LANGUAGE_CODE]
65
+ # @param speech_model [Transcripts::SpeechModel]
66
+ # @param language_code [Transcripts::TranscriptLanguageCode]
67
67
  # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
68
68
  # @param format_text [Boolean] Enable Text Formatting, can be true or false
69
69
  # @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
@@ -74,13 +74,13 @@ module AssemblyAI
74
74
  # @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
75
75
  # @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
76
76
  # @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
77
- # @param boost_param [TRANSCRIPT_BOOST_PARAM] The word boost parameter value
77
+ # @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value
78
78
  # @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
79
79
  # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false
80
80
  # @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.
81
- # @param redact_pii_audio_quality [REDACT_PII_AUDIO_QUALITY] 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.
82
- # @param redact_pii_policies [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
83
- # @param redact_pii_sub [SUBSTITUTION_POLICY]
81
+ # @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.
82
+ # @param redact_pii_policies [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
83
+ # @param redact_pii_sub [Transcripts::SubstitutionPolicy]
84
84
  # @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
85
85
  # @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.
86
86
  # @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false
@@ -97,8 +97,8 @@ module AssemblyAI
97
97
  # @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
98
98
  # Valid values are in the range [0, 1] inclusive.
99
99
  # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
100
- # @param summary_model [SUMMARY_MODEL] The model to summarize the transcript
101
- # @param summary_type [SUMMARY_TYPE] The type of summary
100
+ # @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript
101
+ # @param summary_type [Transcripts::SummaryType] The type of summary
102
102
  # @param custom_topics [Boolean] Whether custom topics is enabled, either true or false
103
103
  # @param topics [Array<String>] The list of custom topics provided, if custom topics is enabled
104
104
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
@@ -187,7 +187,7 @@ module AssemblyAI
187
187
  # Export your transcript in SRT or VTT format, to be plugged into a video player for subtitles and closed captions.
188
188
  #
189
189
  # @param transcript_id [String] ID of the transcript
190
- # @param subtitle_format [SUBTITLE_FORMAT] The format of the captions
190
+ # @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
191
191
  # @param chars_per_caption [Integer] The maximum number of characters per caption
192
192
  # @param request_options [RequestOptions]
193
193
  # @return [String]
@@ -276,7 +276,7 @@ module AssemblyAI
276
276
  # Retrieve a list of transcripts you created
277
277
  #
278
278
  # @param limit [Integer] Maximum amount of transcripts to retrieve
279
- # @param status [TRANSCRIPT_STATUS] Filter by transcript status
279
+ # @param status [Transcripts::TranscriptStatus] Filter by transcript status
280
280
  # @param created_on [String] Only get transcripts created on this date
281
281
  # @param before_id [String] Get transcripts that were created before this transcript ID
282
282
  # @param after_id [String] Get transcripts that were created after this transcript ID
@@ -306,8 +306,8 @@ module AssemblyAI
306
306
 
307
307
  # Create a transcript from an audio or video file that is accessible via a URL.
308
308
  #
309
- # @param speech_model [Transcripts::SPEECH_MODEL]
310
- # @param language_code [TRANSCRIPT_LANGUAGE_CODE]
309
+ # @param speech_model [Transcripts::SpeechModel]
310
+ # @param language_code [Transcripts::TranscriptLanguageCode]
311
311
  # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
312
312
  # @param format_text [Boolean] Enable Text Formatting, can be true or false
313
313
  # @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
@@ -318,13 +318,13 @@ module AssemblyAI
318
318
  # @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
319
319
  # @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
320
320
  # @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
321
- # @param boost_param [TRANSCRIPT_BOOST_PARAM] The word boost parameter value
321
+ # @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value
322
322
  # @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
323
323
  # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false
324
324
  # @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.
325
- # @param redact_pii_audio_quality [REDACT_PII_AUDIO_QUALITY] 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.
326
- # @param redact_pii_policies [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
327
- # @param redact_pii_sub [SUBSTITUTION_POLICY]
325
+ # @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.
326
+ # @param redact_pii_policies [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
327
+ # @param redact_pii_sub [Transcripts::SubstitutionPolicy]
328
328
  # @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
329
329
  # @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.
330
330
  # @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false
@@ -341,8 +341,8 @@ module AssemblyAI
341
341
  # @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
342
342
  # Valid values are in the range [0, 1] inclusive.
343
343
  # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
344
- # @param summary_model [SUMMARY_MODEL] The model to summarize the transcript
345
- # @param summary_type [SUMMARY_TYPE] The type of summary
344
+ # @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript
345
+ # @param summary_type [Transcripts::SummaryType] The type of summary
346
346
  # @param custom_topics [Boolean] Whether custom topics is enabled, either true or false
347
347
  # @param topics [Array<String>] The list of custom topics provided, if custom topics is enabled
348
348
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
@@ -437,7 +437,7 @@ module AssemblyAI
437
437
  # Export your transcript in SRT or VTT format, to be plugged into a video player for subtitles and closed captions.
438
438
  #
439
439
  # @param transcript_id [String] ID of the transcript
440
- # @param subtitle_format [SUBTITLE_FORMAT] The format of the captions
440
+ # @param subtitle_format [Transcripts::SubtitleFormat] The format of the captions
441
441
  # @param chars_per_caption [Integer] The maximum number of characters per caption
442
442
  # @param request_options [RequestOptions]
443
443
  # @return [String]
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../requests"
4
+ require_relative "types/transcript_list"
5
+ require "async"
6
+
7
+ module AssemblyAI
8
+ # :nodoc:
9
+ class TranscriptsClient
10
+ # Retrieve a list of transcripts you created, this is used for pagination to easily retrieve the next page of transcripts
11
+ #
12
+ # @param url [String] The URL to retrieve the transcript list from
13
+ # @param request_options [RequestOptions]
14
+ # @return [Transcripts::TranscriptList]
15
+ #
16
+ # @example Retrieve the next page of results
17
+ # client = AssemblyAI::Client.new(api_key: "YOUR_API_KEY")
18
+ # transcript_list = client.transcripts.list(limit: 1)
19
+ # client.transcripts.list_by_url(url: transcript_list.page_details.next_url)
20
+ def list_by_url(url: nil, request_options: nil)
21
+ url = "/v2/transcript" if url.nil?
22
+ response = @request_client.conn.get(url) do |req|
23
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
24
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
25
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
26
+ end
27
+ Transcripts::TranscriptList.from_json(json_object: response.body)
28
+ end
29
+ end
30
+
31
+ # :nodoc:
32
+ class AsyncTranscriptsClient
33
+ # Retrieve a list of transcripts you created
34
+ #
35
+ # @param url [String] The URL to retrieve the transcript list from
36
+ # @param request_options [RequestOptions]
37
+ # @return [Transcripts::TranscriptList]
38
+ #
39
+ # @example Retrieve the next page of results
40
+ # client = AssemblyAI::AsyncClient.new(api_key: "YOUR_API_KEY")
41
+ # Sync do
42
+ # transcript_list = client.transcripts.list(limit: 1).wait
43
+ # client.transcripts.list_by_url(url: transcript_list.page_details.next_url)
44
+ # end
45
+ def list_by_url(url: nil, request_options: nil)
46
+ Async do
47
+ url = "/v2/transcript" if url.nil?
48
+ response = @request_client.conn.get(url) do |req|
49
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
50
+ req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
51
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
52
+ end
53
+ Transcripts::TranscriptList.from_json(json_object: response.body)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -26,7 +26,8 @@ module AssemblyAI
26
26
  # Create a transcript from an audio or video file that is accessible via a URL.
27
27
  # .transcribe polls for completion of the transcription, while the .submit function does not.
28
28
  #
29
- # @param language_code [TRANSCRIPT_LANGUAGE_CODE]
29
+ # @param speech_model [Transcripts::SpeechModel]
30
+ # @param language_code [Transcripts::TranscriptLanguageCode]
30
31
  # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
31
32
  # @param format_text [Boolean] Enable Text Formatting, can be true or false
32
33
  # @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
@@ -37,13 +38,13 @@ module AssemblyAI
37
38
  # @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
38
39
  # @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
39
40
  # @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
40
- # @param boost_param [TRANSCRIPT_BOOST_PARAM] The word boost parameter value
41
+ # @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value
41
42
  # @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
42
43
  # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false
43
44
  # @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.
44
- # @param redact_pii_audio_quality [REDACT_PII_AUDIO_QUALITY] 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.
45
- # @param redact_pii_policies [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
46
- # @param redact_pii_sub [SUBSTITUTION_POLICY]
45
+ # @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.
46
+ # @param redact_pii_policies [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
47
+ # @param redact_pii_sub [Transcripts::SubstitutionPolicy]
47
48
  # @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
48
49
  # @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.
49
50
  # @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false
@@ -60,8 +61,8 @@ module AssemblyAI
60
61
  # @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
61
62
  # Valid values are in the range [0, 1] inclusive.
62
63
  # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
63
- # @param summary_model [SUMMARY_MODEL] The model to summarize the transcript
64
- # @param summary_type [SUMMARY_TYPE] The type of summary
64
+ # @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript
65
+ # @param summary_type [Transcripts::SummaryType] The type of summary
65
66
  # @param custom_topics [Boolean] Whether custom topics is enabled, either true or false
66
67
  # @param topics [Array<String>] The list of custom topics provided, if custom topics is enabled
67
68
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
@@ -69,10 +70,10 @@ module AssemblyAI
69
70
  # @param request_options [RequestOptions]
70
71
  # @param polling_options [Transcripts::PollingOptions] Configuration options for polling requests.
71
72
  # @return [Transcripts::Transcript]
72
- def transcribe(audio_url:, language_code: nil, punctuate: nil, format_text: nil, dual_channel: nil, webhook_url: nil,
73
- 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, additional_properties: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new)
74
- transcript = submit(audio_url: audio_url, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel, webhook_url: webhook_url,
75
- 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)
73
+ def transcribe(audio_url:, speech_model: nil, language_code: nil, punctuate: nil, format_text: nil, dual_channel: nil,
74
+ 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, additional_properties: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new)
75
+ transcript = submit(audio_url: audio_url, speech_model: speech_model, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel,
76
+ 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)
76
77
  poll_transcript(transcript_id: transcript.id, polling_options: polling_options)
77
78
  end
78
79
 
@@ -81,7 +82,7 @@ module AssemblyAI
81
82
  timeout_in_seconds = polling_options.timeout / 1000 if polling_options.timeout.positive?
82
83
  loop do
83
84
  transcript = get(transcript_id: transcript_id)
84
- if transcript.status == :completed || transcript.status == :error
85
+ if transcript.status == Transcripts::TranscriptStatus::COMPLETED || transcript.status == Transcripts::TranscriptStatus::ERROR
85
86
  return transcript
86
87
  elsif polling_options.timeout.positive? && Time.now - start_time > timeout_in_seconds
87
88
  raise StandardError, "Polling timeout"
@@ -99,7 +100,8 @@ module AssemblyAI
99
100
  # Create a transcript from an audio or video file that is accessible via a URL.
100
101
  # .transcribe polls for completion of the transcription, while the .submit function does not.
101
102
  #
102
- # @param language_code [TRANSCRIPT_LANGUAGE_CODE]
103
+ # @param speech_model [Transcripts::SpeechModel]
104
+ # @param language_code [Transcripts::TranscriptLanguageCode]
103
105
  # @param punctuate [Boolean] Enable Automatic Punctuation, can be true or false
104
106
  # @param format_text [Boolean] Enable Text Formatting, can be true or false
105
107
  # @param dual_channel [Boolean] Enable [Dual Channel](https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription) transcription, can be true or false.
@@ -110,13 +112,13 @@ module AssemblyAI
110
112
  # @param audio_start_from [Integer] The point in time, in milliseconds, to begin transcribing in your media file
111
113
  # @param audio_end_at [Integer] The point in time, in milliseconds, to stop transcribing in your media file
112
114
  # @param word_boost [Array<String>] The list of custom vocabulary to boost transcription probability for
113
- # @param boost_param [TRANSCRIPT_BOOST_PARAM] The word boost parameter value
115
+ # @param boost_param [Transcripts::TranscriptBoostParam] The word boost parameter value
114
116
  # @param filter_profanity [Boolean] Filter profanity from the transcribed text, can be true or false
115
117
  # @param redact_pii [Boolean] Redact PII from the transcribed text using the Redact PII model, can be true or false
116
118
  # @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.
117
- # @param redact_pii_audio_quality [REDACT_PII_AUDIO_QUALITY] 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.
118
- # @param redact_pii_policies [Array<Transcripts::PII_POLICY>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
119
- # @param redact_pii_sub [SUBSTITUTION_POLICY]
119
+ # @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.
120
+ # @param redact_pii_policies [Array<Transcripts::PiiPolicy>] The list of PII Redaction policies to enable. See [PII redaction](https://www.assemblyai.com/docs/models/pii-redaction) for more details.
121
+ # @param redact_pii_sub [Transcripts::SubstitutionPolicy]
120
122
  # @param speaker_labels [Boolean] Enable [Speaker diarization](https://www.assemblyai.com/docs/models/speaker-diarization), can be true or false
121
123
  # @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.
122
124
  # @param content_safety [Boolean] Enable [Content Moderation](https://www.assemblyai.com/docs/models/content-moderation), can be true or false
@@ -133,20 +135,20 @@ module AssemblyAI
133
135
  # @param speech_threshold [Float] Reject audio files that contain less than this fraction of speech.
134
136
  # Valid values are in the range [0, 1] inclusive.
135
137
  # @param summarization [Boolean] Enable [Summarization](https://www.assemblyai.com/docs/models/summarization), can be true or false
136
- # @param summary_model [SUMMARY_MODEL] The model to summarize the transcript
137
- # @param summary_type [SUMMARY_TYPE] The type of summary
138
+ # @param summary_model [Transcripts::SummaryModel] The model to summarize the transcript
139
+ # @param summary_type [Transcripts::SummaryType] The type of summary
138
140
  # @param custom_topics [Boolean] Whether custom topics is enabled, either true or false
139
141
  # @param topics [Array<String>] The list of custom topics provided, if custom topics is enabled
140
142
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
141
143
  # @param audio_url [String] The URL of the audio or video file to transcribe.
142
144
  # @param request_options [RequestOptions]
143
- # @param polling_options [PollingOptions] Configuration options for polling requests.
145
+ # @param polling_options [Transcripts::PollingOptions] Configuration options for polling requests.
144
146
  # @return [Transcripts::Transcript]
145
- def transcribe(audio_url:, language_code: nil, punctuate: nil, format_text: nil, dual_channel: nil, webhook_url: nil,
146
- 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, additional_properties: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new)
147
+ def transcribe(audio_url:, speech_model: nil, language_code: nil, punctuate: nil, format_text: nil, dual_channel: nil,
148
+ 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, additional_properties: nil, request_options: nil, polling_options: Transcripts::PollingOptions.new)
147
149
  Async do
148
- transcript = submit(audio_url: audio_url, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel, webhook_url: webhook_url,
149
- 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
150
+ transcript = submit(audio_url: audio_url, speech_model: speech_model, language_code: language_code, punctuate: punctuate, format_text: format_text, dual_channel: dual_channel,
151
+ 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
150
152
  poll_transcript(transcript_id: transcript.id, polling_options: polling_options).wait
151
153
  end
152
154
  end
@@ -157,7 +159,7 @@ module AssemblyAI
157
159
  timeout_in_seconds = polling_options.timeout / 1000 if polling_options.timeout.positive?
158
160
  loop do
159
161
  transcript = get(transcript_id: transcript_id).wait
160
- if transcript.status == :completed || transcript.status == :error
162
+ if transcript.status == Transcripts::TranscriptStatus::COMPLETED || transcript.status == Transcripts::TranscriptStatus::ERROR
161
163
  break transcript
162
164
  elsif polling_options.timeout.positive? && Time.now - start_time > timeout_in_seconds
163
165
  raise StandardError, "Polling timeout"
@@ -2,7 +2,10 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [AUDIO_INTELLIGENCE_MODEL_STATUS]
6
- AUDIO_INTELLIGENCE_MODEL_STATUS = { success: "success", unavailable: "unavailable" }.freeze
5
+ # Either success, or unavailable in the rare case that the model failed
6
+ class AudioIntelligenceModelStatus
7
+ SUCCESS = "success"
8
+ UNAVAILABLE = "unavailable"
9
+ end
7
10
  end
8
11
  end
@@ -11,14 +11,14 @@ module AssemblyAI
11
11
  class ContentSafetyLabelsResult
12
12
  attr_reader :status, :results, :summary, :severity_score_summary, :additional_properties
13
13
 
14
- # @param status [AUDIO_INTELLIGENCE_MODEL_STATUS] The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed.
14
+ # @param status [Transcripts::AudioIntelligenceModelStatus] The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed.
15
15
  # @param results [Array<Transcripts::ContentSafetyLabelResult>]
16
16
  # @param summary [Hash{String => String}] A summary of the Content Moderation confidence results for the entire audio file
17
17
  # @param severity_score_summary [Hash{String => String}] A summary of the Content Moderation severity results for the entire audio file
18
18
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
19
19
  # @return [Transcripts::ContentSafetyLabelsResult]
20
20
  def initialize(status:, results:, summary:, severity_score_summary:, additional_properties: nil)
21
- # @type [AUDIO_INTELLIGENCE_MODEL_STATUS] The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed.
21
+ # @type [Transcripts::AudioIntelligenceModelStatus] The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed.
22
22
  @status = status
23
23
  # @type [Array<Transcripts::ContentSafetyLabelResult>]
24
24
  @results = results
@@ -37,7 +37,7 @@ module AssemblyAI
37
37
  def self.from_json(json_object:)
38
38
  struct = JSON.parse(json_object, object_class: OpenStruct)
39
39
  parsed_json = JSON.parse(json_object)
40
- status = Transcripts::AUDIO_INTELLIGENCE_MODEL_STATUS.key(parsed_json["status"]) || parsed_json["status"]
40
+ status = struct.status
41
41
  results = parsed_json["results"]&.map do |v|
42
42
  v = v.to_json
43
43
  Transcripts::ContentSafetyLabelResult.from_json(json_object: v)
@@ -53,7 +53,7 @@ module AssemblyAI
53
53
  # @return [JSON]
54
54
  def to_json(*_args)
55
55
  {
56
- "status": Transcripts::AUDIO_INTELLIGENCE_MODEL_STATUS[@status] || @status,
56
+ "status": @status,
57
57
  "results": @results,
58
58
  "summary": @summary,
59
59
  "severity_score_summary": @severity_score_summary
@@ -65,7 +65,7 @@ module AssemblyAI
65
65
  # @param obj [Object]
66
66
  # @return [Void]
67
67
  def self.validate_raw(obj:)
68
- obj.status.is_a?(Transcripts::AUDIO_INTELLIGENCE_MODEL_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
68
+ obj.status.is_a?(Transcripts::AudioIntelligenceModelStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
69
69
  obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
70
70
  obj.summary.is_a?(Hash) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.")
71
71
  obj.severity_score_summary.is_a?(Hash) != false || raise("Passed value for field obj.severity_score_summary is not the expected type, validation failed.")
@@ -9,14 +9,14 @@ module AssemblyAI
9
9
  class Entity
10
10
  attr_reader :entity_type, :text, :start, :end_, :additional_properties
11
11
 
12
- # @param entity_type [ENTITY_TYPE] The type of entity for the detected entity
12
+ # @param entity_type [Transcripts::EntityType] The type of entity for the detected entity
13
13
  # @param text [String] The text for the detected entity
14
14
  # @param start [Integer] The starting time, in milliseconds, at which the detected entity appears in the audio file
15
15
  # @param end_ [Integer] The ending time, in milliseconds, for the detected entity in the audio file
16
16
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
17
17
  # @return [Transcripts::Entity]
18
18
  def initialize(entity_type:, text:, start:, end_:, additional_properties: nil)
19
- # @type [ENTITY_TYPE] The type of entity for the detected entity
19
+ # @type [Transcripts::EntityType] The type of entity for the detected entity
20
20
  @entity_type = entity_type
21
21
  # @type [String] The text for the detected entity
22
22
  @text = text
@@ -34,8 +34,8 @@ module AssemblyAI
34
34
  # @return [Transcripts::Entity]
35
35
  def self.from_json(json_object:)
36
36
  struct = JSON.parse(json_object, object_class: OpenStruct)
37
- parsed_json = JSON.parse(json_object)
38
- entity_type = Transcripts::ENTITY_TYPE.key(parsed_json["entity_type"]) || parsed_json["entity_type"]
37
+ JSON.parse(json_object)
38
+ entity_type = struct.entity_type
39
39
  text = struct.text
40
40
  start = struct.start
41
41
  end_ = struct.end
@@ -46,12 +46,7 @@ module AssemblyAI
46
46
  #
47
47
  # @return [JSON]
48
48
  def to_json(*_args)
49
- {
50
- "entity_type": Transcripts::ENTITY_TYPE[@entity_type] || @entity_type,
51
- "text": @text,
52
- "start": @start,
53
- "end": @end_
54
- }.to_json
49
+ { "entity_type": @entity_type, "text": @text, "start": @start, "end": @end_ }.to_json
55
50
  end
56
51
 
57
52
  # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
@@ -59,7 +54,7 @@ module AssemblyAI
59
54
  # @param obj [Object]
60
55
  # @return [Void]
61
56
  def self.validate_raw(obj:)
62
- obj.entity_type.is_a?(Transcripts::ENTITY_TYPE) != false || raise("Passed value for field obj.entity_type is not the expected type, validation failed.")
57
+ obj.entity_type.is_a?(Transcripts::EntityType) != false || raise("Passed value for field obj.entity_type is not the expected type, validation failed.")
63
58
  obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
64
59
  obj.start.is_a?(Integer) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
65
60
  obj.end_.is_a?(Integer) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
@@ -2,37 +2,37 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [ENTITY_TYPE]
6
- ENTITY_TYPE = {
7
- banking_information: "banking_information",
8
- blood_type: "blood_type",
9
- credit_card_cvv: "credit_card_cvv",
10
- credit_card_expiration: "credit_card_expiration",
11
- credit_card_number: "credit_card_number",
12
- date: "date",
13
- date_of_birth: "date_of_birth",
14
- drivers_license: "drivers_license",
15
- drug: "drug",
16
- email_address: "email_address",
17
- event: "event",
18
- injury: "injury",
19
- language: "language",
20
- location: "location",
21
- medical_condition: "medical_condition",
22
- medical_process: "medical_process",
23
- money_amount: "money_amount",
24
- nationality: "nationality",
25
- occupation: "occupation",
26
- organization: "organization",
27
- password: "password",
28
- person_age: "person_age",
29
- person_name: "person_name",
30
- phone_number: "phone_number",
31
- political_affiliation: "political_affiliation",
32
- religion: "religion",
33
- time: "time",
34
- url: "url",
35
- us_social_security_number: "us_social_security_number"
36
- }.freeze
5
+ # The type of entity for the detected entity
6
+ class EntityType
7
+ BANKING_INFORMATION = "banking_information"
8
+ BLOOD_TYPE = "blood_type"
9
+ CREDIT_CARD_CVV = "credit_card_cvv"
10
+ CREDIT_CARD_EXPIRATION = "credit_card_expiration"
11
+ CREDIT_CARD_NUMBER = "credit_card_number"
12
+ DATE = "date"
13
+ DATE_OF_BIRTH = "date_of_birth"
14
+ DRIVERS_LICENSE = "drivers_license"
15
+ DRUG = "drug"
16
+ EMAIL_ADDRESS = "email_address"
17
+ EVENT = "event"
18
+ INJURY = "injury"
19
+ LANGUAGE = "language"
20
+ LOCATION = "location"
21
+ MEDICAL_CONDITION = "medical_condition"
22
+ MEDICAL_PROCESS = "medical_process"
23
+ MONEY_AMOUNT = "money_amount"
24
+ NATIONALITY = "nationality"
25
+ OCCUPATION = "occupation"
26
+ ORGANIZATION = "organization"
27
+ PASSWORD = "password"
28
+ PERSON_AGE = "person_age"
29
+ PERSON_NAME = "person_name"
30
+ PHONE_NUMBER = "phone_number"
31
+ POLITICAL_AFFILIATION = "political_affiliation"
32
+ RELIGION = "religion"
33
+ TIME = "time"
34
+ URL = "url"
35
+ US_SOCIAL_SECURITY_NUMBER = "us_social_security_number"
36
+ end
37
37
  end
38
38
  end
@@ -2,35 +2,34 @@
2
2
 
3
3
  module AssemblyAI
4
4
  class Transcripts
5
- # @type [PII_POLICY]
6
- PII_POLICY = {
7
- medical_process: "medical_process",
8
- medical_condition: "medical_condition",
9
- blood_type: "blood_type",
10
- drug: "drug",
11
- injury: "injury",
12
- number_sequence: "number_sequence",
13
- email_address: "email_address",
14
- date_of_birth: "date_of_birth",
15
- phone_number: "phone_number",
16
- us_social_security_number: "us_social_security_number",
17
- credit_card_number: "credit_card_number",
18
- credit_card_expiration: "credit_card_expiration",
19
- credit_card_cvv: "credit_card_cvv",
20
- date: "date",
21
- nationality: "nationality",
22
- event: "event",
23
- language: "language",
24
- location: "location",
25
- money_amount: "money_amount",
26
- person_name: "person_name",
27
- person_age: "person_age",
28
- organization: "organization",
29
- political_affiliation: "political_affiliation",
30
- occupation: "occupation",
31
- religion: "religion",
32
- drivers_license: "drivers_license",
33
- banking_information: "banking_information"
34
- }.freeze
5
+ class PiiPolicy
6
+ MEDICAL_PROCESS = "medical_process"
7
+ MEDICAL_CONDITION = "medical_condition"
8
+ BLOOD_TYPE = "blood_type"
9
+ DRUG = "drug"
10
+ INJURY = "injury"
11
+ NUMBER_SEQUENCE = "number_sequence"
12
+ EMAIL_ADDRESS = "email_address"
13
+ DATE_OF_BIRTH = "date_of_birth"
14
+ PHONE_NUMBER = "phone_number"
15
+ US_SOCIAL_SECURITY_NUMBER = "us_social_security_number"
16
+ CREDIT_CARD_NUMBER = "credit_card_number"
17
+ CREDIT_CARD_EXPIRATION = "credit_card_expiration"
18
+ CREDIT_CARD_CVV = "credit_card_cvv"
19
+ DATE = "date"
20
+ NATIONALITY = "nationality"
21
+ EVENT = "event"
22
+ LANGUAGE = "language"
23
+ LOCATION = "location"
24
+ MONEY_AMOUNT = "money_amount"
25
+ PERSON_NAME = "person_name"
26
+ PERSON_AGE = "person_age"
27
+ ORGANIZATION = "organization"
28
+ POLITICAL_AFFILIATION = "political_affiliation"
29
+ OCCUPATION = "occupation"
30
+ RELIGION = "religion"
31
+ DRIVERS_LICENSE = "drivers_license"
32
+ BANKING_INFORMATION = "banking_information"
33
+ end
35
34
  end
36
35
  end