diff --git a/Makefile b/Makefile deleted file mode 100644 index 46485a7..0000000 --- a/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -autogen: - cd scripts/generate-models && ./generate-models.sh - -.PHONY: autogen \ No newline at end of file diff --git a/package.json b/package.json index 4519c19..b3429ae 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "main": "./dist/index.js", "files": ["dist", "src"], "scripts": { + "refresh-schema": "./scripts/generate-models/generate-models.sh && npm run format", "format": "biome format --write .", "format:types": "biome format --write dist/**/*.ts", "build:clean": "rm -rf dist", diff --git a/schemas/batch.yml b/schemas/batch.yml index c3143ce..12bdc2a 100644 --- a/schemas/batch.yml +++ b/schemas/batch.yml @@ -2,10 +2,9 @@ swagger: "2.0" info: title: Speechmatics ASR REST API version: 2.0.0 - description: >- - The Speechmatics Automatic Speech Recognition REST API is used to - submit ASR jobs and receive the results. The supported job type - is transcription of audio files. + description: The Speechmatics Automatic Speech Recognition REST API is used to + submit ASR jobs and receive the results. The supported job type is + transcription of audio files. contact: email: support@speechmatics.com basePath: https://asr.api.speechmatics.com/v2 @@ -27,38 +26,32 @@ parameters: description: Early Access Release Tag required: false type: string - paths: - "/jobs": + /jobs: parameters: - $ref: "#/parameters/AuthHeader" - $ref: "#/parameters/EARTag" post: - tags: - - jobs - summary: Create a New Job + summary: Create a new job. consumes: - multipart/form-data parameters: - name: config in: formData type: string - description: >- - JSON containing a `JobConfig` model indicating the - type and parameters for the recognition job. + description: JSON containing a `JobConfig` model indicating the type and + parameters for the recognition job. required: true - name: data_file in: formData - description: >- - The data file to be processed. Alternatively the data file - can be fetched from a url specified in `JobConfig`. + description: The data file to be processed. Alternatively the data file can be + fetched from a url specified in `JobConfig`. required: false type: file - name: text_file in: formData - description: >- - For alignment jobs, the text file that the data file - should be aligned to. + description: For alignment jobs, the text file that the data file should be + aligned to. required: false type: file responses: @@ -109,6 +102,35 @@ paths: application/json: code: 500 error: Internal Server Error + tags: + - jobs + x-codeSamples: + - lang: Python + label: Python + source: | + from speechmatics.batch_client import BatchClient + + # Open the client using a context manager + with BatchClient("YOUR_API_KEY") as client: + job_id = client.submit_job( + audio="PATH_TO_FILE", + ) + print(job_id) + - lang: cURL + label: cURL + source: > + API_KEY="YOUR_API_KEY" + + PATH_TO_FILE="example.wav" + + + curl -L -X POST "https://asr.api.speechmatics.com/v2/jobs/" \ + -H "Authorization: Bearer ${API_KEY}" \ + -F data_file=@${PATH_TO_FILE} \ + -F config='{"type": "transcription","transcription_config": { "operating_point":"enhanced", "language": "en" }}' + - lang: CLI + label: CLI + source: speechmatics batch transcribe example.wav get: summary: List all jobs. parameters: @@ -116,25 +138,22 @@ paths: in: query type: string format: date-time - description: >- - UTC Timestamp cursor for paginating request response. - Filters jobs based on creation time to the nearest millisecond. Accepts up - to nanosecond precision, truncating to millisecond precision. - By default, the response will start with the most recent job. + description: UTC Timestamp cursor for paginating request response. Filters jobs + based on creation time to the nearest millisecond. Accepts up to + nanosecond precision, truncating to millisecond precision. By + default, the response will start with the most recent job. required: false - name: limit in: query type: integer maximum: 100 minimum: 1 - description: >- - Limit for paginating the request response. Defaults to 100. + description: Limit for paginating the request response. Defaults to 100. required: false - name: include_deleted in: query type: boolean - description: >- - Specifies whether deleted jobs should be included in the response. + description: Specifies whether deleted jobs should be included in the response. Defaults to false. required: false responses: @@ -168,8 +187,8 @@ paths: application/json: code: 500 error: Internal Server Error - "503": - description: Service Unavailable + tags: + - jobs x-codeSamples: - lang: Python label: Python @@ -181,9 +200,9 @@ paths: # Here, we get and print out the name # of the first job if it exists - if jobs_list: - first_job_name = jobs_list[0]['data_name'] - print(first_job_name) + if len(jobs_list): + first_job_name = jobs_list["jobs"][0]["data_name"] + print(first_job_name) - lang: cURL label: cURL source: > @@ -195,7 +214,7 @@ paths: - lang: CLI label: CLI source: speechmatics batch list-jobs - "/jobs/{jobid}": + /jobs/{jobid}: parameters: - $ref: "#/parameters/AuthHeader" - $ref: "#/parameters/EARTag" @@ -247,6 +266,33 @@ paths: application/json: code: 500 error: Internal Server Error + tags: + - jobs + x-codeSamples: + - lang: Python + label: Python + source: | + from speechmatics.batch_client import BatchClient + + # This example shows how to check the duration of the file + with BatchClient("YOUR_API_KEY") as client: + job_response = client.check_job_status("YOUR_JOB_ID") + + job_duration = job_response["job"]["duration"] + print(job_duration) + - lang: cURL + label: cURL + source: > + JOB_ID="YOUR_JOB_ID" + + API_KEY="YOUR_API_KEY" + + + curl -L -X GET "https://asr.api.speechmatics.com/v2/jobs/${JOB_ID}" \ + -H "Authorization: Bearer ${API_KEY}" + - lang: CLI + label: CLI + source: speechmatics batch job-status --job-id YOUR_JOB_ID delete: summary: Delete a job and remove all associated resources. parameters: @@ -258,9 +304,9 @@ paths: x-example: a1b2c3d4e5 - name: force in: query - description: >- - When set, a running job will be force terminated. When unset (default), - a running job will not be terminated and request will return HTTP 423 Locked. + description: When set, a running job will be force terminated. When unset + (default), a running job will not be terminated and request will + return HTTP 423 Locked. required: false type: boolean responses: @@ -310,8 +356,8 @@ paths: application/json: code: 500 error: Internal Server Error - "503": - description: Service Unavailable + tags: + - jobs x-codeSamples: - lang: Python label: Python @@ -333,7 +379,119 @@ paths: - lang: CLI label: CLI source: speechmatics batch delete --job-id YOUR_JOB_ID - "/jobs/{jobid}/transcript": + /jobs/{jobid}/data: + parameters: + - $ref: "#/parameters/AuthHeader" + - $ref: "#/parameters/EARTag" + get: + summary: Get the data file used as input to a job. + produces: + - application/octet-stream + - application/json + parameters: + - name: jobid + in: path + description: ID of the job. + required: true + type: string + x-example: a1b2c3d4e5 + responses: + "200": + description: OK + schema: + type: file + "401": + description: Unauthorized + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 401 + error: Permission Denied + "404": + description: Not found + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 404 + error: Job not found + "410": + description: Gone + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 410 + error: File Expired + detail: File deleted from the storage + "429": + description: Rate Limited + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 500 + error: Internal Server Error + /jobs/{jobid}/text: + parameters: + - $ref: "#/parameters/AuthHeader" + - $ref: "#/parameters/EARTag" + get: + summary: Get the text file used as input to an alignment job. + produces: + - text/plain + - application/json + parameters: + - name: jobid + in: path + description: ID of the job. + required: true + type: string + x-example: a1b2c3d4e5 + responses: + "200": + description: OK + schema: + type: file + "401": + description: Unauthorized + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 401 + error: Permission Denied + "404": + description: Not found + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 404 + error: Job not found + "410": + description: Gone + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 410 + error: File Expired + detail: File deleted from the storage + "429": + description: Rate Limited + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 500 + error: Internal Server Error + /jobs/{jobid}/transcript: parameters: - $ref: "#/parameters/AuthHeader" - $ref: "#/parameters/EARTag" @@ -353,9 +511,8 @@ paths: x-example: a1b2c3d4e5 - name: format in: query - description: >- - The transcription format (by default the `json-v2` format - is returned). + description: The transcription format (by default the `json-v2` format is + returned). required: false type: string enum: @@ -371,21 +528,23 @@ paths: application/vnd.speechmatics.v2+json: format: "2.7" job: - created_at: "2018-01-09T12:29:01.853047Z" + created_at: 2018-01-09T12:29:01.853047Z data_name: recording.mp3 duration: 244 id: a1b2c3d4e5 tracking: title: ACME Q12018 Statement reference: /data/clients/ACME/statements/segs/2018Q1-seg8 - tags: ["quick-review", "segment"] + tags: + - quick-review + - segment details: client: ACME Corp segment: 8 seg_start: 963.201 seg_end: 1091.481 metadata: - created_at: "2018-01-09T12:31:46.918860Z" + created_at: 2018-01-09T12:31:46.918860Z type: transcription transcription_config: additional_vocab: @@ -433,7 +592,7 @@ paths: type: punctuation alternatives: - confidence: 0.98 - content: "." + content: . language: en display: direction: ltr @@ -475,7 +634,49 @@ paths: application/json: code: 500 error: Internal Server Error - "/jobs/{jobid}/alignment": + tags: + - jobs + x-codeSamples: + - lang: Python + label: Python + source: > + from speechmatics.batch_client import BatchClient + + + # This examples shows how to unpack various things from the transcript + + with BatchClient("YOUR_API_KEY") as client: + transcript = client.get_job_result("YOUR_JOB_ID") + + # Print out the first word of the transcript + first_word = transcript["results"][0][0]["alternatives"][0] + print(first_word) + + # Supposing we had submitted a translation, we might get the first sentence + translation_sentence = transcript["translations"]["de"][0][content] + print(translation_sentence) + + # If we wanted a summary + summary = transcript["summary"]["content"] + print(summary) + + # If we wanted to check for sentiment analysis + first_sentiment = transcript["sentiment_analysis"]["segments"][0]["sentiment"] + print(first_sentiment) + - lang: cURL + label: cURL + source: > + JOB_ID="YOUR_JOB_ID" + + API_KEY="YOUR_API_KEY" + + + curl -L -X GET "https://asr.api.speechmatics.com/v2/jobs/${JOB_ID}/transcript?format=txt" \ + -H "Authorization: Bearer ${API_KEY}" + - lang: CLI + label: CLI + source: speechmatics batch get-results --job-id YOUR_JOB_ID + /jobs/{jobid}/alignment: parameters: - $ref: "#/parameters/AuthHeader" - $ref: "#/parameters/EARTag" @@ -493,13 +694,11 @@ paths: x-example: a1b2c3d4e5 - name: tags in: query - description: >- - Control how timing information is added to the text file - provided as input to the alignment job. If set to - `word_start_and_end`, SGML tags are inserted at the start - and end of each word, for example . If set to - `one_per_line` square bracket tags are inserted at the - start of each line, for example `[00:00:00.4] `. The + description: Control how timing information is added to the text file provided + as input to the alignment job. If set to `word_start_and_end`, SGML + tags are inserted at the start and end of each word, for example + . If set to `one_per_line` square bracket tags are + inserted at the start of each line, for example `[00:00:00.4] `. The default is `word_start_and_end`. required: false type: string @@ -553,15 +752,95 @@ paths: error: Internal Server Error externalDocs: description: More details of our alignment service can be found here. - url: "https://app.speechmatics.com/api-samples/alignment-guide" - "/jobs/{jobid}/lattice": + url: https://docs.speechmatics.com/features-other/word-alignment + tags: + - jobs + x-codeSamples: + - lang: cURL + label: cURL + source: > + JOB_ID="YOUR_JOB_ID" + + API_KEY="YOUR_API_KEY" + + + curl -L -X GET "https://asr.api.speechmatics.com/v2/jobs/${JOB_ID}/alignment" \ + -H "Authorization: Bearer ${API_KEY}" + /jobs/{jobid}/log: parameters: - $ref: "#/parameters/AuthHeader" - $ref: "#/parameters/EARTag" get: - tags: - - jobs - summary: Get the Usage Statistics + summary: Get the log file for a job. + produces: + - application/json + - text/plain + parameters: + - name: jobid + in: path + description: ID of the job. + required: true + type: string + x-example: a1b2c3d4e5 + responses: + "200": + description: OK + schema: + type: file + examples: + text/plain: > + 2021-01-23 17:58:55,559 INFO orchestrator.transport.cmd.utils + Loading model 'en' + "401": + description: Unauthorized + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 401 + error: Permission Denied + "404": + description: Not Found + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 404 + error: Log file not available + detail: Could not read log file + "410": + description: Gone + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 410 + error: File Expired + detail: File deleted from the storage + "429": + description: Rate Limited + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 500 + error: Internal Server Error + "501": + description: Not Implemented + schema: + $ref: "#/definitions/ErrorResponse" + examples: + application/json: + code: 501 + error: Not Implemented + /usage: + parameters: + - $ref: "#/parameters/AuthHeader" + - $ref: "#/parameters/EARTag" + get: + summary: Get the usage statistics. produces: - application/json parameters: @@ -570,13 +849,17 @@ paths: required: false type: string format: date - description: "Include usage after the given date (inclusive). This is a [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar date format: `YYYY-MM-DD`." + description: "Include usage after the given date (inclusive). This is a + [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar date + format: `YYYY-MM-DD`." - name: until in: query required: false type: string format: date - description: "Include usage before the given date (inclusive). This is a [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar date format: `YYYY-MM-DD`." + description: "Include usage before the given date (inclusive). This is a + [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) calendar date + format: `YYYY-MM-DD`." responses: "200": description: OK @@ -584,8 +867,8 @@ paths: $ref: "#/definitions/UsageResponse" examples: application/json: - since: "2021-09-12T00:00:00Z" - until: "2022-01-01T23:59:59Z" + since: 2021-09-12T00:00:00Z + until: 2022-01-01T23:59:59Z summary: - mode: batch type: transcription @@ -623,7 +906,16 @@ paths: description: Internal Server Error schema: $ref: "#/definitions/ErrorResponse" + tags: + - jobs + x-codeSamples: + - lang: cURL + label: cURL + source: | + API_KEY="YOUR_API_KEY" + curl -L -X GET "https://asr.api.speechmatics.com/v2/usage" \ + -H "Authorization: Bearer ${API_KEY}" definitions: ErrorResponse: type: object @@ -644,7 +936,6 @@ definitions: - Forbidden - Resource Locked - Format Not Supported - - Insufficient Credit - Internal Server Error - Job error - Job Expired @@ -664,7 +955,6 @@ definitions: - Permission Denied - Requested product not available - Transcription not ready - - Lattice not generated - Log file not available - Requested Early Access Release not available - Unprocessable Entity @@ -690,7 +980,9 @@ definitions: example: title: ACME Q12018 Earnings Call reference: /data/clients/ACME/statements/segs/2018Q1-seg8 - tags: ["quick-review", "segment"] + tags: + - quick-review + - segment details: client: ACME Corp segment: 8 @@ -707,11 +999,9 @@ definitions: x-omitempty: true items: type: string - description: >- - A list of additional headers to be added to the input fetch - request when using http or https. This is intended to - support authentication or authorization, for example by - supplying an OAuth2 bearer token. + description: A list of additional headers to be added to the input fetch request + when using http or https. This is intended to support authentication + or authorization, for example by supplying an OAuth2 bearer token. AlignmentConfig: required: - language @@ -729,8 +1019,7 @@ definitions: - unsupported_translation_pair message: type: string - description: >- - Human readable error message + description: Human readable error message SummarizationError: properties: type: @@ -740,8 +1029,7 @@ definitions: - unsupported_language message: type: string - description: >- - Human readable error message + description: Human readable error message SentimentAnalysisError: properties: type: @@ -751,8 +1039,7 @@ definitions: - unsupported_language message: type: string - description: >- - Human readable error message + description: Human readable error message TopicDetectionError: properties: type: @@ -763,8 +1050,7 @@ definitions: - unsupported_language message: type: string - description: >- - Human readable error message + description: Human readable error message AutoChaptersResultError: properties: type: @@ -774,31 +1060,30 @@ definitions: - unsupported_language message: type: string - description: >- - Human readable error message + description: Human readable error message TranscriptionConfig: required: - language properties: language: type: string - description: >- - Language model to process the audio input, normally - specified as an ISO language code + description: Language model to process the audio input, normally specified as an + ISO language code domain: type: string - description: >- - Request a specialized model based on 'language' but optimized for a particular field, e.g. "finance" or "medical". + description: Request a specialized model based on 'language' but optimized for a + particular field, e.g. "finance" or "medical". output_locale: type: string - description: >- - Language locale to be used when generating the transcription + description: Language locale to be used when generating the transcription output, normally specified as an ISO language code operating_point: $ref: "#/definitions/OperatingPoint" - description: |- + description: >- Specify an operating point to use. + Operating points change the transcription process in a high level way, such as altering the acoustic model. + The default is `standard`. - **standard**: - **enhanced**: transcription will take longer but be more accurate than 'standard' @@ -817,9 +1102,8 @@ definitions: x-omitempty: true items: type: string - description: >- - List of custom words or phrases that should be recognized. Alternative - pronunciations can be specified to aid recognition. + description: List of custom words or phrases that should be recognized. + Alternative pronunciations can be specified to aid recognition. punctuation_overrides: properties: sensitivity: @@ -827,61 +1111,80 @@ definitions: format: float minimum: 0 maximum: 1 - description: |- - Ranges between zero and one. Higher values will produce more punctuation. The default is 0.5. + description: Ranges between zero and one. Higher values will produce more + punctuation. The default is 0.5. permitted_marks: type: array items: type: string - pattern: "^(.|all)$" - description: >- - The punctuation marks which the client is prepared to accept in transcription output, - or the special value 'all' (the default). Unsupported marks are ignored. This value is used to - guide the transcription process. - description: >- - Control punctuation settings. + pattern: ^(.|all)$ + description: The punctuation marks which the client is prepared to accept in + transcription output, or the special value 'all' (the default). + Unsupported marks are ignored. This value is used to guide the + transcription process. + description: Control punctuation settings. diarization: type: string enum: - none - speaker - channel + - speaker_change + - channel_and_speaker_change description: >- Specify whether speaker or channel labels are added to the transcript. + The default is `none`. - **none**: no speaker or channel labels are added. - **speaker**: speaker attribution is performed based on acoustic matching; all input channels are mixed into a single stream for processing. - **channel**: multiple input channels are processed individually and collated into a single transcript. + - **speaker_change**: the output indicates when the speaker in the audio changes. + No speaker attribution is performed. This is a faster method + than speaker. The reported speaker changes may not agree with speaker. + - **channel_and_speaker_change**: both channel and speaker_change are switched on. + The speaker change is indicated if more than one speaker + are recorded in one channel. + speaker_change_sensitivity: + type: number + format: float + minimum: 0 + maximum: 1 + description: Ranges between zero and one. Controls how responsive the system is + for potential speaker changes. High value indicates high sensitivity. + Defaults to 0.4. channel_diarization_labels: type: array x-omitempty: true items: type: string - pattern: "^[A-Za-z0-9._]+$" + pattern: ^[A-Za-z0-9._]+$ description: Transcript labels to use when using collating separate input channels. enable_entities: type: boolean - description: >- - Include additional 'entity' objects in the transcription results (e.g. dates, numbers) and - their original spoken form. These entities are interleaved with other types of results. - The concatenation of these words is represented as a single entity with the concatenated - written form present in the 'content' field. The entities contain a 'spoken_form' field, - which can be used in place of the corresponding 'word' type results, in case a spoken form - is preferred to a written form. They also contain a 'written_form', which can be used - instead of the entity, if you want a breakdown of the words without spaces. They can still - contain non-breaking spaces and other special whitespace characters, as they are considered - part of the word for the formatting output. In case of a written_form, the individual word - times are estimated and might not be accurate if the order of the words in the written form - does not correspond to the order they were actually spoken (such as 'one hundred million - dollars' and '$100 million'). + description: Include additional 'entity' objects in the transcription results + (e.g. dates, numbers) and their original spoken form. These entities + are interleaved with other types of results. The concatenation of + these words is represented as a single entity with the concatenated + written form present in the 'content' field. The entities contain a + 'spoken_form' field, which can be used in place of the corresponding + 'word' type results, in case a spoken form is preferred to a written + form. They also contain a 'written_form', which can be used instead of + the entity, if you want a breakdown of the words without spaces. They + can still contain non-breaking spaces and other special whitespace + characters, as they are considered part of the word for the formatting + output. In case of a written_form, the individual word times are + estimated and might not be accurate if the order of the words in the + written form does not correspond to the order they were actually + spoken (such as 'one hundred million dollars' and '$100 million'). max_delay_mode: type: string enum: - fixed - flexible - description: Whether or not to enable flexible endpointing and allow the entity to continue to be spoken. + description: Whether or not to enable flexible endpointing and allow the entity + to continue to be spoken. speaker_diarization_config: description: Configuration for speaker diarization properties: @@ -890,12 +1193,14 @@ definitions: format: float minimum: 0 maximum: 1 - description: >- - Controls how sensitive the algorithm is in terms of keeping similar speakers separate, as opposed - to combining them into a single speaker. Higher values will typically lead to more speakers, as the - degree of difference between speakers in order to allow them to remain distinct will be lower. A lower - value for this parameter will conversely guide the algorithm towards being less sensitive in terms of - retaining similar speakers, and as such may lead to fewer speakers overall. The default is 0.5. + description: Controls how sensitive the algorithm is in terms of keeping similar + speakers separate, as opposed to combining them into a single + speaker. Higher values will typically lead to more speakers, as + the degree of difference between speakers in order to allow them + to remain distinct will be lower. A lower value for this + parameter will conversely guide the algorithm towards being less + sensitive in terms of retaining similar speakers, and as such may + lead to fewer speakers overall. The default is 0.5. example: language: en output_locale: en-GB @@ -965,15 +1270,12 @@ definitions: - alignment.one_per_line - data - text - - lattice - description: >- - Specifies a list of items to be attached to the notification - message. When multiple items are requested, they are - included as named file attachments. + description: Specifies a list of items to be attached to the notification + message. When multiple items are requested, they are included as named + file attachments. method: type: string - description: >- - The method to be used with http and https urls. The default is post. + description: The method to be used with http and https urls. The default is post. enum: - post - put @@ -982,27 +1284,53 @@ definitions: x-omitempty: true items: type: string - description: >- - A list of additional headers to be added to the notification - request when using http or https. This is intended to - support authentication or authorization, for example by - supplying an OAuth2 bearer token. + description: A list of additional headers to be added to the notification + request when using http or https. This is intended to support + authentication or authorization, for example by supplying an OAuth2 + bearer token. example: - url: https://collector.example.org/callback - contents: ["transcript:json-v2"] + contents: + - transcript:json-v2 auth_headers: - [ - "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM", - ] + - "Authorization: Bearer + eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNW\ + RhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb1\ + 1y1537t3rGzcM" + LanguagePackInfo: + description: Properties of the language pack. + required: + - word_delimiter + properties: + language_description: + type: string + description: Full descriptive name of the language, e.g. 'Japanese'. + word_delimiter: + type: string + description: The character to use to separate words. + writing_direction: + type: string + enum: + - left-to-right + - right-to-left + description: The direction that words in the language should be written and read in. + itn: + type: boolean + description: Whether or not ITN (inverse text normalization) is available for + the language pack. + adapted: + type: boolean + description: Whether or not language model adaptation has been applied to the + language pack. OutputConfig: x-omitempty: true type: object properties: srt_overrides: - description: >- - Parameters that override default values of srt conversion. - max_line_length: sets maximum count of characters per subtitle line including white space. - max_lines: sets maximum count of lines in a subtitle section. + description: "Parameters that override default values of srt conversion. + max_line_length: sets maximum count of characters per subtitle line + including white space. max_lines: sets maximum count of lines in a + subtitle section." type: object properties: max_line_length: @@ -1086,9 +1414,8 @@ definitions: - allow - reject - use_default_language - description: >- - Action to take if all of the predicted languages are - below the confidence threshold + description: Action to take if all of the predicted languages are below the + confidence threshold default_language: type: string SummarizationConfig: @@ -1126,16 +1453,15 @@ definitions: properties: id: type: string - description: >- - The unique ID assigned to the job. Keep a record of this for later + description: The unique ID assigned to the job. Keep a record of this for later retrieval of your completed job. example: id: a1b2c3d4e5 JobDetails: - description: >- - Document describing a job. JobConfig will be present in JobDetails returned for GET jobs/ request in SaaS and in - Batch Appliance, but it will not be present in JobDetails returned as item in RetrieveJobsResponse in case of Batch - Appliance. + description: Document describing a job. JobConfig will be present in JobDetails + returned for GET jobs/ request in SaaS and in Batch Appliance, but it + will not be present in JobDetails returned as item in RetrieveJobsResponse + in case of Batch Appliance. required: - created_at - data_name @@ -1145,7 +1471,7 @@ definitions: created_at: type: string format: date-time - example: "2018-01-09T12:29:01.853047Z" + example: 2018-01-09T12:29:01.853047Z description: The UTC date time the job was created. data_name: type: string @@ -1163,13 +1489,12 @@ definitions: description: The unique id assigned to the job. status: type: string - description: >- - The status of the job. - * `running` - The job is actively running. - * `done` - The job completed successfully. - * `rejected` - The job was accepted at first, but later could not be processed by the transcriber. - * `deleted` - The user deleted the job. - * `expired` - The system deleted the job. Usually because the job was in the `done` state for a very long time. + description: The status of the job. * `running` - The job is actively running. * + `done` - The job completed successfully. * `rejected` - The job was + accepted at first, but later could not be processed by the + transcriber. * `deleted` - The user deleted the job. * `expired` - The + system deleted the job. Usually because the job was in the `done` + state for a very long time. enum: - running - done @@ -1180,12 +1505,12 @@ definitions: $ref: "#/definitions/JobConfig" lang: type: string - description: >- - Optional parameter used for backwards compatibility with v1 api + description: Optional parameter used for backwards compatibility with v1 api errors: x-omitempty: true - description: >- - Optional list of errors that have occurred in user interaction, for example: audio could not be fetched or notification could not be sent. + description: "Optional list of errors that have occurred in user interaction, + for example: audio could not be fetched or notification could not be + sent." type: array items: $ref: "#/definitions/JobDetailError" @@ -1199,7 +1524,7 @@ definitions: $ref: "#/definitions/JobDetails" example: jobs: - - created_at: "2018-01-09T12:29:01.853047Z" + - created_at: 2018-01-09T12:29:01.853047Z data_name: recording.mp3 duration: 244 id: a1b2c3d4e5 @@ -1208,7 +1533,9 @@ definitions: tracking: title: ACME Q12018 Statement reference: /data/clients/ACME/statements/segs/2018Q1-seg8 - tags: ["quick-review", "segment"] + tags: + - quick-review + - segment details: client: ACME Corp segment: 8 @@ -1235,7 +1562,9 @@ definitions: - Caller notification_config: - url: https://collector.example.org/callback - contents: ["transcript", "data"] + contents: + - transcript + - data auth_headers: - "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZh\ @@ -1257,14 +1586,14 @@ definitions: title: Project X Intro reference: /data/projects/X/overview/audio/hello.wav RetrieveJobResponse: - required: &ref_0 + required: &a1 - job - properties: &ref_1 + properties: &a2 job: $ref: "#/definitions/JobDetails" - example: &ref_2 + example: job: - created_at: "2018-01-09T12:29:01.853047Z" + created_at: 2018-01-09T12:29:01.853047Z data_name: recording.mp3 duration: 244 id: a1b2c3d4e5 @@ -1291,26 +1620,31 @@ definitions: - Caller notification_config: - url: https://collector.myorg.com/callback - contents: ["transcript", "data"] + contents: + - transcript + - data auth_headers: - [ - "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM", - ] + - "Authorization: Bearer + eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi\ + 0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZ\ + xH-x5mb11y1537t3rGzcM" tracking: title: ACME Q12018 Statement reference: /data/clients/ACME/statements/segs/2018Q1-seg8 - tags: ["quick-review", "segment"] + tags: + - quick-review + - segment details: client: ACME Corp segment: 8 seg_start: 963.201 seg_end: 1091.481 DeleteJobResponse: - required: *ref_0 - properties: *ref_1 + required: *a1 + properties: *a2 example: job: - created_at: "2018-01-09T12:29:01.853047Z" + created_at: 2018-01-09T12:29:01.853047Z data_name: recording.mp3 duration: 244 id: a1b2c3d4e5 @@ -1337,24 +1671,28 @@ definitions: - Caller notification_config: - url: https://collector.myorg.com/callback - contents: ["transcript", "data"] + contents: + - transcript + - data auth_headers: - [ - "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM", - ] + - "Authorization: Bearer + eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhmODZhZi\ + 0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZ\ + xH-x5mb11y1537t3rGzcM" tracking: title: ACME Q12018 Statement reference: /data/clients/ACME/statements/segs/2018Q1-seg8 - tags: ["quick-review", "segment"] + tags: + - quick-review + - segment details: client: ACME Corp segment: 8 seg_start: 963.201 seg_end: 1091.481 JobInfo: - description: >- - Summary information about an ASR job, to support identification - and tracking. + description: Summary information about an ASR job, to support identification and + tracking. required: - created_at - data_name @@ -1364,7 +1702,7 @@ definitions: created_at: type: string format: date-time - example: "2018-01-09T12:29:01.853047Z" + example: 2018-01-09T12:29:01.853047Z description: The UTC date time the job was created. data_name: type: string @@ -1383,10 +1721,8 @@ definitions: tracking: $ref: "#/definitions/TrackingData" RecognitionMetadata: - description: >- - Summary information about the output from an ASR job, comprising - the job type and configuration parameters used when generating - the output. + description: Summary information about the output from an ASR job, comprising + the job type and configuration parameters used when generating the output. required: - created_at - type @@ -1394,7 +1730,7 @@ definitions: created_at: type: string format: date-time - example: "2018-01-09T12:29:01.853047Z" + example: 2018-01-09T12:29:01.853047Z description: The UTC date time the transcription output was created. type: $ref: "#/definitions/JobType" @@ -1423,9 +1759,9 @@ definitions: $ref: "#/definitions/LanguagePackInfo" language_identification: $ref: "#/definitions/LanguageIdentificationResult" - description: >- - Result of the language identification of the audio, configured using `language_identification_config`, - or setting the transcription language to `auto`. + description: Result of the language identification of the audio, configured + using `language_identification_config`, or setting the transcription + language to `auto`. RecognitionDisplay: required: - direction @@ -1436,8 +1772,7 @@ definitions: - ltr - rtl RecognitionAlternative: - description: >- - List of possible job output item values, ordered by likelihood. + description: List of possible job output item values, ordered by likelihood. required: - content - confidence @@ -1459,10 +1794,9 @@ definitions: items: type: string RecognitionResult: - description: >- - An ASR job output item. The primary item types are `word` and - `punctuation`. Other item types may be present, for example to - provide semantic information of different forms. + description: An ASR job output item. The primary item types are `word` and + `punctuation`. Other item types may be present, for example to provide + semantic information of different forms. required: - start_time - end_time @@ -1478,17 +1812,21 @@ definitions: format: float is_eos: type: boolean - description: >- - Whether the punctuation mark is an end of sentence character. Only applies to punctuation marks. + description: Whether the punctuation mark is an end of sentence character. Only + applies to punctuation marks. type: type: string - description: >- - New types of items may appear without being requested; - unrecognized item types can be ignored. + description: New types of items may appear without being requested; unrecognized + item types can be ignored. enum: - word - punctuation - speaker_change + - entity + written_form: + $ref: "#/definitions/WrittenFormRecognitionResult" + spoken_form: + $ref: "#/definitions/SpokenFormRecognitionResult" alternatives: type: array items: @@ -1505,6 +1843,62 @@ definitions: speaker: S1 display: direction: ltr + WrittenFormRecognitionResult: + description: A WrittenFormRecognitionResult describes a simple object which + consists solely of 'word' type entries with a start and end time. It can + occur only inside the written_form property of a full RecognitionResult" + properties: + alternatives: + items: + $ref: "#/definitions/RecognitionAlternative" + type: array + end_time: + format: float + type: number + start_time: + format: float + type: number + type: + description: "What kind of object this is. See #/Definitions/RecognitionResult + for definitions of the enums." + enum: + - word + type: string + required: + - start_time + - end_time + - type + - alternatives + type: object + SpokenFormRecognitionResult: + description: A SpokenFormRecognitionResult describes a simple object which + consists solely of 'word' or 'punctuation' type entries with a start and + end time. It can occur only inside the spoken_form property of a full + "RecognitionResult" + properties: + alternatives: + items: + $ref: "#/definitions/RecognitionAlternative" + type: array + end_time: + format: float + type: number + start_time: + format: float + type: number + type: + description: "What kind of object this is. See #/Definitions/RecognitionResult + for definitions of the enums." + enum: + - word + - punctuation + type: string + required: + - start_time + - end_time + - type + - alternatives + type: object RetrieveTranscriptResponse: type: object required: @@ -1527,8 +1921,9 @@ definitions: $ref: "#/definitions/RecognitionResult" translations: type: object - description: >- - Translations of the transcript into other languages. It is a map of ISO language codes to arrays of translated sentences. Configured using `translation_config`. + description: Translations of the transcript into other languages. It is a map of + ISO language codes to arrays of translated sentences. Configured using + `translation_config`. additionalProperties: type: array items: @@ -1537,12 +1932,12 @@ definitions: de: - start_time: 0.5 end_time: 1.3 - content: "Guten Tag, wie geht es dir?" + content: Guten Tag, wie geht es dir? speaker: UU fr: - - start_time: 0.50 + - start_time: 0.5 end_time: 1.3 - content: "Bonjour, comment ça va?" + content: Bonjour, comment ça va? speaker: UU summary: $ref: "#/definitions/SummarizationResult" @@ -1553,8 +1948,7 @@ definitions: chapters: $ref: "#/definitions/AutoChaptersResult" SummarizationResult: - description: >- - Summary of the transcript, configured using `summarization_config`. + description: Summary of the transcript, configured using `summarization_config`. type: object properties: content: @@ -1571,28 +1965,31 @@ definitions: properties: segments: type: array - description: An array of objects that represent a segment of text and its associated sentiment. + description: An array of objects that represent a segment of text and its + associated sentiment. items: - description: A an object that holds overall sentiment information, and per-speaker and per-channel sentiment data. + description: A an object that holds overall sentiment information, and + per-speaker and per-channel sentiment data. $ref: "#/definitions/SentimentSegment" summary: - description: An object that holds overall sentiment information, and per-speaker and per-channel sentiment data. + description: An object that holds overall sentiment information, and per-speaker + and per-channel sentiment data. $ref: "#/definitions/SentimentSummary" example: segments: - - text: "I am happy with the product." - start_time: 0.0 - end_time: 5.0 - sentiment: "positive" - speaker: "John Doe" - channel: "Chat" + - text: I am happy with the product. + start_time: 0 + end_time: 5 + sentiment: positive + speaker: John Doe + channel: Chat confidence: 0.9 - - text: "I don't like the customer service." - start_time: 6.0 - end_time: 12.0 - sentiment: "negative" - speaker: "John Doe" - channel: "Chat" + - text: I don't like the customer service. + start_time: 6 + end_time: 12 + sentiment: negative + speaker: John Doe + channel: Chat confidence: 0.8 summary: overall: @@ -1600,12 +1997,12 @@ definitions: negative_count: 1 neutral_count: 0 speakers: - - speaker: "John Doe" + - speaker: John Doe positive_count: 1 negative_count: 1 neutral_count: 0 channels: - - channel: "Chat" + - channel: Chat positive_count: 1 negative_count: 1 neutral_count: 0 @@ -1613,96 +2010,122 @@ definitions: type: object description: Represents a segment of text and its associated sentiment. properties: - text: { type: string } - start_time: { type: number, format: float } - end_time: { type: number, format: float } - sentiment: { type: string } - speaker: { type: string } - channel: { type: string } - confidence: { type: number, format: float } + text: + type: string + start_time: + type: number + format: float + end_time: + type: number + format: float + sentiment: + type: string + speaker: + type: string + channel: + type: string + confidence: + type: number + format: float SentimentSummary: type: object - description: Holds overall sentiment information, as well as detailed per-speaker and per-channel sentiment data. + description: Holds overall sentiment information, as well as detailed + per-speaker and per-channel sentiment data. properties: overall: description: Summary of overall sentiment data. $ref: "#/definitions/SentimentSummaryDetail" speakers: type: array - description: An array of objects that represent sentiment data for a specific speaker. + description: An array of objects that represent sentiment data for a specific + speaker. items: $ref: "#/definitions/SentimentSpeakerSummary" channels: type: array - description: An array of objects that represent sentiment data for a specific channel. + description: An array of objects that represent sentiment data for a specific + channel. items: $ref: "#/definitions/SentimentChannelSummary" SentimentSummaryDetail: type: object - description: Holds the count of sentiment information grouped by positive, neutral and negative. + description: Holds the count of sentiment information grouped by positive, + neutral and negative. properties: - positive_count: { type: integer } - negative_count: { type: integer } - neutral_count: { type: integer } + positive_count: + type: integer + negative_count: + type: integer + neutral_count: + type: integer SentimentSpeakerSummary: type: object description: Holds sentiment information for a specific speaker. properties: - speaker: { type: string } - positive_count: { type: integer } - negative_count: { type: integer } - neutral_count: { type: integer } + speaker: + type: string + positive_count: + type: integer + negative_count: + type: integer + neutral_count: + type: integer SentimentChannelSummary: type: object description: Holds sentiment information for a specific channel. properties: - channel: { type: string } - positive_count: { type: integer } - negative_count: { type: integer } - neutral_count: { type: integer } + channel: + type: string + positive_count: + type: integer + negative_count: + type: integer + neutral_count: + type: integer TopicDetectionResult: description: Main object that holds topic detection results. type: object properties: - topics: - type: object - description: Holds the detailed topic detection results. - properties: - segments: - type: array - description: An array of objects that represent a segment of text and its associated topic information. - items: - description: An object that holds topic information for a single segment. - $ref: "#/definitions/TopicDetectionSegment" - summary: - description: An object that holds overall information on the topics detected. - $ref: "#/definitions/TopicDetectionSummary" + segments: + type: array + description: An array of objects that represent a segment of text and its + associated topic information. + items: + description: An object that holds topic information for a single segment. + $ref: "#/definitions/TopicDetectionSegment" + summary: + description: An object that holds overall information on the topics detected. + $ref: "#/definitions/TopicDetectionSummary" example: - topics: - segments: - - text: "I am happy with the product." - start_time: 0.0 - end_time: 5.0 - topics: - - topic: "product" - - text: "We will deploy this container for Spanish." - start_time: 6.0 - end_time: 12.0 - topics: - - topic: "deployment" - - topic: "languages" - summary: - overall: - deployment: 1 - languages: 1 - product: 1 + segments: + - text: I am happy with the product. + start_time: 0 + end_time: 5 + topics: + - topic: product + - text: We will deploy this container for Spanish. + start_time: 6 + end_time: 12 + topics: + - topic: deployment + - topic: languages + summary: + overall: + deployment: 1 + languages: 1 + product: 1 TopicDetectionSegment: type: object description: Represents a segment of text and its associated topic information. properties: - text: { type: string } - start_time: { type: number, format: float } - end_time: { type: number, format: float } + text: + type: string + start_time: + type: number + format: float + end_time: + type: number + format: float topics: type: array items: @@ -1711,7 +2134,8 @@ definitions: type: object description: Represents a topic and its associated information. properties: - topic: { type: string } + topic: + type: string TopicDetectionSummary: type: object description: Holds overall information on the topics detected. @@ -1732,12 +2156,12 @@ definitions: example: - title: Part 1 summary: Summary of part 1 - start_time: 0.0 - end_time: 5.0 + start_time: 0 + end_time: 5 - title: Part 2 summary: Summary of part 2 - start_time: 5.0 - end_time: 10.0 + start_time: 5 + end_time: 10 Chapter: type: object properties: @@ -1764,6 +2188,57 @@ definitions: type: string channel: type: string + LanguageIdentificationResult: + type: object + properties: + results: + type: array + items: + $ref: "#/definitions/LanguageIdentificationResultItem" + error: + type: string + enum: + - LOW_CONFIDENCE + - UNEXPECTED_LANGUAGE + - NO_SPEECH + - FILE_UNREADABLE + - OTHER + message: + type: string + example: + results: + - alternatives: + - language: en + confidence: 0.98 + - language: fr + confidence: 0.02 + start_time: 0 + end_time: 5.5 + - alternatives: + - language: en + confidence: 0.95 + - language: fr + confidence: 0.05 + start_time: 5.6 + end_time: 10 + LanguageIdentificationResultItem: + type: object + properties: + alternatives: + type: array + items: + $ref: "#/definitions/LanguageIdentificationResultAlternative" + start_time: + type: number + end_time: + type: number + LanguageIdentificationResultAlternative: + type: object + properties: + language: + type: string + confidence: + type: number JobDetailError: type: object required: @@ -1772,10 +2247,10 @@ definitions: properties: timestamp: type: string - example: "2021-07-14T11:53:49.242Z" + example: 2021-07-14T11:53:49.242Z message: type: string - example: "Audio fetch error, http status 418" + example: Audio fetch error, http status 418 OperatingPoint: type: string enum: @@ -1796,11 +2271,11 @@ definitions: since: type: string format: date-time - example: "2021-10-14T00:55:00Z" + example: 2021-10-14T00:55:00Z until: type: string format: date-time - example: "2022-12-01T00:00:00Z" + example: 2022-12-01T00:00:00Z summary: type: array items: @@ -1823,7 +2298,7 @@ definitions: $ref: "#/definitions/JobType" language: type: string - example: "en" + example: en operating_point: $ref: "#/definitions/OperatingPoint" count: @@ -1833,3 +2308,139 @@ definitions: type: number format: float description: Total duration of billable jobs (in hours) this cycle +tags: + - name: jobs + x-displayName: Jobs + - name: ErrorResponse + description: | + + x-displayName: ErrorResponse + - name: TrackingData + description: | + + x-displayName: TrackingData + - name: DataFetchConfig + description: | + + x-displayName: DataFetchConfig + - name: AlignmentConfig + description: | + + x-displayName: AlignmentConfig + - name: TranscriptionConfig + description: | + + x-displayName: TranscriptionConfig + - name: NotificationConfig + description: | + + x-displayName: NotificationConfig + - name: OutputConfig + description: | + + x-displayName: OutputConfig + - name: JobType + description: | + + x-displayName: JobType + - name: JobInfo + description: | + + x-displayName: JobInfo + - name: JobConfig + description: > + This model should be used when you create a new job. It will also be + returned as a part of response in a number of requests. This includes when + you get job details or get the transcript for a transcription job. + + + Based on the value of `type`, a type-specific object such as `transcription_config` is required to be present to specify all configuration settings or parameters needed to process the job inputs as expected. + + + If the results of the job are to be forwarded on completion, `notification_config` can be provided with a list of callbacks to be made; no assumptions should be made about the order in + + which they will occur. For more details, please refer to [Notifications](https://docs.speechmatics.com/features-other/notifications) in the documentation. + + + Customer specific job details or metadata can be supplied in `tracking`, and this information will be available where possible in the job results and in callbacks. + + + + x-displayName: Job Config + - name: CreateJobResponse + description: | + + x-displayName: CreateJobResponse + - name: JobDetails + description: > + Returned when you get job details, list all jobs or delete a job. This + model includes the status and config that was used. + + + + x-displayName: Job Details + - name: RetrieveJobsResponse + description: | + + x-displayName: RetrieveJobsResponse + - name: RetrieveJobResponse + description: | + + x-displayName: RetrieveJobResponse + - name: DeleteJobResponse + description: | + + x-displayName: DeleteJobResponse + - name: RecognitionMetadata + description: | + + x-displayName: RecognitionMetadata + - name: RecognitionDisplay + description: | + + x-displayName: RecognitionDisplay + - name: RecognitionAlternative + description: > + + x-displayName: RecognitionAlternative + - name: RecognitionResult + description: | + + x-displayName: RecognitionResult + - name: RetrieveTranscriptResponse + description: > + Returned when you get the transcript for a transcription job. It includes + metadata about the job, such as the transcription config that was used. + + + x-displayName: Transcript + - name: JobDetailError + description: | + + x-displayName: JobDetailError + - name: OperatingPoint + description: | + + x-displayName: OperatingPoint + - name: JobMode + description: | + + x-displayName: JobMode + - name: UsageResponse + description: | + + x-displayName: UsageResponse + - name: UsageDetails + description: | + + x-displayName: UsageDetails +x-tagGroups: + - name: Requests + tags: + - jobs + - name: Models + tags: + - JobConfig + - JobDetails + - RetrieveTranscriptResponse diff --git a/scripts/generate-models/generate-models.sh b/scripts/generate-models/generate-models.sh index ed3422d..4a93722 100755 --- a/scripts/generate-models/generate-models.sh +++ b/scripts/generate-models/generate-models.sh @@ -1,37 +1,21 @@ -#!/bin/bash +#!/bin/bash -e -OUTPUT_MODELS_DIRECTORY='../../src/types/models' +# Ensures we find the files regardless of where invoked +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -pip3 install -r requirements.txt +OUTPUT_MODELS_DIRECTORY="${SCRIPT_DIR}/../../src/types/models" + +pip3 install -r "${SCRIPT_DIR}/requirements.txt" # Get a 'fake' openapi spec from the async realtime-api spec (we just need the schemas) -python3 transform_async_to_openapi.py +python3 ${SCRIPT_DIR}/transform_async_to_openapi.py -# Generate models from the generated openapi spec using the openapi-generator tool -openapi-generator generate -i openapi-transformed.yaml -g typescript-axios -o ./openapi_models_tmp -c ../../autogen.json +# # Generate models from the generated openapi spec using the openapi-generator tool +openapi-generator generate -i ${SCRIPT_DIR}/openapi-transformed.yaml -g typescript-axios -o ${SCRIPT_DIR}/openapi_models_tmp -c ${SCRIPT_DIR}/../../autogen.json mkdir -p ${OUTPUT_MODELS_DIRECTORY} -rm -r ${OUTPUT_MODELS_DIRECTORY}/* -# rm ${OUTPUT_MODELS_DIRECTORY}/../runtime.ts -mv ./openapi_models_tmp/models/* ${OUTPUT_MODELS_DIRECTORY} -# mv ./openapi_models_tmp/runtime.ts ${OUTPUT_MODELS_DIRECTORY}/../ - -# Models import these couple of functions from the autogenerated file runtime.ts -# We don't need anything else from the autogenerated runtime.ts file so -# we just create the file with the functions needed -# cat > ${OUTPUT_MODELS_DIRECTORY}/../runtime.ts <<'EOF' -# export function exists(json: any, key: string) { -# const value = json[key]; -# return value !== null && value !== undefined; -# } - -# export function mapValues(data: any, fn: (item: any) => any) { -# return Object.keys(data).reduce( -# (acc, key) => ({ ...acc, [key]: fn(data[key]) }), -# {} -# ); -# } -# EOF +rm -r ${OUTPUT_MODELS_DIRECTORY}/* +mv ${SCRIPT_DIR}/openapi_models_tmp/models/* ${OUTPUT_MODELS_DIRECTORY} -# Delete temp files -rm openapi-transformed.yaml -rm -rf openapi_models_tmp +# # Delete temp files +rm ${SCRIPT_DIR}/openapi-transformed.yaml +rm -rf ${SCRIPT_DIR}/openapi_models_tmp diff --git a/scripts/generate-models/transform_async_to_openapi.py b/scripts/generate-models/transform_async_to_openapi.py index 376454e..6d9cc19 100644 --- a/scripts/generate-models/transform_async_to_openapi.py +++ b/scripts/generate-models/transform_async_to_openapi.py @@ -1,6 +1,8 @@ -import sys import yaml import re +import os + +dir_path = os.path.dirname(os.path.realpath(__file__)) # Add RT prefix to some names to dedupe from batch map_names = [ @@ -16,7 +18,7 @@ ] # Open the async spec -with open("../../schemas/realtime.yml", 'r') as stream: +with open(f"{dir_path}/../../schemas/realtime.yml", 'r') as stream: try: spec = stream.read() for item in map_names: @@ -27,7 +29,7 @@ print(exc) # Open a basic openapi template as starting document -with open("../../schemas/batch.yml", 'r') as stream: +with open(f"{dir_path}/../../schemas/batch.yml", 'r') as stream: try: spec = stream.read() for item in map_names: @@ -38,7 +40,7 @@ print(exc) # Open a basic openapi template as starting document -with open("template-openapi.yaml", 'r') as stream: +with open(f"{dir_path}/template-openapi.yaml", 'r') as stream: try: template = yaml.safe_load(stream) except yaml.YAMLError as exc: @@ -72,5 +74,5 @@ template['components']['schemas'].update(batch_spec['definitions']) # Save the generated openapi spec -with open('openapi-transformed.yaml', 'w') as outfile: +with open(f"{dir_path}/openapi-transformed.yaml", 'w') as outfile: yaml.dump(template, outfile) diff --git a/scripts/refresh-batch-spec.sh b/scripts/refresh-batch-spec.sh new file mode 100755 index 0000000..05348e2 --- /dev/null +++ b/scripts/refresh-batch-spec.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +PROJECT_ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/.. + +OUT_FILE=$PROJECT_ROOT/schemas/batch.yml + +if ! (wget -qO- https://docs.speechmatics.com/api/jobs-spec-final.yaml > $OUT_FILE); then + echo "Error fetching batch spec" + exit 1 +fi diff --git a/src/types/models/audio-event-item.ts b/src/types/models/audio-event-item.ts new file mode 100644 index 0000000..19e3cb0 --- /dev/null +++ b/src/types/models/audio-event-item.ts @@ -0,0 +1,51 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * + * @export + * @interface AudioEventItem + */ +export interface AudioEventItem { + /** + * Input channel this event occurred on + * @type {string} + * @memberof AudioEventItem + */ + channel?: string; + /** + * Prediction confidence associated with this event + * @type {number} + * @memberof AudioEventItem + */ + confidence?: number; + /** + * Time (in seconds) at which the audio event ends + * @type {number} + * @memberof AudioEventItem + */ + end_time?: number; + /** + * Time (in seconds) at which the audio event starts + * @type {number} + * @memberof AudioEventItem + */ + start_time?: number; + /** + * Kind of audio event. E.g. music + * @type {string} + * @memberof AudioEventItem + */ + type?: string; +} diff --git a/src/types/models/audio-event-summary-item.ts b/src/types/models/audio-event-summary-item.ts new file mode 100644 index 0000000..fc2992f --- /dev/null +++ b/src/types/models/audio-event-summary-item.ts @@ -0,0 +1,33 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Summary statistics for this audio event type + * @export + * @interface AudioEventSummaryItem + */ +export interface AudioEventSummaryItem { + /** + * Number of events of this type + * @type {number} + * @memberof AudioEventSummaryItem + */ + count?: number; + /** + * Total duration (in seconds) of all audio events of this type + * @type {number} + * @memberof AudioEventSummaryItem + */ + total_duration?: number; +} diff --git a/src/types/models/audio-events-config.ts b/src/types/models/audio-events-config.ts new file mode 100644 index 0000000..187bf62 --- /dev/null +++ b/src/types/models/audio-events-config.ts @@ -0,0 +1,27 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * + * @export + * @interface AudioEventsConfig + */ +export interface AudioEventsConfig { + /** + * + * @type {Array} + * @memberof AudioEventsConfig + */ + types?: Array; +} diff --git a/src/types/models/batch-recognition-result.ts b/src/types/models/batch-recognition-result.ts index ff45059..f7cfbbd 100644 --- a/src/types/models/batch-recognition-result.ts +++ b/src/types/models/batch-recognition-result.ts @@ -15,6 +15,12 @@ // May contain unused imports in some cases // @ts-ignore import { BatchRecognitionAlternative } from './batch-recognition-alternative'; +// May contain unused imports in some cases +// @ts-ignore +import { SpokenFormRecognitionResult } from './spoken-form-recognition-result'; +// May contain unused imports in some cases +// @ts-ignore +import { WrittenFormRecognitionResult } from './written-form-recognition-result'; /** * An ASR job output item. The primary item types are `word` and `punctuation`. Other item types may be present, for example to provide semantic information of different forms. @@ -46,6 +52,12 @@ export interface BatchRecognitionResult { * @memberof BatchRecognitionResult */ is_eos?: boolean; + /** + * + * @type {SpokenFormRecognitionResult} + * @memberof BatchRecognitionResult + */ + spoken_form?: SpokenFormRecognitionResult; /** * * @type {number} @@ -58,12 +70,25 @@ export interface BatchRecognitionResult { * @memberof BatchRecognitionResult */ type: BatchRecognitionResultTypeEnum; + /** + * An indication of the volume of audio across the time period the word was spoken. + * @type {number} + * @memberof BatchRecognitionResult + */ + volume?: number; + /** + * + * @type {WrittenFormRecognitionResult} + * @memberof BatchRecognitionResult + */ + written_form?: WrittenFormRecognitionResult; } export const BatchRecognitionResultTypeEnum = { Word: 'word', Punctuation: 'punctuation', SpeakerChange: 'speaker_change', + Entity: 'entity', } as const; export type BatchRecognitionResultTypeEnum = diff --git a/src/types/models/batch-transcription-config.ts b/src/types/models/batch-transcription-config.ts index cdcf44f..125ff0a 100644 --- a/src/types/models/batch-transcription-config.ts +++ b/src/types/models/batch-transcription-config.ts @@ -44,7 +44,7 @@ export interface BatchTranscriptionConfig { */ channel_diarization_labels?: Array; /** - * Specify whether speaker or channel labels are added to the transcript. The default is `none`. - **none**: no speaker or channel labels are added. - **speaker**: speaker attribution is performed based on acoustic matching; all input channels are mixed into a single stream for processing. - **channel**: multiple input channels are processed individually and collated into a single transcript. + * Specify whether speaker or channel labels are added to the transcript. The default is `none`. - **none**: no speaker or channel labels are added. - **speaker**: speaker attribution is performed based on acoustic matching; all input channels are mixed into a single stream for processing. - **channel**: multiple input channels are processed individually and collated into a single transcript. - **speaker_change**: the output indicates when the speaker in the audio changes. No speaker attribution is performed. This is a faster method than speaker. The reported speaker changes may not agree with speaker. - **channel_and_speaker_change**: both channel and speaker_change are switched on. The speaker change is indicated if more than one speaker are recorded in one channel. * @type {string} * @memberof BatchTranscriptionConfig */ @@ -91,6 +91,12 @@ export interface BatchTranscriptionConfig { * @memberof BatchTranscriptionConfig */ punctuation_overrides?: BatchTranscriptionConfigPunctuationOverrides; + /** + * Ranges between zero and one. Controls how responsive the system is for potential speaker changes. High value indicates high sensitivity. Defaults to 0.4. + * @type {number} + * @memberof BatchTranscriptionConfig + */ + speaker_change_sensitivity?: number; /** * * @type {BatchTranscriptionConfigSpeakerDiarizationConfig} @@ -103,6 +109,8 @@ export const BatchTranscriptionConfigDiarizationEnum = { None: 'none', Speaker: 'speaker', Channel: 'channel', + SpeakerChange: 'speaker_change', + ChannelAndSpeakerChange: 'channel_and_speaker_change', } as const; export type BatchTranscriptionConfigDiarizationEnum = diff --git a/src/types/models/error-response.ts b/src/types/models/error-response.ts index 750ecc9..22e6f53 100644 --- a/src/types/models/error-response.ts +++ b/src/types/models/error-response.ts @@ -44,7 +44,6 @@ export const ErrorResponseErrorEnum = { Forbidden: 'Forbidden', ResourceLocked: 'Resource Locked', FormatNotSupported: 'Format Not Supported', - InsufficientCredit: 'Insufficient Credit', InternalServerError: 'Internal Server Error', JobError: 'Job error', JobExpired: 'Job Expired', @@ -64,7 +63,6 @@ export const ErrorResponseErrorEnum = { PermissionDenied: 'Permission Denied', RequestedProductNotAvailable: 'Requested product not available', TranscriptionNotReady: 'Transcription not ready', - LatticeNotGenerated: 'Lattice not generated', LogFileNotAvailable: 'Log file not available', RequestedEarlyAccessReleaseNotAvailable: 'Requested Early Access Release not available', diff --git a/src/types/models/index.ts b/src/types/models/index.ts index e9c78d0..6721523 100644 --- a/src/types/models/index.ts +++ b/src/types/models/index.ts @@ -4,6 +4,9 @@ export * from './add-transcript'; export * from './add-translation'; export * from './alignment-config'; export * from './audio-added'; +export * from './audio-event-item'; +export * from './audio-event-summary-item'; +export * from './audio-events-config'; export * from './audio-format'; export * from './audio-format-file'; export * from './audio-format-raw'; @@ -32,6 +35,10 @@ export * from './job-info'; export * from './job-mode'; export * from './job-type'; export * from './language-identification-config'; +export * from './language-identification-result'; +export * from './language-identification-result-alternative'; +export * from './language-identification-result-item'; +export * from './language-pack-info'; export * from './max-delay-mode-config'; export * from './model-error'; export * from './notification-config'; @@ -52,6 +59,7 @@ export * from './recognition-started'; export * from './retrieve-job-response'; export * from './retrieve-jobs-response'; export * from './retrieve-transcript-response'; +export * from './retrieve-transcript-response-audio-event-summary'; export * from './sentiment-analysis-error'; export * from './sentiment-analysis-result'; export * from './sentiment-analysis-result-sentiment-analysis'; @@ -61,6 +69,7 @@ export * from './sentiment-speaker-summary'; export * from './sentiment-summary'; export * from './sentiment-summary-detail'; export * from './set-recognition-config'; +export * from './spoken-form-recognition-result'; export * from './start-recognition'; export * from './summarization-config'; export * from './summarization-error'; @@ -68,7 +77,6 @@ export * from './summarization-result'; export * from './topic-detection-config'; export * from './topic-detection-error'; export * from './topic-detection-result'; -export * from './topic-detection-result-topics'; export * from './topic-detection-segment'; export * from './topic-detection-segment-topic'; export * from './topic-detection-summary'; @@ -81,3 +89,4 @@ export * from './usage-response'; export * from './vocab-word'; export * from './vocab-word-one-of'; export * from './warning'; +export * from './written-form-recognition-result'; diff --git a/src/types/models/job-config.ts b/src/types/models/job-config.ts index b9e7396..2bb9c37 100644 --- a/src/types/models/job-config.ts +++ b/src/types/models/job-config.ts @@ -17,6 +17,9 @@ import { AlignmentConfig } from './alignment-config'; // May contain unused imports in some cases // @ts-ignore +import { AudioEventsConfig } from './audio-events-config'; +// May contain unused imports in some cases +// @ts-ignore import { BatchTranscriptionConfig } from './batch-transcription-config'; // May contain unused imports in some cases // @ts-ignore @@ -58,6 +61,12 @@ export interface JobConfig { * @memberof JobConfig */ alignment_config?: AlignmentConfig; + /** + * + * @type {AudioEventsConfig} + * @memberof JobConfig + */ + audio_events_config?: AudioEventsConfig; /** * * @type {object} diff --git a/src/types/models/language-identification-result-alternative.ts b/src/types/models/language-identification-result-alternative.ts new file mode 100644 index 0000000..3d376ff --- /dev/null +++ b/src/types/models/language-identification-result-alternative.ts @@ -0,0 +1,33 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * + * @export + * @interface LanguageIdentificationResultAlternative + */ +export interface LanguageIdentificationResultAlternative { + /** + * + * @type {number} + * @memberof LanguageIdentificationResultAlternative + */ + confidence?: number; + /** + * + * @type {string} + * @memberof LanguageIdentificationResultAlternative + */ + language?: string; +} diff --git a/src/types/models/language-identification-result-item.ts b/src/types/models/language-identification-result-item.ts new file mode 100644 index 0000000..8539efb --- /dev/null +++ b/src/types/models/language-identification-result-item.ts @@ -0,0 +1,43 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { LanguageIdentificationResultAlternative } from './language-identification-result-alternative'; + +/** + * + * @export + * @interface LanguageIdentificationResultItem + */ +export interface LanguageIdentificationResultItem { + /** + * + * @type {Array} + * @memberof LanguageIdentificationResultItem + */ + alternatives?: Array; + /** + * + * @type {number} + * @memberof LanguageIdentificationResultItem + */ + end_time?: number; + /** + * + * @type {number} + * @memberof LanguageIdentificationResultItem + */ + start_time?: number; +} diff --git a/src/types/models/language-identification-result.ts b/src/types/models/language-identification-result.ts new file mode 100644 index 0000000..249443b --- /dev/null +++ b/src/types/models/language-identification-result.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { LanguageIdentificationResultItem } from './language-identification-result-item'; + +/** + * + * @export + * @interface LanguageIdentificationResult + */ +export interface LanguageIdentificationResult { + /** + * + * @type {string} + * @memberof LanguageIdentificationResult + */ + error?: LanguageIdentificationResultErrorEnum; + /** + * + * @type {string} + * @memberof LanguageIdentificationResult + */ + message?: string; + /** + * + * @type {Array} + * @memberof LanguageIdentificationResult + */ + results?: Array; +} + +export const LanguageIdentificationResultErrorEnum = { + LowConfidence: 'LOW_CONFIDENCE', + UnexpectedLanguage: 'UNEXPECTED_LANGUAGE', + NoSpeech: 'NO_SPEECH', + FileUnreadable: 'FILE_UNREADABLE', + Other: 'OTHER', +} as const; + +export type LanguageIdentificationResultErrorEnum = + typeof LanguageIdentificationResultErrorEnum[keyof typeof LanguageIdentificationResultErrorEnum]; diff --git a/src/types/models/language-pack-info.ts b/src/types/models/language-pack-info.ts new file mode 100644 index 0000000..3608599 --- /dev/null +++ b/src/types/models/language-pack-info.ts @@ -0,0 +1,59 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Properties of the language pack. + * @export + * @interface LanguagePackInfo + */ +export interface LanguagePackInfo { + /** + * Whether or not language model adaptation has been applied to the language pack. + * @type {boolean} + * @memberof LanguagePackInfo + */ + adapted?: boolean; + /** + * Whether or not ITN (inverse text normalization) is available for the language pack. + * @type {boolean} + * @memberof LanguagePackInfo + */ + itn?: boolean; + /** + * Full descriptive name of the language, e.g. \'Japanese\'. + * @type {string} + * @memberof LanguagePackInfo + */ + language_description?: string; + /** + * The character to use to separate words. + * @type {string} + * @memberof LanguagePackInfo + */ + word_delimiter: string; + /** + * The direction that words in the language should be written and read in. + * @type {string} + * @memberof LanguagePackInfo + */ + writing_direction?: LanguagePackInfoWritingDirectionEnum; +} + +export const LanguagePackInfoWritingDirectionEnum = { + LeftToRight: 'left-to-right', + RightToLeft: 'right-to-left', +} as const; + +export type LanguagePackInfoWritingDirectionEnum = + typeof LanguagePackInfoWritingDirectionEnum[keyof typeof LanguagePackInfoWritingDirectionEnum]; diff --git a/src/types/models/notification-config.ts b/src/types/models/notification-config.ts index f6a51ca..e5b0a62 100644 --- a/src/types/models/notification-config.ts +++ b/src/types/models/notification-config.ts @@ -55,7 +55,6 @@ export const NotificationConfigContentsEnum = { AlignmentOnePerLine: 'alignment.one_per_line', Data: 'data', Text: 'text', - Lattice: 'lattice', } as const; export type NotificationConfigContentsEnum = diff --git a/src/types/models/retrieve-transcript-response-audio-event-summary.ts b/src/types/models/retrieve-transcript-response-audio-event-summary.ts new file mode 100644 index 0000000..1dca69a --- /dev/null +++ b/src/types/models/retrieve-transcript-response-audio-event-summary.ts @@ -0,0 +1,37 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { AudioEventSummaryItem } from './audio-event-summary-item'; + +/** + * Summary statistics per event type, keyed by `type`, e.g. music + * @export + * @interface RetrieveTranscriptResponseAudioEventSummary + */ +export interface RetrieveTranscriptResponseAudioEventSummary { + /** + * Summary keyed by channel, only set if channel diarization is enabled + * @type {{ [key: string]: { [key: string]: AudioEventSummaryItem; }; }} + * @memberof RetrieveTranscriptResponseAudioEventSummary + */ + channels?: { [key: string]: { [key: string]: AudioEventSummaryItem } }; + /** + * + * @type {{ [key: string]: AudioEventSummaryItem; }} + * @memberof RetrieveTranscriptResponseAudioEventSummary + */ + overall?: { [key: string]: AudioEventSummaryItem }; +} diff --git a/src/types/models/retrieve-transcript-response.ts b/src/types/models/retrieve-transcript-response.ts index 80e229e..c27d7f2 100644 --- a/src/types/models/retrieve-transcript-response.ts +++ b/src/types/models/retrieve-transcript-response.ts @@ -12,6 +12,9 @@ * Do not edit the class manually. */ +// May contain unused imports in some cases +// @ts-ignore +import { AudioEventItem } from './audio-event-item'; // May contain unused imports in some cases // @ts-ignore import { BatchRecognitionMetadata } from './batch-recognition-metadata'; @@ -26,6 +29,9 @@ import { Chapter } from './chapter'; import { JobInfo } from './job-info'; // May contain unused imports in some cases // @ts-ignore +import { RetrieveTranscriptResponseAudioEventSummary } from './retrieve-transcript-response-audio-event-summary'; +// May contain unused imports in some cases +// @ts-ignore import { SentimentAnalysisResult } from './sentiment-analysis-result'; // May contain unused imports in some cases // @ts-ignore @@ -43,6 +49,18 @@ import { TranslationSentence } from './translation-sentence'; * @interface RetrieveTranscriptResponse */ export interface RetrieveTranscriptResponse { + /** + * + * @type {RetrieveTranscriptResponseAudioEventSummary} + * @memberof RetrieveTranscriptResponse + */ + audio_event_summary?: RetrieveTranscriptResponseAudioEventSummary; + /** + * Timestamped audio events, only set if `audio_events_config` is in the config + * @type {Array} + * @memberof RetrieveTranscriptResponse + */ + audio_events?: Array; /** * An array of objects that represent summarized chapters of the transcript * @type {Array} diff --git a/src/types/models/spoken-form-recognition-result.ts b/src/types/models/spoken-form-recognition-result.ts new file mode 100644 index 0000000..3f4c81d --- /dev/null +++ b/src/types/models/spoken-form-recognition-result.ts @@ -0,0 +1,57 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { BatchRecognitionAlternative } from './batch-recognition-alternative'; + +/** + * A SpokenFormRecognitionResult describes a simple object which consists solely of \'word\' or \'punctuation\' type entries with a start and end time. It can occur only inside the spoken_form property of a full \"BatchRecognitionResult\" + * @export + * @interface SpokenFormRecognitionResult + */ +export interface SpokenFormRecognitionResult { + /** + * + * @type {Array} + * @memberof SpokenFormRecognitionResult + */ + alternatives: Array; + /** + * + * @type {number} + * @memberof SpokenFormRecognitionResult + */ + end_time: number; + /** + * + * @type {number} + * @memberof SpokenFormRecognitionResult + */ + start_time: number; + /** + * What kind of object this is. See #/Definitions/BatchRecognitionResult for definitions of the enums. + * @type {string} + * @memberof SpokenFormRecognitionResult + */ + type: SpokenFormRecognitionResultTypeEnum; +} + +export const SpokenFormRecognitionResultTypeEnum = { + Word: 'word', + Punctuation: 'punctuation', +} as const; + +export type SpokenFormRecognitionResultTypeEnum = + typeof SpokenFormRecognitionResultTypeEnum[keyof typeof SpokenFormRecognitionResultTypeEnum]; diff --git a/src/types/models/topic-detection-result-topics.ts b/src/types/models/topic-detection-result-topics.ts deleted file mode 100644 index 3194229..0000000 --- a/src/types/models/topic-detection-result-topics.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * OpenAPI Template - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -// May contain unused imports in some cases -// @ts-ignore -import { TopicDetectionSegment } from './topic-detection-segment'; -// May contain unused imports in some cases -// @ts-ignore -import { TopicDetectionSummary } from './topic-detection-summary'; - -/** - * Holds the detailed topic detection results. - * @export - * @interface TopicDetectionResultTopics - */ -export interface TopicDetectionResultTopics { - /** - * An array of objects that represent a segment of text and its associated topic information. - * @type {Array} - * @memberof TopicDetectionResultTopics - */ - segments?: Array; - /** - * - * @type {TopicDetectionSummary} - * @memberof TopicDetectionResultTopics - */ - summary?: TopicDetectionSummary; -} diff --git a/src/types/models/topic-detection-result.ts b/src/types/models/topic-detection-result.ts index f462257..b6cef7b 100644 --- a/src/types/models/topic-detection-result.ts +++ b/src/types/models/topic-detection-result.ts @@ -14,7 +14,10 @@ // May contain unused imports in some cases // @ts-ignore -import { TopicDetectionResultTopics } from './topic-detection-result-topics'; +import { TopicDetectionSegment } from './topic-detection-segment'; +// May contain unused imports in some cases +// @ts-ignore +import { TopicDetectionSummary } from './topic-detection-summary'; /** * Main object that holds topic detection results. @@ -22,10 +25,16 @@ import { TopicDetectionResultTopics } from './topic-detection-result-topics'; * @interface TopicDetectionResult */ export interface TopicDetectionResult { + /** + * An array of objects that represent a segment of text and its associated topic information. + * @type {Array} + * @memberof TopicDetectionResult + */ + segments?: Array; /** * - * @type {TopicDetectionResultTopics} + * @type {TopicDetectionSummary} * @memberof TopicDetectionResult */ - topics?: TopicDetectionResultTopics; + summary?: TopicDetectionSummary; } diff --git a/src/types/models/written-form-recognition-result.ts b/src/types/models/written-form-recognition-result.ts new file mode 100644 index 0000000..4350607 --- /dev/null +++ b/src/types/models/written-form-recognition-result.ts @@ -0,0 +1,56 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Template + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { BatchRecognitionAlternative } from './batch-recognition-alternative'; + +/** + * A WrittenFormRecognitionResult describes a simple object which consists solely of \'word\' type entries with a start and end time. It can occur only inside the written_form property of a full BatchRecognitionResult\" + * @export + * @interface WrittenFormRecognitionResult + */ +export interface WrittenFormRecognitionResult { + /** + * + * @type {Array} + * @memberof WrittenFormRecognitionResult + */ + alternatives: Array; + /** + * + * @type {number} + * @memberof WrittenFormRecognitionResult + */ + end_time: number; + /** + * + * @type {number} + * @memberof WrittenFormRecognitionResult + */ + start_time: number; + /** + * What kind of object this is. See #/Definitions/BatchRecognitionResult for definitions of the enums. + * @type {string} + * @memberof WrittenFormRecognitionResult + */ + type: WrittenFormRecognitionResultTypeEnum; +} + +export const WrittenFormRecognitionResultTypeEnum = { + Word: 'word', +} as const; + +export type WrittenFormRecognitionResultTypeEnum = + typeof WrittenFormRecognitionResultTypeEnum[keyof typeof WrittenFormRecognitionResultTypeEnum];