You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit de20f64
Browse filesBrowse the repository at this point in the historyBrowse files
"[](https://colab.research.google.com/github/openlayer-ai/openlayer-python/blob/main/examples/tracing/azure-speech/azure_speech_tracing.ipynb)\n",
8
+
"\n",
9
+
"\n",
10
+
"# <a id=\"top\">Azure AI Speech tracing quickstart</a>\n",
11
+
"\n",
12
+
"This notebook illustrates how to monitor Azure AI Speech (speech-to-text, speech translation and text-to-speech) with Openlayer.\n",
13
+
"\n",
14
+
"The Speech SDK and the Openlayer tracer both run in your backend: the Azure key stays in your server-side configuration and is never sent to Openlayer. Only non-secret settings (region, language, voice, custom endpoint ID, output format), the recognized text or synthesized-audio stats, latency and failure details are traced. Do not ship either the Azure key or the Openlayer API key in browser or mobile code."
"## 2. Initialize Openlayer and create the Speech clients\n",
55
+
"\n",
56
+
"`init()` auto-instruments every `SpeechRecognizer`, `TranslationRecognizer` and `SpeechSynthesizer` created afterwards. You can also trace a single client explicitly with `trace_azure_speech(client)`.\n",
57
+
"\n",
58
+
"Audio is **not** sent to Openlayer by default. Set `attachment_upload_enabled=True` only if your security and privacy requirements allow storing audio in Openlayer; synthesized audio and any input audio you pass as `openlayer_audio` are then uploaded alongside the trace."
59
+
]
60
+
},
61
+
{
62
+
"cell_type": "code",
63
+
"execution_count": null,
64
+
"metadata": {},
65
+
"outputs": [],
66
+
"source": [
67
+
"import azure.cognitiveservices.speech as speechsdk\n",
68
+
"\n",
69
+
"from openlayer.lib import init\n",
70
+
"\n",
71
+
"init(\n",
72
+
" attachment_upload_enabled=False, # set to True to upload audio to Openlayer\n",
"result = synthesizer.speak_text(\"Hello! Thanks for calling. How can I help you today?\")\n",
104
+
"result.reason"
105
+
]
106
+
},
107
+
{
108
+
"cell_type": "markdown",
109
+
"metadata": {},
110
+
"source": [
111
+
"### Speech-to-text\n",
112
+
"\n",
113
+
"The Speech SDK does not expose the audio behind an `AudioConfig`, so pass the same file as `openlayer_audio` if you want it attached to the trace (only used when attachment uploads are enabled)."
114
+
]
115
+
},
116
+
{
117
+
"cell_type": "code",
118
+
"execution_count": null,
119
+
"metadata": {},
120
+
"outputs": [],
121
+
"source": [
122
+
"recognizer = speechsdk.SpeechRecognizer( # auto-traced by Openlayer\n",
0 commit comments