
Monitoring Azure AI Speech
To use monitoring mode, instrument your code to publish the Speech calls your AI system makes to the Openlayer platform.Installation
Install Openlayer and the Azure Speech SDK:Azure AI Speech tracing requires
openlayer>=0.34.0 in Python and
openlayer>=0.32.0 in TypeScript. In TypeScript, the Azure Speech SDK is an
optional peer dependency, so installing openlayer alone does not add it.Trace Speech calls
init() instruments every SpeechRecognizer, TranslationRecognizer, and
SpeechSynthesizer created afterwards. To trace a single client instead, pass it to
trace_azure_speech(client) from openlayer.lib. In TypeScript, wrap each client with
traceAzureSpeech().
If your resource uses a custom endpoint (for example, an Azure AI Services
*.cognitiveservices.azure.com domain), create the configuration with
SpeechConfig(subscription=..., endpoint=...) in Python or
SpeechConfig.fromEndpoint(new URL(endpoint), key) in TypeScript. Tracing works the same
way.
Trace a full voice turn
Wrap the function that handles a conversational turn so recognition and synthesis appear as steps of the same trace:See full Python example
See full TypeScript example
Attach audio to traces
Audio is not sent to Openlayer by default. When you enable attachment uploads, synthesized audio is attached to each synthesis step automatically. For recognition, pass the audio you are transcribing explicitly, because the Speech SDK’sAudioConfig does not
expose its source:
raw-* formats) is wrapped in a
WAV container so it can be played. Formats without a playable container, such as raw Opus
frames, are attached as files that you can download.
Data captured
Speech calls appear on the Data page of your Openlayer data source as steps named Azure Speech Recognition, Azure Speech Translation, or Azure Speech Synthesis, with theAzure_Speech provider.
Azure reports most failures as canceled results rather than errors, so failed calls are
traced too, with the cancellation reason, error code, and error details.
Your Azure subscription key and authorization token are never recorded. Openlayer reads
only an allowlist of non-secret settings, and it redacts credentials from error details:
the Speech SDK can include your endpoint URL, with any token in its query string, in
connection errors.
Speech steps report 0 tokens, so their cost shows as $0.
Supported calls
Continuous recognition, streaming synthesis requests, and batch transcription are not
traced.
Troubleshooting
No Speech steps appear in Openlayer
No Speech steps appear in Openlayer
In Python, call
init() before creating your Speech clients, or pass each
client to trace_azure_speech(). In TypeScript, wrap every recognizer and
synthesizer with traceAzureSpeech(). Also check that OPENLAYER_API_KEY
and OPENLAYER_INFERENCE_PIPELINE_ID are set.Recognition and synthesis show up as separate traces
Recognition and synthesis show up as separate traces
Wrap the function that makes both calls with
@trace() in Python or
trace() in TypeScript. In TypeScript, await each Speech call inside that
function so its step is recorded under the right parent.The trace has no audio player
The trace has no audio player
Enable attachment uploads (
attachment_upload_enabled=True in Python,
attachmentUploadEnabled: true in TypeScript) before the trace is created.
Recognition steps also need the audio passed explicitly, as
openlayer_audio in Python or inputAudio in TypeScript.The Azure Speech SDK cannot be resolved in TypeScript
The Azure Speech SDK cannot be resolved in TypeScript
Install
microsoft-cognitiveservices-speech-sdk. It is an optional peer
dependency, so installing openlayer alone does not add it to your
application.Canceled and NoMatch results appear in my traces
Canceled and NoMatch results appear in my traces
This is expected. Azure returns canceled and
NoMatch outcomes as results,
and Openlayer traces them so you can investigate the reason and latency.