assemblyai 4.5.0-beta.0 → 4.5.0
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.
- package/CHANGELOG.md +34 -0
- package/README.md +53 -9
- package/dist/assemblyai.streaming.umd.js +288 -0
- package/dist/assemblyai.streaming.umd.min.js +1 -0
- package/dist/assemblyai.umd.js +131 -12
- package/dist/assemblyai.umd.min.js +1 -1
- package/dist/browser.mjs +125 -11
- package/dist/bun.mjs +125 -11
- package/dist/deno.mjs +125 -11
- package/dist/exports/index.d.ts +2 -0
- package/dist/exports/streaming.d.ts +4 -0
- package/dist/index.cjs +131 -12
- package/dist/index.mjs +131 -12
- package/dist/node.cjs +125 -11
- package/dist/node.mjs +125 -11
- package/dist/polyfills/fetch/default.d.ts +1 -0
- package/dist/polyfills/fetch/workerd.d.ts +1 -0
- package/dist/services/base.d.ts +1 -0
- package/dist/services/lemur/index.d.ts +8 -1
- package/dist/services/transcripts/index.d.ts +16 -3
- package/dist/streaming.browser.mjs +239 -0
- package/dist/streaming.cjs +277 -0
- package/dist/streaming.mjs +274 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/openapi.generated.d.ts +60 -23
- package/dist/types/services/index.d.ts +7 -0
- package/dist/types/transcripts/index.d.ts +9 -0
- package/dist/utils/userAgent.d.ts +2 -0
- package/dist/workerd.mjs +722 -0
- package/docs/reference-types-from-js.md +27 -0
- package/package.json +39 -19
- package/src/exports/index.ts +2 -0
- package/src/exports/streaming.ts +4 -0
- package/src/polyfills/fetch/default.ts +3 -0
- package/src/polyfills/fetch/workerd.ts +1 -0
- package/src/services/base.ts +27 -7
- package/src/services/files/index.ts +19 -2
- package/src/services/index.ts +2 -1
- package/src/services/lemur/index.ts +12 -0
- package/src/services/transcripts/index.ts +41 -4
- package/src/types/index.ts +9 -0
- package/src/types/openapi.generated.ts +198 -41
- package/src/types/services/index.ts +8 -0
- package/src/types/transcripts/index.ts +10 -0
- package/src/utils/path.ts +1 -0
- package/src/utils/userAgent.ts +51 -0
|
@@ -476,7 +476,7 @@ export type Entity = {
|
|
|
476
476
|
/**
|
|
477
477
|
* The type of entity for the detected entity
|
|
478
478
|
*/
|
|
479
|
-
export type EntityType = "banking_information" | "blood_type" | "credit_card_cvv" | "credit_card_expiration" | "credit_card_number" | "date" | "date_of_birth" | "drivers_license" | "drug" | "email_address" | "event" | "injury" | "language" | "location" | "medical_condition" | "medical_process" | "money_amount" | "nationality" | "occupation" | "organization" | "password" | "person_age" | "person_name" | "phone_number" | "political_affiliation" | "religion" | "time" | "url" | "us_social_security_number";
|
|
479
|
+
export type EntityType = "account_number" | "banking_information" | "blood_type" | "credit_card_cvv" | "credit_card_expiration" | "credit_card_number" | "date" | "date_interval" | "date_of_birth" | "drivers_license" | "drug" | "duration" | "email_address" | "event" | "filename" | "gender_sexuality" | "healthcare_number" | "injury" | "ip_address" | "language" | "location" | "marital_status" | "medical_condition" | "medical_process" | "money_amount" | "nationality" | "number_sequence" | "occupation" | "organization" | "passport_number" | "password" | "person_age" | "person_name" | "phone_number" | "physical_attribute" | "political_affiliation" | "religion" | "statistics" | "time" | "url" | "us_social_security_number" | "username" | "vehicle_id" | "zodiac_sign";
|
|
480
480
|
/**
|
|
481
481
|
* @example
|
|
482
482
|
* ```js
|
|
@@ -521,7 +521,11 @@ export type LemurActionItemsParams = LemurBaseParams & {
|
|
|
521
521
|
* ```js
|
|
522
522
|
* {
|
|
523
523
|
* "request_id": "5"e1b27c2-691f-4414-8bc5-f14678442f9e",
|
|
524
|
-
* "response": "Here are some potential action items based on the transcript:\n\n- Monitor air quality levels in affected areas and issue warnings as needed.\n\n- Advise vulnerable populations like children, the elderly, and those with respiratory conditions to limit time outdoors.\n\n- Have schools cancel outdoor activities when air quality is poor.\n\n- Educate the public on health impacts of smoke inhalation and precautions to take.\n\n- Track progression of smoke plumes using weather and air quality monitoring systems.\n\n- Coordinate cross-regionally to manage smoke exposure as air masses shift.\n\n- Plan for likely increase in such events due to climate change. Expand monitoring and forecasting capabilities.\n\n- Conduct research to better understand health impacts of wildfire smoke and mitigation strategies.\n\n- Develop strategies to prevent and manage wildfires to limit air quality impacts.\n"
|
|
524
|
+
* "response": "Here are some potential action items based on the transcript:\n\n- Monitor air quality levels in affected areas and issue warnings as needed.\n\n- Advise vulnerable populations like children, the elderly, and those with respiratory conditions to limit time outdoors.\n\n- Have schools cancel outdoor activities when air quality is poor.\n\n- Educate the public on health impacts of smoke inhalation and precautions to take.\n\n- Track progression of smoke plumes using weather and air quality monitoring systems.\n\n- Coordinate cross-regionally to manage smoke exposure as air masses shift.\n\n- Plan for likely increase in such events due to climate change. Expand monitoring and forecasting capabilities.\n\n- Conduct research to better understand health impacts of wildfire smoke and mitigation strategies.\n\n- Develop strategies to prevent and manage wildfires to limit air quality impacts.\n",
|
|
525
|
+
* "usage": {
|
|
526
|
+
* "input_tokens": 27,
|
|
527
|
+
* "output_tokens": 3
|
|
528
|
+
* }
|
|
525
529
|
* }
|
|
526
530
|
* ```
|
|
527
531
|
*/
|
|
@@ -588,7 +592,11 @@ export type LemurBaseParams = {
|
|
|
588
592
|
* @example
|
|
589
593
|
* ```js
|
|
590
594
|
* {
|
|
591
|
-
* "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e"
|
|
595
|
+
* "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
|
|
596
|
+
* "usage": {
|
|
597
|
+
* "input_tokens": 27,
|
|
598
|
+
* "output_tokens": 3
|
|
599
|
+
* }
|
|
592
600
|
* }
|
|
593
601
|
* ```
|
|
594
602
|
*/
|
|
@@ -597,6 +605,10 @@ export type LemurBaseResponse = {
|
|
|
597
605
|
* The ID of the LeMUR request
|
|
598
606
|
*/
|
|
599
607
|
request_id: string;
|
|
608
|
+
/**
|
|
609
|
+
* The usage numbers for the LeMUR request
|
|
610
|
+
*/
|
|
611
|
+
usage: LemurUsage;
|
|
600
612
|
};
|
|
601
613
|
/**
|
|
602
614
|
* The model that is used for the final prompt after compression is performed.
|
|
@@ -706,7 +718,11 @@ export type LemurQuestionAnswerParams = LemurBaseParams & {
|
|
|
706
718
|
* "answer": "yes",
|
|
707
719
|
* "question": "Is global warming affecting wildfires?"
|
|
708
720
|
* }
|
|
709
|
-
* ]
|
|
721
|
+
* ],
|
|
722
|
+
* "usage": {
|
|
723
|
+
* "input_tokens": 27,
|
|
724
|
+
* "output_tokens": 3
|
|
725
|
+
* }
|
|
710
726
|
* }
|
|
711
727
|
* ```
|
|
712
728
|
*/
|
|
@@ -716,12 +732,13 @@ export type LemurQuestionAnswerResponse = LemurBaseResponse & {
|
|
|
716
732
|
*/
|
|
717
733
|
response: LemurQuestionAnswer[];
|
|
718
734
|
};
|
|
735
|
+
export type LemurResponse = LemurTaskResponse | LemurSummaryResponse | LemurQuestionAnswerResponse | LemurActionItemsResponse;
|
|
719
736
|
/**
|
|
720
737
|
* @example
|
|
721
738
|
* ```js
|
|
722
739
|
* {
|
|
723
740
|
* "transcript_ids": [
|
|
724
|
-
* "
|
|
741
|
+
* "47b95ba5-8889-44d8-bc80-5de38306e582"
|
|
725
742
|
* ],
|
|
726
743
|
* "context": "This is an interview about wildfires.",
|
|
727
744
|
* "final_model": "default",
|
|
@@ -741,7 +758,11 @@ export type LemurSummaryParams = LemurBaseParams & {
|
|
|
741
758
|
* ```js
|
|
742
759
|
* {
|
|
743
760
|
* "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
|
|
744
|
-
* "response": "- Wildfires in Canada are sending smoke and air pollution across parts of the US, triggering air quality alerts from Maine to Minnesota. Concentrations of particulate matter have exceeded safety levels.\n\n- Weather systems are channeling the smoke through Pennsylvania into the Mid-Atlantic and Northeast regions. New York City has canceled outdoor activities to keep children and vulnerable groups indoors.\n\n- Very small particulate matter can enter the lungs and impact respiratory, cardiovascular and neurological health. Young children, the elderly and those with preexisting conditions are most at risk.\n\n- The conditions causing the poor air quality could get worse or shift to different areas in coming days depending on weather patterns. More wildfires may also contribute to higher concentrations.\n\n- Climate change is leading to longer and more severe fire seasons. Events of smoke traveling long distances and affecting air quality over wide areas will likely become more common in the future.\"\n"
|
|
761
|
+
* "response": "- Wildfires in Canada are sending smoke and air pollution across parts of the US, triggering air quality alerts from Maine to Minnesota. Concentrations of particulate matter have exceeded safety levels.\n\n- Weather systems are channeling the smoke through Pennsylvania into the Mid-Atlantic and Northeast regions. New York City has canceled outdoor activities to keep children and vulnerable groups indoors.\n\n- Very small particulate matter can enter the lungs and impact respiratory, cardiovascular and neurological health. Young children, the elderly and those with preexisting conditions are most at risk.\n\n- The conditions causing the poor air quality could get worse or shift to different areas in coming days depending on weather patterns. More wildfires may also contribute to higher concentrations.\n\n- Climate change is leading to longer and more severe fire seasons. Events of smoke traveling long distances and affecting air quality over wide areas will likely become more common in the future.\"\n",
|
|
762
|
+
* "usage": {
|
|
763
|
+
* "input_tokens": 27,
|
|
764
|
+
* "output_tokens": 3
|
|
765
|
+
* }
|
|
745
766
|
* }
|
|
746
767
|
* ```
|
|
747
768
|
*/
|
|
@@ -777,7 +798,11 @@ export type LemurTaskParams = {
|
|
|
777
798
|
* ```js
|
|
778
799
|
* {
|
|
779
800
|
* "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
|
|
780
|
-
* "response": "Based on the transcript, the following locations were mentioned as being affected by wildfire smoke from Canada:\n\n- Maine\n- Maryland\n- Minnesota\n- Mid Atlantic region\n- Northeast region\n- New York City\n- Baltimore\n"
|
|
801
|
+
* "response": "Based on the transcript, the following locations were mentioned as being affected by wildfire smoke from Canada:\n\n- Maine\n- Maryland\n- Minnesota\n- Mid Atlantic region\n- Northeast region\n- New York City\n- Baltimore\n",
|
|
802
|
+
* "usage": {
|
|
803
|
+
* "input_tokens": 27,
|
|
804
|
+
* "output_tokens": 3
|
|
805
|
+
* }
|
|
781
806
|
* }
|
|
782
807
|
* ```
|
|
783
808
|
*/
|
|
@@ -787,6 +812,19 @@ export type LemurTaskResponse = {
|
|
|
787
812
|
*/
|
|
788
813
|
response: string;
|
|
789
814
|
} & LemurBaseResponse;
|
|
815
|
+
/**
|
|
816
|
+
* The usage numbers for the LeMUR request
|
|
817
|
+
*/
|
|
818
|
+
export type LemurUsage = {
|
|
819
|
+
/**
|
|
820
|
+
* The number of input tokens used by the model
|
|
821
|
+
*/
|
|
822
|
+
input_tokens: number;
|
|
823
|
+
/**
|
|
824
|
+
* The number of output tokens generated by the model
|
|
825
|
+
*/
|
|
826
|
+
output_tokens: number;
|
|
827
|
+
};
|
|
790
828
|
/**
|
|
791
829
|
* @example
|
|
792
830
|
* ```js
|
|
@@ -828,7 +866,6 @@ export type ListTranscriptParams = {
|
|
|
828
866
|
throttled_only?: boolean;
|
|
829
867
|
};
|
|
830
868
|
/**
|
|
831
|
-
* Details of the transcript page.
|
|
832
869
|
* Details of the transcript page. Transcripts are sorted from newest to oldest. The previous URL always points to a page with older transcripts.
|
|
833
870
|
* @example
|
|
834
871
|
* ```js
|
|
@@ -851,12 +888,10 @@ export type PageDetails = {
|
|
|
851
888
|
*/
|
|
852
889
|
limit: number;
|
|
853
890
|
/**
|
|
854
|
-
* The URL to the next page of transcripts
|
|
855
891
|
* The URL to the next page of transcripts. The next URL always points to a page with newer transcripts.
|
|
856
892
|
*/
|
|
857
893
|
next_url: string | null;
|
|
858
894
|
/**
|
|
859
|
-
* The URL to the previous page of transcripts
|
|
860
895
|
* The URL to the next page of transcripts. The previous URL always points to a page with older transcripts.
|
|
861
896
|
*/
|
|
862
897
|
prev_url: string | null;
|
|
@@ -948,7 +983,10 @@ export type ParagraphsResponse = {
|
|
|
948
983
|
id: string;
|
|
949
984
|
paragraphs: TranscriptParagraph[];
|
|
950
985
|
};
|
|
951
|
-
|
|
986
|
+
/**
|
|
987
|
+
* The type of PII to redact
|
|
988
|
+
*/
|
|
989
|
+
export type PiiPolicy = "account_number" | "banking_information" | "blood_type" | "credit_card_cvv" | "credit_card_expiration" | "credit_card_number" | "date" | "date_interval" | "date_of_birth" | "drivers_license" | "drug" | "duration" | "email_address" | "event" | "filename" | "gender_sexuality" | "healthcare_number" | "injury" | "ip_address" | "language" | "location" | "marital_status" | "medical_condition" | "medical_process" | "money_amount" | "nationality" | "number_sequence" | "occupation" | "organization" | "passport_number" | "password" | "person_age" | "person_name" | "phone_number" | "physical_attribute" | "political_affiliation" | "religion" | "statistics" | "time" | "url" | "us_social_security_number" | "username" | "vehicle_id" | "zodiac_sign";
|
|
952
990
|
/**
|
|
953
991
|
* @example
|
|
954
992
|
* ```js
|
|
@@ -1124,7 +1162,7 @@ export type SentencesResponse = {
|
|
|
1124
1162
|
};
|
|
1125
1163
|
export type Sentiment = "POSITIVE" | "NEUTRAL" | "NEGATIVE";
|
|
1126
1164
|
/**
|
|
1127
|
-
* The result of the
|
|
1165
|
+
* The result of the Sentiment Analysis model
|
|
1128
1166
|
* @example
|
|
1129
1167
|
* ```js
|
|
1130
1168
|
* {
|
|
@@ -2114,7 +2152,7 @@ export type Transcript = {
|
|
|
2114
2152
|
auto_highlights: boolean;
|
|
2115
2153
|
/**
|
|
2116
2154
|
* An array of results for the Key Phrases model, if it is enabled.
|
|
2117
|
-
* See {@link https://www.assemblyai.com/docs/models/key-phrases | Key
|
|
2155
|
+
* See {@link https://www.assemblyai.com/docs/models/key-phrases | Key Phrases } for more information.
|
|
2118
2156
|
*/
|
|
2119
2157
|
auto_highlights_result?: AutoHighlightsResult | null;
|
|
2120
2158
|
/**
|
|
@@ -2236,7 +2274,7 @@ export type Transcript = {
|
|
|
2236
2274
|
sentiment_analysis?: boolean | null;
|
|
2237
2275
|
/**
|
|
2238
2276
|
* An array of results for the Sentiment Analysis model, if it is enabled.
|
|
2239
|
-
* See {@link https://www.assemblyai.com/docs/models/sentiment-analysis | Sentiment
|
|
2277
|
+
* See {@link https://www.assemblyai.com/docs/models/sentiment-analysis | Sentiment Analysis } for more information.
|
|
2240
2278
|
*/
|
|
2241
2279
|
sentiment_analysis_results?: SentimentAnalysisResult[] | null;
|
|
2242
2280
|
/**
|
|
@@ -2313,7 +2351,7 @@ export type Transcript = {
|
|
|
2313
2351
|
*/
|
|
2314
2352
|
webhook_status_code?: number | null;
|
|
2315
2353
|
/**
|
|
2316
|
-
* The URL to which we send webhooks upon
|
|
2354
|
+
* The URL to which we send webhooks upon transcription completion
|
|
2317
2355
|
*/
|
|
2318
2356
|
webhook_url?: string | null;
|
|
2319
2357
|
/**
|
|
@@ -2358,9 +2396,8 @@ export type TranscriptCustomSpelling = {
|
|
|
2358
2396
|
*
|
|
2359
2397
|
* @defaultValue "en_us
|
|
2360
2398
|
*/
|
|
2361
|
-
export type TranscriptLanguageCode = "en" | "en_au" | "en_uk" | "en_us" | "es" | "fr" | "de" | "it" | "pt" | "nl" | "
|
|
2399
|
+
export type TranscriptLanguageCode = "en" | "en_au" | "en_uk" | "en_us" | "es" | "fr" | "de" | "it" | "pt" | "nl" | "af" | "sq" | "am" | "ar" | "hy" | "as" | "az" | "ba" | "eu" | "be" | "bn" | "bs" | "br" | "bg" | "my" | "ca" | "zh" | "hr" | "cs" | "da" | "et" | "fo" | "fi" | "gl" | "ka" | "el" | "gu" | "ht" | "ha" | "haw" | "he" | "hi" | "hu" | "is" | "id" | "ja" | "jw" | "kn" | "kk" | "km" | "ko" | "lo" | "la" | "lv" | "ln" | "lt" | "lb" | "mk" | "mg" | "ms" | "ml" | "mt" | "mi" | "mr" | "mn" | "ne" | "no" | "nn" | "oc" | "pa" | "ps" | "fa" | "pl" | "ro" | "ru" | "sa" | "sr" | "sn" | "sd" | "si" | "sk" | "sl" | "so" | "su" | "sw" | "sv" | "tl" | "tg" | "ta" | "tt" | "te" | "th" | "bo" | "tr" | "tk" | "uk" | "ur" | "uz" | "vi" | "cy" | "yi" | "yo";
|
|
2362
2400
|
/**
|
|
2363
|
-
* A list of transcripts
|
|
2364
2401
|
* A list of transcripts. Transcripts are sorted from newest to oldest. The previous URL always points to a page with older transcripts.
|
|
2365
2402
|
* @example
|
|
2366
2403
|
* ```js
|
|
@@ -2498,7 +2535,7 @@ export type TranscriptOptionalParams = {
|
|
|
2498
2535
|
*/
|
|
2499
2536
|
auto_chapters?: boolean;
|
|
2500
2537
|
/**
|
|
2501
|
-
*
|
|
2538
|
+
* Enable Key Phrases, either true or false
|
|
2502
2539
|
*/
|
|
2503
2540
|
auto_highlights?: boolean;
|
|
2504
2541
|
/**
|
|
@@ -2510,7 +2547,7 @@ export type TranscriptOptionalParams = {
|
|
|
2510
2547
|
*/
|
|
2511
2548
|
content_safety?: boolean;
|
|
2512
2549
|
/**
|
|
2513
|
-
* The confidence threshold for
|
|
2550
|
+
* The confidence threshold for the Content Moderation model. Values must be between 25 and 100.
|
|
2514
2551
|
*/
|
|
2515
2552
|
content_safety_confidence?: number;
|
|
2516
2553
|
/**
|
|
@@ -2518,7 +2555,7 @@ export type TranscriptOptionalParams = {
|
|
|
2518
2555
|
*/
|
|
2519
2556
|
custom_spelling?: TranscriptCustomSpelling[];
|
|
2520
2557
|
/**
|
|
2521
|
-
*
|
|
2558
|
+
* Enable custom topics, either true or false
|
|
2522
2559
|
*/
|
|
2523
2560
|
custom_topics?: boolean;
|
|
2524
2561
|
/**
|
|
@@ -2551,7 +2588,7 @@ export type TranscriptOptionalParams = {
|
|
|
2551
2588
|
*/
|
|
2552
2589
|
language_code?: LiteralUnion<TranscriptLanguageCode, string> | null;
|
|
2553
2590
|
/**
|
|
2554
|
-
*
|
|
2591
|
+
* Enable {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection }, either true or false.
|
|
2555
2592
|
*/
|
|
2556
2593
|
language_detection?: boolean;
|
|
2557
2594
|
/**
|
|
@@ -2619,7 +2656,7 @@ export type TranscriptOptionalParams = {
|
|
|
2619
2656
|
*/
|
|
2620
2657
|
summary_type?: SummaryType;
|
|
2621
2658
|
/**
|
|
2622
|
-
* The list of custom topics
|
|
2659
|
+
* The list of custom topics
|
|
2623
2660
|
*/
|
|
2624
2661
|
topics?: string[];
|
|
2625
2662
|
/**
|
|
@@ -2633,7 +2670,7 @@ export type TranscriptOptionalParams = {
|
|
|
2633
2670
|
*/
|
|
2634
2671
|
webhook_auth_header_value?: string | null;
|
|
2635
2672
|
/**
|
|
2636
|
-
* The URL to which AssemblyAI send webhooks upon
|
|
2673
|
+
* The URL to which AssemblyAI send webhooks upon transcription completion
|
|
2637
2674
|
*/
|
|
2638
2675
|
webhook_url?: string;
|
|
2639
2676
|
/**
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { UserAgent } from "..";
|
|
1
2
|
type BaseServiceParams = {
|
|
2
3
|
apiKey: string;
|
|
3
4
|
baseUrl?: string;
|
|
5
|
+
/**
|
|
6
|
+
* The AssemblyAI user agent to use for requests.
|
|
7
|
+
* The provided components will be merged into the default AssemblyAI user agent.
|
|
8
|
+
* If `false`, the AssemblyAI user agent will be removed.
|
|
9
|
+
*/
|
|
10
|
+
userAgent?: UserAgent | false;
|
|
4
11
|
};
|
|
5
12
|
export type { BaseServiceParams };
|
|
@@ -46,3 +46,12 @@ export type SubmitParams = TranscribeParams;
|
|
|
46
46
|
* The options to transcribe an audio file, including polling options.
|
|
47
47
|
*/
|
|
48
48
|
export type TranscribeOptions = PollingOptions;
|
|
49
|
+
/**
|
|
50
|
+
* The PII redacted audio file, transmitted over the network.
|
|
51
|
+
*/
|
|
52
|
+
export type RedactedAudioFile = {
|
|
53
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
54
|
+
blob: () => Promise<Blob>;
|
|
55
|
+
body: ReadableStream<Uint8Array> | null;
|
|
56
|
+
bodyUsed: boolean;
|
|
57
|
+
};
|