import { LiteralUnion } from "./helpers"; /** OneOf type helpers */ type Without = { [P in Exclude]?: never; }; type XOR = T | U extends object ? (Without & U) | (Without & T) : T | U; type OneOf = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? OneOf<[XOR, ...Rest]> : never; /** * Either success, or unavailable in the rare case that the model failed */ export type AudioIntelligenceModelStatus = "success" | "unavailable"; /** * @example * ```js * { * "count": 1, * "rank": 0.08, * "text": "air quality alerts", * "timestamps": [ * { * "start": 3978, * "end": 5114 * } * ] * } * ``` */ export type AutoHighlightResult = { /** * The total number of times the key phrase appears in the audio file */ count: number; /** * The total relevancy to the overall audio file of this key phrase - a greater number means more relevant */ rank: number; /** * The text itself of the key phrase */ text: string; /** * The timestamp of the of the key phrase */ timestamps: Timestamp[]; }; /** * An array of results for the Key Phrases model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/key-phrases | Key phrases } for more information. * * @example * ```js * { * "status": "success", * "results": [ * { * "count": 1, * "rank": 0.08, * "text": "air quality alerts", * "timestamps": [ * { * "start": 3978, * "end": 5114 * } * ] * }, * { * "count": 1, * "rank": 0.08, * "text": "wide ranging air quality consequences", * "timestamps": [ * { * "start": 235388, * "end": 238694 * } * ] * }, * { * "count": 1, * "rank": 0.07, * "text": "more wildfires", * "timestamps": [ * { * "start": 230972, * "end": 232354 * } * ] * }, * { * "count": 1, * "rank": 0.07, * "text": "air pollution", * "timestamps": [ * { * "start": 156004, * "end": 156910 * } * ] * }, * { * "count": 3, * "rank": 0.07, * "text": "weather systems", * "timestamps": [ * { * "start": 47344, * "end": 47958 * }, * { * "start": 205268, * "end": 205818 * }, * { * "start": 211588, * "end": 213434 * } * ] * }, * { * "count": 2, * "rank": 0.06, * "text": "high levels", * "timestamps": [ * { * "start": 121128, * "end": 121646 * }, * { * "start": 155412, * "end": 155866 * } * ] * }, * { * "count": 1, * "rank": 0.06, * "text": "health conditions", * "timestamps": [ * { * "start": 152138, * "end": 152666 * } * ] * }, * { * "count": 2, * "rank": 0.06, * "text": "Peter de Carlo", * "timestamps": [ * { * "start": 18948, * "end": 19930 * }, * { * "start": 268298, * "end": 269194 * } * ] * }, * { * "count": 1, * "rank": 0.06, * "text": "New York City", * "timestamps": [ * { * "start": 125768, * "end": 126274 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "respiratory conditions", * "timestamps": [ * { * "start": 152964, * "end": 153786 * } * ] * }, * { * "count": 3, * "rank": 0.05, * "text": "New York", * "timestamps": [ * { * "start": 125768, * "end": 126034 * }, * { * "start": 171448, * "end": 171938 * }, * { * "start": 176008, * "end": 176322 * } * ] * }, * { * "count": 3, * "rank": 0.05, * "text": "climate change", * "timestamps": [ * { * "start": 229548, * "end": 230230 * }, * { * "start": 244576, * "end": 245162 * }, * { * "start": 263348, * "end": 263950 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "Johns Hopkins University Varsity", * "timestamps": [ * { * "start": 23972, * "end": 25490 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "heart conditions", * "timestamps": [ * { * "start": 153988, * "end": 154506 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "air quality warnings", * "timestamps": [ * { * "start": 12308, * "end": 13434 * } * ] * } * ] * } * ``` */ export type AutoHighlightsResult = { /** * A temporally-sequential array of Key Phrases */ results: AutoHighlightResult[]; /** * The status of the Key Phrases model. Either success, or unavailable in the rare case that the model failed. */ status: AudioIntelligenceModelStatus; }; /** * Chapter of the audio file * @example * ```js * { * "summary": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. In some places, the air quality warnings include the warning to stay inside.", * "gist": "Smoggy air quality alerts across US", * "headline": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts across US", * "start": 250, * "end": 28840 * } * ``` */ export type Chapter = { /** * The starting time, in milliseconds, for the chapter */ end: number; /** * An ultra-short summary (just a few words) of the content spoken in the chapter */ gist: string; /** * A single sentence summary of the content spoken during the chapter */ headline: string; /** * The starting time, in milliseconds, for the chapter */ start: number; /** * A one paragraph summary of the content spoken during the chapter */ summary: string; }; /** * @example * ```js * { * "label": "disasters", * "confidence": 0.8142836093902588, * "severity": 0.4093044400215149 * } * ``` */ export type ContentSafetyLabel = { /** * The confidence score for the topic being discussed, from 0 to 1 */ confidence: number; /** * The label of the sensitive topic */ label: string; /** * How severely the topic is discussed in the section, from 0 to 1 */ severity: number; }; /** * @example * ```js * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor. Good morning.", * "labels": [ * { * "label": "disasters", * "confidence": 0.8142836093902588, * "severity": 0.4093044400215149 * } * ], * "sentences_idx_start": 0, * "sentences_idx_end": 5, * "timestamp": { * "start": 250, * "end": 28840 * } * } * ``` */ export type ContentSafetyLabelResult = { /** * An array of safety labels, one per sensitive topic that was detected in the section */ labels: ContentSafetyLabel[]; /** * The sentence index at which the section ends */ sentences_idx_end: number; /** * The sentence index at which the section begins */ sentences_idx_start: number; /** * The transcript of the section flagged by the Content Moderation model */ text: string; /** * Timestamp information for the section */ timestamp: Timestamp; }; /** * An array of results for the Content Moderation model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/content-moderation | Content moderation } for more information. * * @example * ```js * { * "status": "success", * "results": [ * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor. Good morning.", * "labels": [ * { * "label": "disasters", * "confidence": 0.8142836093902588, * "severity": 0.4093044400215149 * } * ], * "sentences_idx_start": 0, * "sentences_idx_end": 5, * "timestamp": { * "start": 250, * "end": 28840 * } * } * ], * "summary": { * "disasters": 0.9940800441842205, * "health_issues": 0.9216489289040967 * }, * "severity_score_summary": { * "disasters": { * "low": 0.5733263024656846, * "medium": 0.42667369753431533, * "high": 0 * }, * "health_issues": { * "low": 0.22863814977924785, * "medium": 0.45014154926938227, * "high": 0.32122030095136983 * } * } * } * ``` */ export type ContentSafetyLabelsResult = { /** * An array of results for the Content Moderation model */ results: ContentSafetyLabelResult[]; /** * A summary of the Content Moderation severity results for the entire audio file */ severity_score_summary: { [key: string]: SeverityScoreSummary; }; /** * The status of the Content Moderation model. Either success, or unavailable in the rare case that the model failed. */ status: AudioIntelligenceModelStatus; /** * A summary of the Content Moderation confidence results for the entire audio file */ summary: { [key: string]: number; }; }; /** * @example * ```js * { * "expires_in": 480 * } * ``` */ export type CreateRealtimeTemporaryTokenParams = { /** * The amount of time until the token expires in seconds */ expires_in: number; }; /** * A detected entity * @example * ```js * { * "entity_type": "location", * "text": "Canada", * "start": 2548, * "end": 3130 * } * ``` */ export type Entity = { /** * The ending time, in milliseconds, for the detected entity in the audio file */ end: number; /** * The type of entity for the detected entity */ entity_type: EntityType; /** * The starting time, in milliseconds, at which the detected entity appears in the audio file */ start: number; /** * The text for the detected entity */ text: string; }; /** * The type of entity for the detected entity */ 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"; /** * @example * ```js * { * "error": "format_text must be a Boolean" * } * ``` */ export type Error = { /** * Error message */ error: string; status?: "error"; [key: string]: unknown; }; /** * @example * ```js * { * "transcript_ids": [ * "64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce" * ], * "context": "This is an interview about wildfires.", * "answer_format": "Bullet Points", * "final_model": "anthropic/claude-3-5-sonnet", * "temperature": 0, * "max_output_size": 3000 * } * ``` */ export type LemurActionItemsParams = LemurBaseParams & { /** * How you want the action items to be returned. This can be any text. * Defaults to "Bullet Points". * * @defaultValue "Bullet Points */ answer_format?: string; }; /** * @example * ```js * { * "request_id": "5"e1b27c2-691f-4414-8bc5-f14678442f9e", * "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", * "usage": { * "input_tokens": 27, * "output_tokens": 3 * } * } * ``` */ export type LemurActionItemsResponse = LemurStringResponse; /** * @example * ```js * { * "transcript_ids": [ * "85f9b381-e90c-46ed-beca-7d76245d375e", * "7c3acd18-df4d-4432-88f5-1e89f8827eea" * ], * "context": "This is an interview about wildfires.", * "final_model": "anthropic/claude-3-5-sonnet", * "temperature": 0, * "max_output_size": 3000 * } * ``` */ export type LemurBaseParams = { /** * Context to provide the model. This can be a string or a free-form JSON value. */ context?: OneOf<[ string, { [key: string]: unknown; } ]>; /** * The model that is used for the final prompt after compression is performed. * * @defaultValue "default */ final_model?: LiteralUnion; /** * Custom formatted transcript data. Maximum size is the context limit of the selected model, which defaults to 100000". * Use either transcript_ids or input_text as input into LeMUR. */ input_text?: string; /** * Max output size in tokens, up to 4000 * @defaultValue 2000 */ max_output_size?: number; /** * The temperature to use for the model. * Higher values result in answers that are more creative, lower values are more conservative. * Can be any value between 0.0 and 1.0 inclusive. * * @defaultValue 0 */ temperature?: number; /** * A list of completed transcripts with text. Up to a maximum of 100 files or 100 hours, whichever is lower. * Use either transcript_ids or input_text as input into LeMUR. */ transcript_ids?: string[]; }; /** * @example * ```js * { * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e", * "usage": { * "input_tokens": 27, * "output_tokens": 3 * } * } * ``` */ export type LemurBaseResponse = { /** * The ID of the LeMUR request */ request_id: string; /** * The usage numbers for the LeMUR request */ usage: LemurUsage; }; /** * The model that is used for the final prompt after compression is performed. * */ export type LemurModel = "anthropic/claude-opus-4-20250514" | "anthropic/claude-sonnet-4-20250514" | "anthropic/claude-3-7-sonnet-20250219" | "anthropic/claude-3-5-sonnet" | "anthropic/claude-3-opus" | "anthropic/claude-3-5-haiku-20241022" | "anthropic/claude-3-haiku" | "anthropic/claude-3-sonnet" | "anthropic/claude-2-1" | "anthropic/claude-2" | "default" | "assemblyai/mistral-7b"; /** * @example * ```js * { * "question": "Where are there wildfires?", * "answer_format": "List of countries in ISO 3166-1 alpha-2 format" * } * ``` */ export type LemurQuestion = { /** * How you want the answer to be returned. This can be any text. Can't be used with answer_options. Examples: "short sentence", "bullet points" */ answer_format?: string; /** * What discrete options to return. Useful for precise responses. Can't be used with answer_format. Example: ["Yes", "No"] */ answer_options?: string[]; /** * Any context about the transcripts you wish to provide. This can be a string or any object. */ context?: OneOf<[ string, { [key: string]: unknown; } ]>; /** * The question you wish to ask. For more complex questions use default model. */ question: string; }; /** * An answer generated by LeMUR and its question * @example * ```js * { * "answer": "CA, US", * "question": "Where are there wildfires?" * } * ``` */ export type LemurQuestionAnswer = { /** * The answer generated by LeMUR */ answer: string; /** * The question for LeMUR to answer */ question: string; }; /** * @example * ```js * { * "transcript_ids": [ * "64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce" * ], * "context": "This is an interview about wildfires.", * "questions": [ * { * "question": "Where are there wildfires?", * "answer_format": "List of countries in ISO 3166-1 alpha-2 format", * "answer_options": [ * "US", * "CA" * ] * }, * { * "question": "Is global warming affecting wildfires?", * "answer_options": [ * "yes", * "no" * ] * } * ], * "final_model": "anthropic/claude-3-5-sonnet", * "temperature": 0, * "max_output_size": 3000 * } * ``` */ export type LemurQuestionAnswerParams = LemurBaseParams & { /** * A list of questions to ask */ questions: LemurQuestion[]; }; /** * @example * ```js * { * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e", * "response": [ * { * "answer": "CA, US", * "question": "Where are there wildfires?" * }, * { * "answer": "yes", * "question": "Is global warming affecting wildfires?" * } * ], * "usage": { * "input_tokens": 27, * "output_tokens": 3 * } * } * ``` */ export type LemurQuestionAnswerResponse = LemurBaseResponse & { /** * The answers generated by LeMUR and their questions */ response: LemurQuestionAnswer[]; }; export type LemurResponse = LemurStringResponse | LemurQuestionAnswerResponse; /** * @example * ```js * { * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e", * "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", * "usage": { * "input_tokens": 27, * "output_tokens": 3 * } * } * ``` */ export type LemurStringResponse = { /** * The response generated by LeMUR. */ response: string; } & LemurBaseResponse; /** * @example * ```js * { * "transcript_ids": [ * "47b95ba5-8889-44d8-bc80-5de38306e582" * ], * "context": "This is an interview about wildfires.", * "final_model": "anthropic/claude-3-5-sonnet", * "temperature": 0, * "max_output_size": 3000 * } * ``` */ export type LemurSummaryParams = LemurBaseParams & { /** * How you want the summary to be returned. This can be any text. Examples: "TLDR", "bullet points" */ answer_format?: string; }; /** * @example * ```js * { * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e", * "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", * "usage": { * "input_tokens": 27, * "output_tokens": 3 * } * } * ``` */ export type LemurSummaryResponse = LemurStringResponse; /** * @example * ```js * { * "transcript_ids": [ * "64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce" * ], * "prompt": "List all the locations affected by wildfires.", * "context": "This is an interview about wildfires.", * "final_model": "anthropic/claude-3-5-sonnet", * "temperature": 0, * "max_output_size": 3000 * } * ``` */ export type LemurTaskParams = { /** * Your text to prompt the model to produce a desired output, including any context you want to pass into the model. */ prompt: string; } & LemurBaseParams; /** * @example * ```js * { * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e", * "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", * "usage": { * "input_tokens": 27, * "output_tokens": 3 * } * } * ``` */ export type LemurTaskResponse = LemurStringResponse; /** * The usage numbers for the LeMUR request */ export type LemurUsage = { /** * The number of input tokens used by the model */ input_tokens: number; /** * The number of output tokens generated by the model */ output_tokens: number; }; /** * @example * ```js * { * "after_id": "a7c5cafd-2c2e-4bdd-b0b2-69dade2f7a1b", * "before_id": "9ea68fd3-f953-42c1-9742-976c447fb463", * "created_on": "2023-11-03", * "limit": 2, * "status": "completed", * "throttled_only": false * } * ``` */ export type ListTranscriptParams = { /** * Get transcripts that were created after this transcript ID */ after_id?: string; /** * Get transcripts that were created before this transcript ID */ before_id?: string; /** * Only get transcripts created on this date */ created_on?: string; /** * Maximum amount of transcripts to retrieve * @defaultValue 10 */ limit?: number; /** * Filter by transcript status */ status?: TranscriptStatus; /** * Only get throttled transcripts, overrides the status filter * @defaultValue false * @deprecated */ throttled_only?: boolean; }; /** * Details of the transcript page. Transcripts are sorted from newest to oldest. The previous URL always points to a page with older transcripts. * @example * ```js * { * "limit": 10, * "result_count": 10, * "current_url": "https://api.assemblyai.com/v2/transcript?limit=10", * "prev_url": "https://api.assemblyai.com/v2/transcript?limit=10&before_id=62npeahu2b-a8ea-4112-854c-69542c20d90c", * "next_url": "https://api.assemblyai.com/v2/transcript?limit=10&after_id=62nfw3mlar-01ad-4631-92f6-629929496eed" * } * ``` */ export type PageDetails = { /** * The URL used to retrieve the current page of transcripts */ current_url: string; /** * The number of results this page is limited to */ limit: number; /** * The URL to the next page of transcripts. The next URL always points to a page with newer transcripts. */ next_url: string | null; /** * The URL to the next page of transcripts. The previous URL always points to a page with older transcripts. */ prev_url: string | null; /** * The actual number of results in the page */ result_count: number; }; /** * @example * ```js * { * "paragraphs": [ * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter Decarlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University. Good morning, professor.", * "start": 250, * "end": 26950, * "confidence": 0.73033, * "words": [ * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.73033, * "speaker": null * }, * { * "text": "from", * "start": 730, * "end": 1022, * "confidence": 1, * "speaker": null * }, * { * "text": "hundreds", * "start": 1076, * "end": 1466, * "confidence": 0.99992, * "speaker": null * }, * { * "text": "of", * "start": 1498, * "end": 1646, * "confidence": 1, * "speaker": null * } * ] * }, * { * "text": "Good morning. So what is it about the conditions right now that have caused this round of wildfires to affect so many people so far away? Well, there's a couple of things. The season has been pretty dry already, and then the fact that we're getting hit in the US. Is because there's a couple of weather systems that are essentially channeling the smoke from those Canadian wildfires through Pennsylvania into the Mid Atlantic and the Northeast and kind of just dropping the smoke there.", * "start": 27850, * "end": 56190, * "confidence": 0.99667, * "words": [ * { * "text": "Good", * "start": 27850, * "end": 28262, * "confidence": 0.99667, * "speaker": null * }, * { * "text": "morning.", * "start": 28316, * "end": 28920, * "confidence": 0.99742, * "speaker": null * }, * { * "text": "So", * "start": 29290, * "end": 29702, * "confidence": 0.94736, * "speaker": null * } * ] * } * ], * "id": "d5a3d302-066e-43fb-b63b-8f57baf185db", * "confidence": 0.9578730257009361, * "audio_duration": 281 * } * ``` */ export type ParagraphsResponse = { /** * The duration of the audio file in seconds */ audio_duration: number; /** * The confidence score for the transcript */ confidence: number; /** * The unique identifier of your transcript */ id: string; /** * An array of paragraphs in the transcript */ paragraphs: TranscriptParagraph[]; }; /** * The type of PII to redact */ 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"; /** * @example * ```js * { * "request_id": "914fe7e4-f10a-4364-8946-34614c2873f6", * "request_id_to_purge": "b7eb03ec-1650-4181-949b-75d9de317de1", * "deleted": true * } * ``` */ export type PurgeLemurRequestDataResponse = { /** * Whether the request data was deleted */ deleted: boolean; /** * The ID of the deletion request of the LeMUR request */ request_id: string; /** * The ID of the LeMUR request to purge the data for */ request_id_to_purge: string; }; /** * @example * ```js * { * "token": "fe4145dd1e7a2e149488dcd2d553a8018a89833fc5084837d66fd1bcf5a105d4" * } * ``` */ export type RealtimeTemporaryTokenResponse = { /** * The temporary authentication token for Streaming Speech-to-Text */ token: string; }; /** * The notification when the redacted audio is ready. */ export type RedactedAudioNotification = RedactedAudioResponse; /** * @example * ```js * { * "redacted_audio_url": "https://s3.us-west-2.amazonaws.com/api.assembly.ai.usw2/redacted-audio/785efd9e-0e20-45e1-967b-3db17770ed9f.wav?AWSAccessKeyId=aws-access-key0id&Signature=signature&x-amz-security-token=security-token&Expires=1698966551", * "status": "redacted_audio_ready" * } * ``` */ export type RedactedAudioResponse = { /** * The URL of the redacted audio file */ redacted_audio_url: string; /** * The status of the redacted audio */ status: RedactedAudioStatus; }; /** * The status of the redacted audio */ export type RedactedAudioStatus = "redacted_audio_ready"; /** * Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details. * @example "mp3" */ export type RedactPiiAudioQuality = "mp3" | "wav"; /** * @example * ```js * { * "sentences": [ * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US.", * "start": 250, * "end": 6350, * "confidence": 0.72412, * "words": [ * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.72412, * "speaker": null * }, * { * "text": "from", * "start": 730, * "end": 1022, * "confidence": 0.99996, * "speaker": null * }, * { * "text": "hundreds", * "start": 1076, * "end": 1466, * "confidence": 0.99992, * "speaker": null * }, * { * "text": "of", * "start": 1498, * "end": 1646, * "confidence": 1, * "speaker": null * } * ], * "speaker": null * }, * { * "text": "Skylines from Maine to Maryland to Minnesota are gray and smoggy.", * "start": 6500, * "end": 11050, * "confidence": 0.99819, * "words": [ * { * "text": "Skylines", * "start": 6500, * "end": 7306, * "confidence": 0.99819, * "speaker": null * }, * { * "text": "from", * "start": 7338, * "end": 7534, * "confidence": 0.99987, * "speaker": null * }, * { * "text": "Maine", * "start": 7572, * "end": 7962, * "confidence": 0.9972, * "speaker": null * }, * { * "text": "to", * "start": 8026, * "end": 8206, * "confidence": 1, * "speaker": null * }, * { * "text": "Maryland", * "start": 8228, * "end": 8650, * "confidence": 0.5192, * "speaker": null * }, * { * "text": "to", * "start": 8730, * "end": 8926, * "confidence": 1, * "speaker": null * } * ], * "speaker": null * } * ], * "id": "d5a3d302-066e-43fb-b63b-8f57baf185db", * "confidence": 0.9579390654205628, * "audio_duration": 281 * } * ``` */ export type SentencesResponse = { /** * The duration of the audio file in seconds */ audio_duration: number; /** * The confidence score for the transcript */ confidence: number; /** * The unique identifier for the transcript */ id: string; /** * An array of sentences in the transcript */ sentences: TranscriptSentence[]; }; export type Sentiment = "POSITIVE" | "NEUTRAL" | "NEGATIVE"; /** * The result of the Sentiment Analysis model * @example * ```js * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US.", * "start": 250, * "end": 6350, * "sentiment": "NEGATIVE", * "confidence": 0.8181032538414001, * "speaker": null * } * ``` */ export type SentimentAnalysisResult = { /** * The channel of this utterance. The left and right channels are channels 1 and 2. Additional channels increment the channel number sequentially. */ channel?: string | null; /** * The confidence score for the detected sentiment of the sentence, from 0 to 1 */ confidence: number; /** * The ending time, in milliseconds, of the sentence */ end: number; /** * The detected sentiment for the sentence, one of POSITIVE, NEUTRAL, NEGATIVE */ sentiment: Sentiment; /** * The speaker of the sentence if {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker Diarization } is enabled, else null */ speaker: string | null; /** * The starting time, in milliseconds, of the sentence */ start: number; /** * The transcript of the sentence */ text: string; }; /** * @example * ```js * { * "low": 0.5733263024656846, * "medium": 0.42667369753431533, * "high": 0 * } * ``` */ export type SeverityScoreSummary = { high: number; low: number; medium: number; }; /** * Advanced options for controlling speaker diarization parameters */ export type SpeakerOptions = { /** * Minimum number of speakers expected in the audio */ min_speakers_expected?: number | null; /** * Maximum number of speakers expected in the audio */ max_speakers_expected?: number | null; }; /** * The speech model to use for the transcription. */ export type SpeechModel = "best" | "nano" | "slam-1" | "universal"; /** * The replacement logic for detected PII, can be "entity_name" or "hash". See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details. */ export type SubstitutionPolicy = "entity_name" | "hash"; /** * Format of the subtitles */ export type SubtitleFormat = "srt" | "vtt"; /** * The model to summarize the transcript */ export type SummaryModel = "informative" | "conversational" | "catchy"; /** * The type of summary */ export type SummaryType = "bullets" | "bullets_verbose" | "gist" | "headline" | "paragraph"; /** * Timestamp containing a start and end property in milliseconds * @example * ```js * { * "start": 3978, * "end": 5114 * } * ``` */ export type Timestamp = { /** * The end time in milliseconds */ end: number; /** * The start time in milliseconds */ start: number; }; /** * The result of the Topic Detection model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/topic-detection | Topic Detection } for more information. * * @example * ```js * { * "status": "success", * "results": [ * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor. Good morning.", * "labels": [ * { * "relevance": 0.988274097442627, * "label": "Home&Garden>IndoorEnvironmentalQuality" * }, * { * "relevance": 0.5821335911750793, * "label": "NewsAndPolitics>Weather" * }, * { * "relevance": 0.0042327106930315495, * "label": "MedicalHealth>DiseasesAndConditions>LungAndRespiratoryHealth" * }, * { * "relevance": 0.0033971222583204508, * "label": "NewsAndPolitics>Disasters" * }, * { * "relevance": 0.002469958271831274, * "label": "BusinessAndFinance>Business>GreenSolutions" * }, * { * "relevance": 0.0014376690378412604, * "label": "MedicalHealth>DiseasesAndConditions>Cancer" * }, * { * "relevance": 0.0014294233405962586, * "label": "Science>Environment" * }, * { * "relevance": 0.001234519761055708, * "label": "Travel>TravelLocations>PolarTravel" * }, * { * "relevance": 0.0010231725173071027, * "label": "MedicalHealth>DiseasesAndConditions>ColdAndFlu" * }, * { * "relevance": 0.0007445293595083058, * "label": "BusinessAndFinance>Industries>PowerAndEnergyIndustry" * } * ], * "timestamp": { * "start": 250, * "end": 28840 * } * } * ], * "summary": { * "NewsAndPolitics>Weather": 1, * "Home&Garden>IndoorEnvironmentalQuality": 0.9043831825256348, * "Science>Environment": 0.16117265820503235, * "BusinessAndFinance>Industries>EnvironmentalServicesIndustry": 0.14393523335456848, * "MedicalHealth>DiseasesAndConditions>LungAndRespiratoryHealth": 0.11401086300611496, * "BusinessAndFinance>Business>GreenSolutions": 0.06348437070846558, * "NewsAndPolitics>Disasters": 0.05041387677192688, * "Travel>TravelLocations>PolarTravel": 0.01308488193899393, * "HealthyLiving": 0.008222488686442375, * "MedicalHealth>DiseasesAndConditions>ColdAndFlu": 0.0022315620444715023, * "MedicalHealth>DiseasesAndConditions>HeartAndCardiovascularDiseases": 0.00213034451007843, * "HealthyLiving>Wellness>SmokingCessation": 0.001540527562610805, * "MedicalHealth>DiseasesAndConditions>Injuries": 0.0013950627762824297, * "BusinessAndFinance>Industries>PowerAndEnergyIndustry": 0.0012570273829624057, * "MedicalHealth>DiseasesAndConditions>Cancer": 0.001097781932912767, * "MedicalHealth>DiseasesAndConditions>Allergies": 0.0010148967849090695, * "MedicalHealth>DiseasesAndConditions>MentalHealth": 0.000717321818228811, * "Style&Fashion>PersonalCare>DeodorantAndAntiperspirant": 0.0006022014422342181, * "Technology&Computing>Computing>ComputerNetworking": 0.0005461975233629346, * "MedicalHealth>DiseasesAndConditions>Injuries>FirstAid": 0.0004885646631009877 * } * } * ``` */ export type TopicDetectionModelResult = { /** * An array of results for the Topic Detection model */ results: TopicDetectionResult[]; /** * The status of the Topic Detection model. Either success, or unavailable in the rare case that the model failed. */ status: AudioIntelligenceModelStatus; /** * The overall relevance of topic to the entire audio file */ summary: { [key: string]: number; }; }; /** * The result of the topic detection model * @example * ```js * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor. Good morning.", * "labels": [ * { * "relevance": 0.988274097442627, * "label": "Home&Garden>IndoorEnvironmentalQuality" * }, * { * "relevance": 0.5821335911750793, * "label": "NewsAndPolitics>Weather" * }, * { * "relevance": 0.0042327106930315495, * "label": "MedicalHealth>DiseasesAndConditions>LungAndRespiratoryHealth" * }, * { * "relevance": 0.0033971222583204508, * "label": "NewsAndPolitics>Disasters" * }, * { * "relevance": 0.002469958271831274, * "label": "BusinessAndFinance>Business>GreenSolutions" * }, * { * "relevance": 0.0014376690378412604, * "label": "MedicalHealth>DiseasesAndConditions>Cancer" * }, * { * "relevance": 0.0014294233405962586, * "label": "Science>Environment" * }, * { * "relevance": 0.001234519761055708, * "label": "Travel>TravelLocations>PolarTravel" * }, * { * "relevance": 0.0010231725173071027, * "label": "MedicalHealth>DiseasesAndConditions>ColdAndFlu" * }, * { * "relevance": 0.0007445293595083058, * "label": "BusinessAndFinance>Industries>PowerAndEnergyIndustry" * } * ], * "timestamp": { * "start": 250, * "end": 28840 * } * } * ``` */ export type TopicDetectionResult = { /** * An array of detected topics in the text */ labels?: { /** * The IAB taxonomical label for the label of the detected topic, where > denotes supertopic/subtopic relationship */ label: string; /** * How relevant the detected topic is of a detected topic */ relevance: number; }[]; /** * The text in the transcript in which a detected topic occurs */ text: string; timestamp?: Timestamp; }; /** * A transcript object * @example * ```js * { * "id": "9ea68fd3-f953-42c1-9742-976c447fb463", * "speech_model": null, * "language_model": "assemblyai_default", * "acoustic_model": "assemblyai_default", * "language_code": "en_us", * "language_detection": true, * "language_confidence_threshold": 0.7, * "language_confidence": 0.9959, * "status": "completed", * "audio_url": "https://assembly.ai/wildfires.mp3", * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor. Good morning. What is it about the conditions right now that have caused this round of wildfires to affect so many people so far away? Well, there's a couple of things. The season has been pretty dry already. And then the fact that we're getting hit in the US. Is because there's a couple of weather systems that are essentially channeling the smoke from those Canadian wildfires through Pennsylvania into the Mid Atlantic and the Northeast and kind of just dropping the smoke there. So what is it in this haze that makes it harmful? And I'm assuming it is harmful. It is. The levels outside right now in Baltimore are considered unhealthy. And most of that is due to what's called particulate matter, which are tiny particles, microscopic smaller than the width of your hair that can get into your lungs and impact your respiratory system, your cardiovascular system, and even your neurological your brain. What makes this particularly harmful? Is it the volume of particulant? Is it something in particular? What is it exactly? Can you just drill down on that a little bit more? Yeah. So the concentration of particulate matter I was looking at some of the monitors that we have was reaching levels of what are, in science, big 150 micrograms per meter cubed, which is more than ten times what the annual average should be and about four times higher than what you're supposed to have on a 24 hours average. And so the concentrations of these particles in the air are just much, much higher than we typically see. And exposure to those high levels can lead to a host of health problems. And who is most vulnerable? I noticed that in New York City, for example, they're canceling outdoor activities. And so here it is in the early days of summer, and they have to keep all the kids inside. So who tends to be vulnerable in a situation like this? It's the youngest. So children, obviously, whose bodies are still developing. The elderly, who are their bodies are more in decline and they're more susceptible to the health impacts of breathing, the poor air quality. And then people who have preexisting health conditions, people with respiratory conditions or heart conditions can be triggered by high levels of air pollution. Could this get worse? That's a good question. In some areas, it's much worse than others. And it just depends on kind of where the smoke is concentrated. I think New York has some of the higher concentrations right now, but that's going to change as that air moves away from the New York area. But over the course of the next few days, we will see different areas being hit at different times with the highest concentrations. I was going to ask you about more fires start burning. I don't expect the concentrations to go up too much higher. I was going to ask you how and you started to answer this, but how much longer could this last? Or forgive me if I'm asking you to speculate, but what do you think? Well, I think the fires are going to burn for a little bit longer, but the key for us in the US. Is the weather system changing. And so right now, it's kind of the weather systems that are pulling that air into our mid Atlantic and Northeast region. As those weather systems change and shift, we'll see that smoke going elsewhere and not impact us in this region as much. And so I think that's going to be the defining factor. And I think the next couple of days we're going to see a shift in that weather pattern and start to push the smoke away from where we are. And finally, with the impacts of climate change, we are seeing more wildfires. Will we be seeing more of these kinds of wide ranging air quality consequences or circumstances? I mean, that is one of the predictions for climate change. Looking into the future, the fire season is starting earlier and lasting longer, and we're seeing more frequent fires. So, yeah, this is probably something that we'll be seeing more frequently. This tends to be much more of an issue in the Western US. So the eastern US. Getting hit right now is a little bit new. But yeah, I think with climate change moving forward, this is something that is going to happen more frequently. That's Peter De Carlo, associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University. Sergeant Carlo, thanks so much for joining us and sharing this expertise with us. Thank you for having me.", * "words": [ * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.97465, * "speaker": null * }, * { * "text": "from", * "start": 730, * "end": 1022, * "confidence": 0.99999, * "speaker": null * }, * { * "text": "hundreds", * "start": 1076, * "end": 1418, * "confidence": 0.99844, * "speaker": null * }, * { * "text": "of", * "start": 1434, * "end": 1614, * "confidence": 0.84, * "speaker": null * }, * { * "text": "wildfires", * "start": 1652, * "end": 2346, * "confidence": 0.89572, * "speaker": null * }, * { * "text": "in", * "start": 2378, * "end": 2526, * "confidence": 0.99994, * "speaker": null * }, * { * "text": "Canada", * "start": 2548, * "end": 3130, * "confidence": 0.93953, * "speaker": null * }, * { * "text": "is", * "start": 3210, * "end": 3454, * "confidence": 0.999, * "speaker": null * }, * { * "text": "triggering", * "start": 3492, * "end": 3946, * "confidence": 0.74794, * "speaker": null * }, * { * "text": "air", * "start": 3978, * "end": 4174, * "confidence": 1, * "speaker": null * }, * { * "text": "quality", * "start": 4212, * "end": 4558, * "confidence": 0.88077, * "speaker": null * }, * { * "text": "alerts", * "start": 4644, * "end": 5114, * "confidence": 0.94814, * "speaker": null * }, * { * "text": "throughout", * "start": 5162, * "end": 5466, * "confidence": 0.99726, * "speaker": null * }, * { * "text": "the", * "start": 5498, * "end": 5694, * "confidence": 0.79, * "speaker": null * }, * { * "text": "US.", * "start": 5732, * "end": 6382, * "confidence": 0.89, * "speaker": null * } * ], * "utterances": [ * { * "confidence": 0.9359033333333334, * "end": 26950, * "speaker": "A", * "start": 250, * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor.", * "words": [ * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.97503, * "speaker": "A" * }, * { * "text": "from", * "start": 730, * "end": 1022, * "confidence": 0.99999, * "speaker": "A" * }, * { * "text": "hundreds", * "start": 1076, * "end": 1418, * "confidence": 0.99843, * "speaker": "A" * }, * { * "text": "of", * "start": 1434, * "end": 1614, * "confidence": 0.85, * "speaker": "A" * }, * { * "text": "wildfires", * "start": 1652, * "end": 2346, * "confidence": 0.89657, * "speaker": "A" * }, * { * "text": "in", * "start": 2378, * "end": 2526, * "confidence": 0.99994, * "speaker": "A" * }, * { * "text": "Canada", * "start": 2548, * "end": 3130, * "confidence": 0.93864, * "speaker": "A" * }, * { * "text": "is", * "start": 3210, * "end": 3454, * "confidence": 0.999, * "speaker": "A" * }, * { * "text": "triggering", * "start": 3492, * "end": 3946, * "confidence": 0.75366, * "speaker": "A" * }, * { * "text": "air", * "start": 3978, * "end": 4174, * "confidence": 1, * "speaker": "A" * }, * { * "text": "quality", * "start": 4212, * "end": 4558, * "confidence": 0.87745, * "speaker": "A" * }, * { * "text": "alerts", * "start": 4644, * "end": 5114, * "confidence": 0.94739, * "speaker": "A" * }, * { * "text": "throughout", * "start": 5162, * "end": 5466, * "confidence": 0.99726, * "speaker": "A" * }, * { * "text": "the", * "start": 5498, * "end": 5694, * "confidence": 0.79, * "speaker": "A" * }, * { * "text": "US.", * "start": 5732, * "end": 6382, * "confidence": 0.88, * "speaker": "A" * } * ] * } * ], * "confidence": 0.9404651451800253, * "audio_duration": 281, * "punctuate": true, * "format_text": true, * "multichannel": false, * "dual_channel": false, * "webhook_url": "https://your-webhook-url.tld/path", * "webhook_status_code": 200, * "webhook_auth": true, * "webhook_auth_header_name": "webhook-secret", * "auto_highlights_result": { * "status": "success", * "results": [ * { * "count": 1, * "rank": 0.08, * "text": "air quality alerts", * "timestamps": [ * { * "start": 3978, * "end": 5114 * } * ] * }, * { * "count": 1, * "rank": 0.08, * "text": "wide ranging air quality consequences", * "timestamps": [ * { * "start": 235388, * "end": 238694 * } * ] * }, * { * "count": 1, * "rank": 0.07, * "text": "more wildfires", * "timestamps": [ * { * "start": 230972, * "end": 232354 * } * ] * }, * { * "count": 1, * "rank": 0.07, * "text": "air pollution", * "timestamps": [ * { * "start": 156004, * "end": 156910 * } * ] * }, * { * "count": 3, * "rank": 0.07, * "text": "weather systems", * "timestamps": [ * { * "start": 47344, * "end": 47958 * }, * { * "start": 205268, * "end": 205818 * }, * { * "start": 211588, * "end": 213434 * } * ] * }, * { * "count": 2, * "rank": 0.06, * "text": "high levels", * "timestamps": [ * { * "start": 121128, * "end": 121646 * }, * { * "start": 155412, * "end": 155866 * } * ] * }, * { * "count": 1, * "rank": 0.06, * "text": "health conditions", * "timestamps": [ * { * "start": 152138, * "end": 152666 * } * ] * }, * { * "count": 2, * "rank": 0.06, * "text": "Peter de Carlo", * "timestamps": [ * { * "start": 18948, * "end": 19930 * }, * { * "start": 268298, * "end": 269194 * } * ] * }, * { * "count": 1, * "rank": 0.06, * "text": "New York City", * "timestamps": [ * { * "start": 125768, * "end": 126274 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "respiratory conditions", * "timestamps": [ * { * "start": 152964, * "end": 153786 * } * ] * }, * { * "count": 3, * "rank": 0.05, * "text": "New York", * "timestamps": [ * { * "start": 125768, * "end": 126034 * }, * { * "start": 171448, * "end": 171938 * }, * { * "start": 176008, * "end": 176322 * } * ] * }, * { * "count": 3, * "rank": 0.05, * "text": "climate change", * "timestamps": [ * { * "start": 229548, * "end": 230230 * }, * { * "start": 244576, * "end": 245162 * }, * { * "start": 263348, * "end": 263950 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "Johns Hopkins University Varsity", * "timestamps": [ * { * "start": 23972, * "end": 25490 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "heart conditions", * "timestamps": [ * { * "start": 153988, * "end": 154506 * } * ] * }, * { * "count": 1, * "rank": 0.05, * "text": "air quality warnings", * "timestamps": [ * { * "start": 12308, * "end": 13434 * } * ] * } * ] * }, * "auto_highlights": true, * "audio_start_from": 10, * "audio_end_at": 280, * "word_boost": [ * "aws", * "azure", * "google cloud" * ], * "boost_param": "high", * "filter_profanity": true, * "redact_pii": true, * "redact_pii_audio": true, * "redact_pii_audio_quality": "mp3", * "redact_pii_policies": [ * "us_social_security_number", * "credit_card_number" * ], * "redact_pii_sub": "hash", * "speaker_labels": true, * "content_safety": true, * "iab_categories": true, * "content_safety_labels": { * "status": "success", * "results": [ * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor. Good morning.", * "labels": [ * { * "label": "disasters", * "confidence": 0.8142836093902588, * "severity": 0.4093044400215149 * } * ], * "sentences_idx_start": 0, * "sentences_idx_end": 5, * "timestamp": { * "start": 250, * "end": 28840 * } * } * ], * "summary": { * "disasters": 0.9940800441842205, * "health_issues": 0.9216489289040967 * }, * "severity_score_summary": { * "disasters": { * "low": 0.5733263024656846, * "medium": 0.42667369753431533, * "high": 0 * }, * "health_issues": { * "low": 0.22863814977924785, * "medium": 0.45014154926938227, * "high": 0.32122030095136983 * } * } * }, * "iab_categories_result": { * "status": "success", * "results": [ * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor. Good morning.", * "labels": [ * { * "relevance": 0.988274097442627, * "label": "Home&Garden>IndoorEnvironmentalQuality" * }, * { * "relevance": 0.5821335911750793, * "label": "NewsAndPolitics>Weather" * }, * { * "relevance": 0.0042327106930315495, * "label": "MedicalHealth>DiseasesAndConditions>LungAndRespiratoryHealth" * }, * { * "relevance": 0.0033971222583204508, * "label": "NewsAndPolitics>Disasters" * }, * { * "relevance": 0.002469958271831274, * "label": "BusinessAndFinance>Business>GreenSolutions" * }, * { * "relevance": 0.0014376690378412604, * "label": "MedicalHealth>DiseasesAndConditions>Cancer" * }, * { * "relevance": 0.0014294233405962586, * "label": "Science>Environment" * }, * { * "relevance": 0.001234519761055708, * "label": "Travel>TravelLocations>PolarTravel" * }, * { * "relevance": 0.0010231725173071027, * "label": "MedicalHealth>DiseasesAndConditions>ColdAndFlu" * }, * { * "relevance": 0.0007445293595083058, * "label": "BusinessAndFinance>Industries>PowerAndEnergyIndustry" * } * ], * "timestamp": { * "start": 250, * "end": 28840 * } * } * ], * "summary": { * "NewsAndPolitics>Weather": 1, * "Home&Garden>IndoorEnvironmentalQuality": 0.9043831825256348, * "Science>Environment": 0.16117265820503235, * "BusinessAndFinance>Industries>EnvironmentalServicesIndustry": 0.14393523335456848, * "MedicalHealth>DiseasesAndConditions>LungAndRespiratoryHealth": 0.11401086300611496, * "BusinessAndFinance>Business>GreenSolutions": 0.06348437070846558, * "NewsAndPolitics>Disasters": 0.05041387677192688, * "Travel>TravelLocations>PolarTravel": 0.01308488193899393, * "HealthyLiving": 0.008222488686442375, * "MedicalHealth>DiseasesAndConditions>ColdAndFlu": 0.0022315620444715023, * "MedicalHealth>DiseasesAndConditions>HeartAndCardiovascularDiseases": 0.00213034451007843, * "HealthyLiving>Wellness>SmokingCessation": 0.001540527562610805, * "MedicalHealth>DiseasesAndConditions>Injuries": 0.0013950627762824297, * "BusinessAndFinance>Industries>PowerAndEnergyIndustry": 0.0012570273829624057, * "MedicalHealth>DiseasesAndConditions>Cancer": 0.001097781932912767, * "MedicalHealth>DiseasesAndConditions>Allergies": 0.0010148967849090695, * "MedicalHealth>DiseasesAndConditions>MentalHealth": 0.000717321818228811, * "Style&Fashion>PersonalCare>DeodorantAndAntiperspirant": 0.0006022014422342181, * "Technology&Computing>Computing>ComputerNetworking": 0.0005461975233629346, * "MedicalHealth>DiseasesAndConditions>Injuries>FirstAid": 0.0004885646631009877 * } * }, * "custom_spelling": null, * "throttled": null, * "auto_chapters": true, * "summarization": true, * "summary_type": "bullets", * "summary_model": "informative", * "custom_topics": true, * "topics": [], * "speech_threshold": 0.5, * "disfluencies": false, * "sentiment_analysis": true, * "chapters": [ * { * "summary": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. In some places, the air quality warnings include the warning to stay inside.", * "gist": "Smoggy air quality alerts across US", * "headline": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts across US", * "start": 250, * "end": 28840 * }, * { * "summary": "Air pollution levels in Baltimore are considered unhealthy. Exposure to high levels can lead to a host of health problems. With climate change, we are seeing more wildfires. Will we be seeing more of these kinds of wide ranging air quality consequences?", * "gist": "What is it about the conditions right now that have caused this round", * "headline": "High particulate matter in wildfire smoke can lead to serious health problems", * "start": 29610, * "end": 280340 * } * ], * "sentiment_analysis_results": null, * "entity_detection": true, * "entities": [ * { * "entity_type": "location", * "text": "Canada", * "start": 2548, * "end": 3130 * }, * { * "entity_type": "location", * "text": "the US", * "start": 5498, * "end": 6382 * }, * { * "entity_type": "location", * "text": "Maine", * "start": 7492, * "end": 7914 * }, * { * "entity_type": "location", * "text": "Maryland", * "start": 8212, * "end": 8634 * }, * { * "entity_type": "location", * "text": "Minnesota", * "start": 8932, * "end": 9578 * }, * { * "entity_type": "person_name", * "text": "Peter de Carlo", * "start": 18948, * "end": 19930 * }, * { * "entity_type": "occupation", * "text": "associate professor", * "start": 20292, * "end": 21194 * }, * { * "entity_type": "organization", * "text": "Department of Environmental Health and Engineering", * "start": 21508, * "end": 23706 * }, * { * "entity_type": "organization", * "text": "Johns Hopkins University Varsity", * "start": 23972, * "end": 25490 * }, * { * "entity_type": "occupation", * "text": "professor", * "start": 26076, * "end": 26950 * }, * { * "entity_type": "location", * "text": "the US", * "start": 45184, * "end": 45898 * }, * { * "entity_type": "nationality", * "text": "Canadian", * "start": 49728, * "end": 50086 * } * ], * "summary": "- Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. In some places, the air quality warnings include the warning to stay inside.\\n- Air pollution levels in Baltimore are considered unhealthy. Exposure to high levels can lead to a host of health problems. With climate change, we are seeing more wildfires. Will we be seeing more of these kinds of wide ranging air quality consequences?", * "speakers_expected": 2 * } * ``` */ export type Transcript = { /** * @deprecated * The acoustic model that was used for the transcript */ acoustic_model: string; /** * The number of audio channels in the audio file. This is only present when multichannel is enabled. */ audio_channels?: number; /** * The duration of this transcript object's media file, in seconds */ audio_duration?: number | null; /** * The point in time, in milliseconds, in the file at which the transcription was terminated */ audio_end_at?: number | null; /** * The point in time, in milliseconds, in the file at which the transcription was started */ audio_start_from?: number | null; /** * The URL of the media that was transcribed */ audio_url: string; /** * Whether {@link https://www.assemblyai.com/docs/models/auto-chapters | Auto Chapters } is enabled, can be true or false */ auto_chapters?: boolean | null; /** * Whether Key Phrases is enabled, either true or false */ auto_highlights: boolean; /** * An array of results for the Key Phrases model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/key-phrases | Key Phrases } for more information. */ auto_highlights_result?: AutoHighlightsResult | null; /** * The word boost parameter value */ boost_param?: string | null; /** * An array of temporally sequential chapters for the audio file */ chapters?: Chapter[] | null; /** * The confidence score for the transcript, between 0.0 (low confidence) and 1.0 (high confidence) */ confidence?: number | null; /** * Whether {@link https://www.assemblyai.com/docs/models/content-moderation | Content Moderation } is enabled, can be true or false */ content_safety?: boolean | null; /** * An array of results for the Content Moderation model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/content-moderation | Content moderation } for more information. */ content_safety_labels?: ContentSafetyLabelsResult | null; /** * Customize how words are spelled and formatted using to and from values */ custom_spelling?: TranscriptCustomSpelling[] | null; /** * Whether custom topics is enabled, either true or false */ custom_topics?: boolean | null; /** * Transcribe Filler Words, like "umm", in your media file; can be true or false */ disfluencies?: boolean | null; /** * @deprecated * Whether {@link https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription | Dual channel transcription } was enabled in the transcription request, either true or false */ dual_channel?: boolean | null; /** * An array of results for the Entity Detection model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/entity-detection | Entity detection } for more information. */ entities?: Entity[] | null; /** * Whether {@link https://www.assemblyai.com/docs/models/entity-detection | Entity Detection } is enabled, can be true or false */ entity_detection?: boolean | null; /** * Error message of why the transcript failed */ error?: string; /** * Whether {@link https://www.assemblyai.com/docs/models/speech-recognition#profanity-filtering | Profanity Filtering } is enabled, either true or false */ filter_profanity?: boolean | null; /** * Whether Text Formatting is enabled, either true or false */ format_text?: boolean | null; /** * Whether {@link https://www.assemblyai.com/docs/models/topic-detection | Topic Detection } is enabled, can be true or false */ iab_categories?: boolean | null; /** * The result of the Topic Detection model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/topic-detection | Topic Detection } for more information. */ iab_categories_result?: TopicDetectionModelResult | null; /** * The unique identifier of your transcript */ id: string; /** * The language of your audio file. * Possible values are found in {@link https://www.assemblyai.com/docs/concepts/supported-languages | Supported Languages }. * The default value is 'en_us'. */ language_code?: LiteralUnion; /** * The confidence score for the detected language, between 0.0 (low confidence) and 1.0 (high confidence) */ language_confidence: number | null; /** * The confidence threshold for the automatically detected language. * An error will be returned if the language confidence is below this threshold. */ language_confidence_threshold: number | null; /** * Whether {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection } is enabled, either true or false */ language_detection?: boolean | null; /** * @deprecated * The language model that was used for the transcript */ language_model: string; /** * Whether {@link https://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription | Multichannel transcription } was enabled in the transcription request, either true or false */ multichannel?: boolean | null; /** * Whether Automatic Punctuation is enabled, either true or false */ punctuate?: boolean | null; /** * Whether {@link https://www.assemblyai.com/docs/models/pii-redaction | PII Redaction } is enabled, either true or false */ redact_pii: boolean; /** * Whether a redacted version of the audio file was generated, * either true or false. See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more information. */ redact_pii_audio?: boolean | null; /** * The audio quality of the PII-redacted audio file, if redact_pii_audio is enabled. * See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more information. */ redact_pii_audio_quality?: RedactPiiAudioQuality | null; /** * The list of PII Redaction policies that were enabled, if PII Redaction is enabled. * See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more information. */ redact_pii_policies?: PiiPolicy[] | null; /** * The replacement logic for detected PII, can be "entity_type" or "hash". See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details. */ redact_pii_sub?: SubstitutionPolicy; /** * Whether {@link https://www.assemblyai.com/docs/models/sentiment-analysis | Sentiment Analysis } is enabled, can be true or false */ sentiment_analysis?: boolean | null; /** * An array of results for the Sentiment Analysis model, if it is enabled. * See {@link https://www.assemblyai.com/docs/models/sentiment-analysis | Sentiment Analysis } for more information. */ sentiment_analysis_results?: SentimentAnalysisResult[] | null; /** * Whether {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker diarization } is enabled, can be true or false */ speaker_labels?: boolean | null; /** * Tell the speaker label model how many speakers it should attempt to identify, up to 10. See {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker diarization } for more details. */ speakers_expected?: number | null; /** * Advanced options for controlling speaker diarization parameters */ speaker_options?: SpeakerOptions | null; /** * The speech model used for the transcription. When `null`, the default model is used. * @defaultValue "null */ speech_model: SpeechModel | null; /** * Defaults to null. Reject audio files that contain less than this fraction of speech. * Valid values are in the range [0", 1] inclusive. */ speech_threshold?: number | null; /** * @deprecated * Whether speed boost is enabled */ speed_boost?: boolean | null; /** * The status of your transcript. Possible values are queued, processing, completed, or error. */ status: TranscriptStatus; /** * Whether {@link https://www.assemblyai.com/docs/models/summarization | Summarization } is enabled, either true or false */ summarization: boolean; /** * The generated summary of the media file, if {@link https://www.assemblyai.com/docs/models/summarization | Summarization } is enabled */ summary?: string | null; /** * The Summarization model used to generate the summary, * if {@link https://www.assemblyai.com/docs/models/summarization | Summarization } is enabled */ summary_model?: string | null; /** * The type of summary generated, if {@link https://www.assemblyai.com/docs/models/summarization | Summarization } is enabled */ summary_type?: string | null; /** * The textual transcript of your media file */ text?: string | null; /** * True while a request is throttled and false when a request is no longer throttled */ throttled?: boolean | null; /** * The list of custom topics provided if custom topics is enabled */ topics?: string[]; /** * When dual_channel or speaker_labels is enabled, a list of turn-by-turn utterance objects. * See {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker diarization } for more information. */ utterances?: TranscriptUtterance[] | null; /** * Whether webhook authentication details were provided */ webhook_auth: boolean; /** * The header name to be sent with the transcript completed or failed webhook requests */ webhook_auth_header_name?: string | null; /** * The status code we received from your server when delivering the transcript completed or failed webhook request, if a webhook URL was provided */ webhook_status_code?: number | null; /** * 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. */ webhook_url?: string | null; /** * The list of custom vocabulary to boost transcription probability for */ word_boost?: string[]; /** * An array of temporally-sequential word objects, one for each word in the transcript. * See {@link https://www.assemblyai.com/docs/models/speech-recognition | Speech recognition } for more information. */ words?: TranscriptWord[] | null; }; /** * How much to boost specified words */ export type TranscriptBoostParam = "low" | "default" | "high"; /** * Object containing words or phrases to replace, and the word or phrase to replace with * @example * ```js * { * "from": [ * "dicarlo" * ], * "to": "Decarlo" * } * ``` */ export type TranscriptCustomSpelling = { /** * Words or phrases to replace */ from: string[]; /** * Word or phrase to replace with */ to: string; }; /** * The language of your audio file. Possible values are found in {@link https://www.assemblyai.com/docs/concepts/supported-languages | Supported Languages }. * The default value is 'en_us'. * */ 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"; /** * A list of transcripts. Transcripts are sorted from newest to oldest. The previous URL always points to a page with older transcripts. * @example * ```js * { * "page_details": { * "limit": 3, * "result_count": 3, * "current_url": "https://api.assemblyai.com/v2/transcript?limit=3", * "prev_url": "https://api.assemblyai.com/v2/transcript?limit=3&before_id=28a73d01-98db-41dd-9e98-2533ba0af117", * "next_url": "https://api.assemblyai.com/v2/transcript?limit=3&after_id=b33f4691-85b7-4f31-be12-a87cef1c1229" * }, * "transcripts": [ * { * "id": "b33f4691-85b7-4f31-be12-a87cef1c1229", * "resource_url": "https://api.assemblyai.com/v2/transcript/b33f4691-85b7-4f31-be12-a87cef1c1229", * "status": "completed", * "created": "2024-03-11T21:29:59.936851", * "completed": "2024-03-11T21:30:07.314223", * "audio_url": "http://deleted_by_user", * "error": null * }, * { * "id": "ce522f10-d204-42e8-a838-6b95098145cc", * "resource_url": "https://api.assemblyai.com/v2/transcript/ce522f10-d204-42e8-a838-6b95098145cc", * "status": "error", * "created": "2024-03-11T21:23:59.979420", * "completed": null, * "audio_url": "https://storage.googleapis.com/client-docs-samples/nbc.oopsie", * "error": "Download error, unable to download https://storage.googleapis.com/client-docs-samples/nbc.oopsie. Please make sure the file exists and is accessible from the internet." * }, * { * "id": "28a73d01-98db-41dd-9e98-2533ba0af117", * "resource_url": "https://api.assemblyai.com/v2/transcript/28a73d01-98db-41dd-9e98-2533ba0af117", * "status": "completed", * "created": "2024-03-11T21:12:57.372215", * "completed": "2024-03-11T21:13:03.267020", * "audio_url": "https://assembly.ai/nbc.mp3", * "error": null * } * ] * } * ``` */ export type TranscriptList = { /** * Details of the transcript page */ page_details: PageDetails; /** * An array of transcripts */ transcripts: TranscriptListItem[]; }; /** * @example * ```js * { * "id": "9ea68fd3-f953-42c1-9742-976c447fb463", * "resource_url": "https://api.assemblyai.com/v2/transcript/9ea68fd3-f953-42c1-9742-976c447fb463", * "status": "completed", * "created": "2023-11-02T21:49:25.586965", * "completed": "2023-11-02T21:49:25.586965", * "audio_url": "https://assembly.ai/wildfires.mp3", * "error": null * } * ``` */ export type TranscriptListItem = { /** * The URL to the audio file */ audio_url: string; /** * The date and time the transcript was completed */ completed: Date | null; /** * The date and time the transcript was created */ created: Date; /** * Error message of why the transcript failed */ error: string | null; /** * The unique identifier for the transcript */ id: string; /** * The URL to retrieve the transcript */ resource_url: string; /** * The status of the transcript */ status: TranscriptStatus; }; /** * The parameters for creating a transcript * @example * ```js * { * "speech_model": null, * "language_code": "en_us", * "language_detection": true, * "language_confidence_threshold": 0.7, * "punctuate": true, * "format_text": true, * "multichannel": true, * "dual_channel": false, * "webhook_url": "https://your-webhook-url.tld/path", * "webhook_auth_header_name": "webhook-secret", * "webhook_auth_header_value": "webhook-secret-value", * "auto_highlights": true, * "audio_start_from": 10, * "audio_end_at": 280, * "word_boost": [ * "aws", * "azure", * "google cloud" * ], * "boost_param": "high", * "filter_profanity": true, * "redact_pii": true, * "redact_pii_audio": true, * "redact_pii_audio_quality": "mp3", * "redact_pii_policies": [ * "us_social_security_number", * "credit_card_number" * ], * "redact_pii_sub": "hash", * "speaker_labels": true, * "speakers_expected": 2, * "content_safety": true, * "iab_categories": true, * "custom_spelling": [], * "disfluencies": false, * "sentiment_analysis": true, * "auto_chapters": true, * "entity_detection": true, * "speech_threshold": 0.5, * "summarization": true, * "summary_model": "informative", * "summary_type": "bullets", * "custom_topics": true, * "topics": [] * } * ``` */ export type TranscriptOptionalParams = { /** * The point in time, in milliseconds, to stop transcribing in your media file */ audio_end_at?: number; /** * The point in time, in milliseconds, to begin transcribing in your media file */ audio_start_from?: number; /** * Enable {@link https://www.assemblyai.com/docs/models/auto-chapters | Auto Chapters }, can be true or false * @defaultValue false */ auto_chapters?: boolean; /** * Enable Key Phrases, either true or false * @defaultValue false */ auto_highlights?: boolean; /** * How much to boost specified words * @defaultValue default */ boost_param?: TranscriptBoostParam; /** * Enable {@link https://www.assemblyai.com/docs/models/content-moderation | Content Moderation }, can be true or false * @defaultValue false */ content_safety?: boolean; /** * The confidence threshold for the Content Moderation model. Values must be between 25 and 100. * @defaultValue 50 */ content_safety_confidence?: number; /** * Customize how words are spelled and formatted using to and from values */ custom_spelling?: TranscriptCustomSpelling[]; /** * Enable custom topics, either true or false * @defaultValue false */ custom_topics?: boolean; /** * Transcribe Filler Words, like "umm", in your media file; can be true or false * @defaultValue false */ disfluencies?: boolean; /** * @deprecated * Enable {@link https://www.assemblyai.com/docs/models/speech-recognition#dual-channel-transcription | Dual Channel } transcription, can be true or false. * @defaultValue false */ dual_channel?: boolean; /** * Enable {@link https://www.assemblyai.com/docs/models/entity-detection | Entity Detection }, can be true or false * @defaultValue false */ entity_detection?: boolean; /** * Filter profanity from the transcribed text, can be true or false * @defaultValue false */ filter_profanity?: boolean; /** * Enable Text Formatting, can be true or false * @defaultValue true */ format_text?: boolean; /** * Enable {@link https://www.assemblyai.com/docs/models/topic-detection | Topic Detection }, can be true or false * @defaultValue false */ iab_categories?: boolean; /** * The list of key terms used to generate the transcript with the Slam-1 speech model. Can't be used together with `prompt`. */ keyterms_prompt?: string[]; /** * The language of your audio file. Possible values are found in {@link https://www.assemblyai.com/docs/concepts/supported-languages | Supported Languages }. * The default value is 'en_us'. * * @defaultValue en_us */ language_code?: LiteralUnion | null; /** * The confidence threshold for the automatically detected language. * An error will be returned if the language confidence is below this threshold. * Defaults to 0. * * @defaultValue 0 */ language_confidence_threshold?: number; /** * Enable {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection }, either true or false. * @defaultValue false */ language_detection?: boolean; /** * Enable {@link https://www.assemblyai.com/docs/models/speech-recognition#multichannel-transcription | Multichannel } transcription, can be true or false. * @defaultValue false */ multichannel?: boolean; /** * The prompt used to generate the transcript with the Slam-1 speech model. Can't be used together with `keyterms_prompt`. */ prompt?: string; /** * Enable Automatic Punctuation, can be true or false * @defaultValue true */ punctuate?: boolean; /** * Redact PII from the transcribed text using the Redact PII model, can be true or false * @defaultValue false */ redact_pii?: boolean; /** * Generate a copy of the original media file with spoken PII "beeped" out, can be true or false. See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details. * @defaultValue false */ redact_pii_audio?: boolean; /** * Controls the filetype of the audio created by redact_pii_audio. Currently supports mp3 (default) and wav. See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details. * @defaultValue "mp3" */ redact_pii_audio_quality?: RedactPiiAudioQuality; /** * The list of PII Redaction policies to enable. See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details. */ redact_pii_policies?: PiiPolicy[]; /** * The replacement logic for detected PII, can be "entity_type" or "hash". See {@link https://www.assemblyai.com/docs/models/pii-redaction | PII redaction } for more details. * @defaultValue "hash" */ redact_pii_sub?: SubstitutionPolicy | null; /** * Enable {@link https://www.assemblyai.com/docs/models/sentiment-analysis | Sentiment Analysis }, can be true or false * @defaultValue false */ sentiment_analysis?: boolean; /** * Enable {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker diarization }, can be true or false * @defaultValue false */ speaker_labels?: boolean; /** * Tells the speaker label model how many speakers it should attempt to identify, up to 10". See {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker diarization } for more details. * @defaultValue "null */ speakers_expected?: number | null; /** * Advanced options for controlling speaker diarization parameters */ speaker_options?: SpeakerOptions | null; /** * The speech model to use for the transcription. When `null`, the "best" model is used. * @defaultValue best */ speech_model?: SpeechModel | null; /** * Reject audio files that contain less than this fraction of speech. * Valid values are in the range [0", 1] inclusive. * * @defaultValue 0 */ speech_threshold?: number | null; /** * Enable {@link https://www.assemblyai.com/docs/models/summarization | Summarization }, can be true or false * @defaultValue false */ summarization?: boolean; /** * The model to summarize the transcript * @defaultValue informative */ summary_model?: SummaryModel; /** * The type of summary * @defaultValue bullets */ summary_type?: SummaryType; /** * The list of custom topics */ topics?: string[]; /** * The header name to be sent with the transcript completed or failed webhook requests * @defaultValue null */ webhook_auth_header_name?: string | null; /** * The header value to send back with the transcript completed or failed webhook requests for added security * @defaultValue null */ webhook_auth_header_value?: string | null; /** * 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. */ webhook_url?: string; /** * The list of custom vocabulary to boost transcription probability for */ word_boost?: string[]; }; /** * @example * ```js * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter Decarlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University. Good morning, professor.", * "start": 250", * "end": 26950, * "confidence": 0.73033, * "words": [ * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.73033, * "speaker": null * }, * { * "text": "from", * "start": 730, * "end": 1022, * "confidence": 1, * "speaker": null * }, * { * "text": "hundreds", * "start": 1076, * "end": 1466, * "confidence": 0.99992, * "speaker": null * }, * { * "text": "of", * "start": 1498, * "end": 1646, * "confidence": 1, * "speaker": null * } * ] * } * ``` */ export type TranscriptParagraph = { /** * The confidence score for the transcript of this paragraph */ confidence: number; /** * The ending time, in milliseconds, of the paragraph */ end: number; /** * The starting time, in milliseconds, of the paragraph */ start: number; /** * The transcript of the paragraph */ text: string; /** * An array of words in the paragraph */ words: TranscriptWord[]; }; /** * The parameters for creating a transcript * @example * ```js * { * "speech_model": null, * "language_code": "en_us", * "language_detection": true, * "language_confidence_threshold": 0.7, * "audio_url": "https://assembly.ai/wildfires.mp3", * "punctuate": true, * "format_text": true, * "multichannel": true, * "dual_channel": false, * "webhook_url": "https://your-webhook-url/path", * "webhook_auth_header_name": "webhook-secret", * "webhook_auth_header_value": "webhook-secret-value", * "auto_highlights": true, * "audio_start_from": 10, * "audio_end_at": 280, * "word_boost": [ * "aws", * "azure", * "google cloud" * ], * "boost_param": "high", * "filter_profanity": true, * "redact_pii": true, * "redact_pii_audio": true, * "redact_pii_audio_quality": "mp3", * "redact_pii_policies": [ * "us_social_security_number", * "credit_card_number" * ], * "redact_pii_sub": "hash", * "speaker_labels": true, * "speakers_expected": 2, * "content_safety": true, * "iab_categories": true, * "custom_spelling": [], * "disfluencies": false, * "sentiment_analysis": true, * "auto_chapters": true, * "entity_detection": true, * "speech_threshold": 0.5, * "summarization": true, * "summary_model": "informative", * "summary_type": "bullets", * "custom_topics": true, * "topics": [] * } * ``` */ export type TranscriptParams = { /** * The URL of the audio or video file to transcribe. */ audio_url: string; } & TranscriptOptionalParams; /** * The notification when the transcript status is completed or error. * @example * ```js * { * "transcript_id": "9ea68fd3-f953-42c1-9742-976c447fb463", * "status": "completed" * } * ``` */ export type TranscriptReadyNotification = { /** * The status of the transcript. Either completed or error. */ status: TranscriptReadyStatus; /** * The ID of the transcript */ transcript_id: string; }; /** * The status of the transcript. Either completed or error. */ export type TranscriptReadyStatus = "completed" | "error"; /** * @example * ```js * { * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US.", * "start": 250, * "end": 6350, * "confidence": 0.72412, * "words": [ * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.72412, * "speaker": null * }, * { * "text": "from", * "start": 730, * "end": 1022, * "confidence": 0.99996, * "speaker": null * }, * { * "text": "hundreds", * "start": 1076, * "end": 1466, * "confidence": 0.99992, * "speaker": null * }, * { * "text": "of", * "start": 1498, * "end": 1646, * "confidence": 1, * "speaker": null * } * ], * "speaker": null * } * ``` */ export type TranscriptSentence = { /** * The channel of the sentence. The left and right channels are channels 1 and 2. Additional channels increment the channel number sequentially. */ channel?: string | null; /** * The confidence score for the transcript of this sentence */ confidence: number; /** * The ending time, in milliseconds, for the sentence */ end: number; /** * The speaker of the sentence if {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker Diarization } is enabled, else null */ speaker: string | null; /** * The starting time, in milliseconds, for the sentence */ start: number; /** * The transcript of the sentence */ text: string; /** * An array of words in the sentence */ words: TranscriptWord[]; }; /** * The status of your transcript. Possible values are queued, processing, completed, or error. */ export type TranscriptStatus = "queued" | "processing" | "completed" | "error"; /** * @example * ```js * { * "confidence": 0.9359033333333334, * "end": 26950, * "speaker": "A", * "start": 250, * "text": "Smoke from hundreds of wildfires in Canada is triggering air quality alerts throughout the US. Skylines from Maine to Maryland to Minnesota are gray and smoggy. And in some places, the air quality warnings include the warning to stay inside. We wanted to better understand what's happening here and why, so we called Peter de Carlo, an associate professor in the Department of Environmental Health and Engineering at Johns Hopkins University Varsity. Good morning, professor.", * "words": [ * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.97503, * "speaker": "A" * }, * { * "text": "from", * "start": 730, * "end": 1022, * "confidence": 0.99999, * "speaker": "A" * }, * { * "text": "hundreds", * "start": 1076, * "end": 1418, * "confidence": 0.99843, * "speaker": "A" * }, * { * "text": "of", * "start": 1434, * "end": 1614, * "confidence": 0.85, * "speaker": "A" * }, * { * "text": "wildfires", * "start": 1652, * "end": 2346, * "confidence": 0.89657, * "speaker": "A" * }, * { * "text": "in", * "start": 2378, * "end": 2526, * "confidence": 0.99994, * "speaker": "A" * }, * { * "text": "Canada", * "start": 2548, * "end": 3130, * "confidence": 0.93864, * "speaker": "A" * }, * { * "text": "is", * "start": 3210, * "end": 3454, * "confidence": 0.999, * "speaker": "A" * }, * { * "text": "triggering", * "start": 3492, * "end": 3946, * "confidence": 0.75366, * "speaker": "A" * }, * { * "text": "air", * "start": 3978, * "end": 4174, * "confidence": 1, * "speaker": "A" * }, * { * "text": "quality", * "start": 4212, * "end": 4558, * "confidence": 0.87745, * "speaker": "A" * }, * { * "text": "alerts", * "start": 4644, * "end": 5114, * "confidence": 0.94739, * "speaker": "A" * }, * { * "text": "throughout", * "start": 5162, * "end": 5466, * "confidence": 0.99726, * "speaker": "A" * }, * { * "text": "the", * "start": 5498, * "end": 5694, * "confidence": 0.79, * "speaker": "A" * }, * { * "text": "US.", * "start": 5732, * "end": 6382, * "confidence": 0.88, * "speaker": "A" * } * ] * } * ``` */ export type TranscriptUtterance = { /** * The channel of this utterance. The left and right channels are channels 1 and 2. Additional channels increment the channel number sequentially. */ channel?: string | null; /** * The confidence score for the transcript of this utterance */ confidence: number; /** * The ending time, in milliseconds, of the utterance in the audio file */ end: number; /** * 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. */ speaker: string; /** * The starting time, in milliseconds, of the utterance in the audio file */ start: number; /** * The text for this utterance */ text: string; /** * The words in the utterance. */ words: TranscriptWord[]; }; /** * The notifications sent to the webhook URL. */ export type TranscriptWebhookNotification = TranscriptReadyNotification | RedactedAudioNotification; /** * @example * ```js * { * "text": "Smoke", * "start": 250, * "end": 650, * "confidence": 0.97465, * "channel": null, * "speaker": null * } * ``` */ export type TranscriptWord = { /** * The channel of the word. The left and right channels are channels 1 and 2. Additional channels increment the channel number sequentially. */ channel?: string | null; /** * The confidence score for the transcript of this word */ confidence: number; /** * The ending time, in milliseconds, for the word */ end: number; /** * The speaker of the word if {@link https://www.assemblyai.com/docs/models/speaker-diarization | Speaker Diarization } is enabled, else null */ speaker: string | null; /** * The starting time, in milliseconds, for the word */ start: number; /** * The text of the word */ text: string; }; /** * @example * ```js * { * "upload_url": "https://cdn.assemblyai.com/upload/f756988d-47e2-4ca3-96ce-04bb168f8f2a" * } * ``` */ export type UploadedFile = { /** * A URL that points to your audio file, accessible only by AssemblyAI's servers */ upload_url: string; }; /** * @example * ```js * { * "text": "smoke", * "count": 6, * "timestamps": [ * [ * 250, * 650 * ], * [ * 49168, * 49398 * ], * [ * 55284, * 55594 * ], * [ * 168888, * 169118 * ], * [ * 215108, * 215386 * ], * [ * 225944, * 226170 * ] * ], * "indexes": [ * 0, * 136, * 156, * 486, * 652, * 698 * ] * } * ``` */ export type WordSearchMatch = { /** * The total amount of times the word is in the transcript */ count: number; /** * An array of all index locations for that word within the `words` array of the completed transcript */ indexes: number[]; /** * The matched word */ text: string; /** * An array of timestamps */ timestamps: WordSearchTimestamp[]; }; /** * @example * ```js * { * "id": "d5a3d302-066e-43fb-b63b-8f57baf185db", * "total_count": 10, * "matches": [ * { * "text": "smoke", * "count": 6, * "timestamps": [ * [ * 250, * 650 * ], * [ * 49168, * 49398 * ], * [ * 55284, * 55594 * ], * [ * 168888, * 169118 * ], * [ * 215108, * 215386 * ], * [ * 225944, * 226170 * ] * ], * "indexes": [ * 0, * 136, * 156, * 486, * 652, * 698 * ] * }, * { * "text": "wildfires", * "count": 4, * "timestamps": [ * [ * 1668, * 2346 * ], * [ * 33852, * 34546 * ], * [ * 50118, * 51110 * ], * [ * 231356, * 232354 * ] * ], * "indexes": [ * 4, * 90, * 140, * 716 * ] * } * ] * } * ``` */ export type WordSearchResponse = { /** * The ID of the transcript */ id: string; /** * The matches of the search */ matches: WordSearchMatch[]; /** * The total count of all matched instances. For e.g., word 1 matched 2 times, and word 2 matched 3 times, `total_count` will equal 5. */ total_count: number; }; /** * An array of timestamps structured as [`start_time`, `end_time`] in milliseconds * @example * ```js * [ * 250, * 650 * ] * ``` */ export type WordSearchTimestamp = number[]; export {};