Skip to main content

speechly.slu.v2.BatchAPI

Run Speechly Batch API operations on audio sources without actively waiting the results.

Methods

namerequestresponsedescription
ProcessAudioSourceProcessAudioSourceRequestProcessAudioSourceResponseCreate a new background Speechly Batch API operation for a one or more
audio sources. Audio sources must be URIs of a files, reachable from the
API The response includes an id that is used to match the operation to
the results. A reference identifier can also be set. Also a
batch_reference can be set to mark that multiple audio sources form a
logical batch. In that case, the response will include a batch_id.
QueryStatusQueryStatusRequestQueryStatusResponseQuery the status of given operations.
If the ProcessAudioSourceRequest did not define a destination or
completion_webhook as a destination, the results are returned in the
QueryStatusResponse.

Messages

BatchConfig

Describes the configuration options common for the input batch.

Fields

nametypedescription
model_idstringID of the language model to use when processing the audio.
Optional. If not provided, the model to use will be determined
from the login information or from language detection.
language_codesstringThe language(s) of the audio sent in the request as a BCP-47 language tag
(e.g. "en-US"). Defaults to the target application language(s).
Optional.
batch_referencestringReference id for a set of related operations. For example an identifier of
the source system.
Optional.
priorityint32Priority for the operation. Operations are processed in the order they are
created, but higher priority operations are processed before the lower
priority operations.
Optional, defaults to 0 (normal priority).
optionsOptionAdditional batch specific options.
Optional.

BatchOutput

Define the output formats for results. If all options are set as false, display is returned.

Fields

nametypedescription
displayboolreturn text formatted for display, ie. capitalized and punctuated.
Optional, defaults to false.
lexicalboolreturn lexical version of the transcript, ie. lower case and no
punctuation.
Optional, defaults to false.
tokenizedboolreturn the token level transcription and time stamps for tokens.
Optional, defaults to false.

BatchTasks

Describes the processing options for the audio. Note that not all options are available for all languages or on all Payment Plans. If all options are left to default values, transcribe is set as default.

Fields

nametypedescription
transcribeboolResults will include a transcription of the audio.
Optional, defaults to true.
translateboolThe processing should include translating the audio to English.
Optional, defaults to false.

HttpResource

Describes full properties of an HTTP endpoint.

Fields

nametypedescription
urlstringURL of the endpoint (protocol://server/path)
Required.
methodMethodmethod to use in connection.
Optional.
headersHeaderPossible additional headers to include in the connection.
Optional.

HttpResource.Header

A single header value in an HTTP request.

Fields

nametypedescription
namestringName of the header to set in request.
valuestringValue of the given header in request.

Operation

Describes a single batch operation.

Fields

nametypedescription
idstringThe id of the operation.
referencestringThe reference id of the operation, if given.
batch_idstringThe id of the batch the operation belongs to.
batch_referencestringThe reference id of the operation, if given.
statusStatusThe current status of the operation.
language_codestringThe language code of the detected language.
app_idstringThe application context for the operation.
resultOperationResultIf the operation status is STATUS_DONE and the destination is not set,
the results of the processing.
durationDurationThe duration of the audio.
error_codeErrorCodeMachine-readable status for the operation.
Only set if operation status is STATUS_ERROR.
error_descriptionstringContains a human readable description of the error.
Only set if operation status is STATUS_ERROR.
source_urlstringThe locator to the source audio.
destination_urlstringThe locator to the result target.

OperationResult

Describes the results of the processing that took place.

Fields

nametypedescription
typeResultTypeThe type of this result.
textstringThe textual representation of the results.
tokensTokenThe tokenized representation of the result. Only available if requested in
the ProcessingConfiguration.

Option

Generic option to change the default behaviour of the SLU. Available options are different per project context.

Fields

nametypedescription
keystringThe key of the option to be set.
valuestringThe values to set the option to.

ProcessAudioSourceRequest

Describes a request to process audio from a pre-existing source.

Fields

nametypedescription
tasksBatchTaskstasks describe the requested operations for the given audio.
Optional, defaults to transcribe.
configBatchConfigThe options shared by all of the source audios.
Optional.
outputBatchOutputDefine the output formatting for text results.
Optional, defaults to display.
sourceProcessAudioSourceRequestItemThe source audios, and their unique options.

ProcessAudioSourceRequestItem

Describes the configuration options unique to a single audio source.

Fields

nametypedescription
source_urlstringThe locator to the source audio.
Required.
destination_urlstringThe locator to the result target. The payload will be Operation as JSON.
Optional.
completion_webhookHttpResourceHTTP endpoint to be notified on completion of the processing. The payload
will be Operation as JSON.
Optional.
referencestringReference id for the operation. For example an identifier of the source
system.
Optional.
device_idstringThe device ID of the audio source, for example a microphone identifier as
UUID.
Optional.

ProcessAudioSourceResponse

Describes a response to request to process audio from a pre-existing source.

Fields

nametypedescription
operationOperationThe details of the created operations.

QueryStatusRequest

Query the status of an operation. At least one of these must be given.

Fields

nametypedescription
operation_idsstringID of an audio processing operation.
operation_referencesstringReference ID of an operation.
Optional.
batch_idstringID of an audio processing batch.
Optional.
batch_referencestringReference ID of a batch.
Optional.

QueryStatusResponse

Describes the statuses of the queried operations.

Fields

nametypedescription
operationOperationThe details of the audio processing operation.

Token

Describes a single meaningful unit of speech. In languages that use spaces to separate words, closely maps to those words.

Fields

nametypedescription
tokenstringThe token described.
indexint32The position of the token in the whole phrase, zero-based.
start_timeint32The end time of the token in the audio, in milliseconds from the beginning
of the audio.
end_timeint32The end time of the token in the audio, in milliseconds from the beginning
of the audio.

Enums

HttpResource.Method

The HTTP method to use when accessing an HTTP resource.

Values

namevaluedescription
METHOD_UNSPECIFIED0Method is not given, and default method is used for requests.
Data fetches use GET, and result sending POST.
METHOD_GET1Use HTTP GET.
METHOD_POST2Use HTTP POST.
METHOD_PUT3Use HTTP PUT.

Operation.ErrorCode

Contains a machine readable error type if the operation status is STATUS_ERROR.

Values

namevaluedescription
ERROR_UNSPECIFIED0No error is set.
ERROR_UNSUPPORTED_LANGUAGE1The input was in a language that was not supported in this context.
ERROR_INTERNAL2An internal error occurred.
ERROR_INVALID_PARAMETERS3Given parameters cannot be used to process the given input.
ERROR_INVALID_SOURCE4The source could not be read or understood.
ERROR_INVALID_DESTINATION5The results could not be written to the destination.
ERROR_INVALID_AUDIO6The provided audio was not in a supported format.

Operation.Status

The status of the operation.

Values

namevaluedescription
STATUS_UNSPECIFIED0Default status is empty.
STATUS_PENDING1The operation is queued for processing.
STATUS_DONE2The operation is complete and transcript is available.
STATUS_ERROR3The processing failed. Error reason is available.

OperationResult.ResultType

The possible types for the operation result.

Values

namevaluedescription
RESULT_TYPE_UNSPECIFIED0Result type is not set.
RESULT_TYPE_TRANSCRIPT_LEXICAL1The actual words of the audio with no additional processing applied.
RESULT_TYPE_TRANSCRIPT_DISPLAY2The content of the audio formatted to be displayed on screen, with eg.
punctuation and capitalization included.
RESULT_TYPE_TRANSLATION3The content of the audio translated to English.