All skills
microsoft avatar

/azure-ai-transcription-py

@e19efc2
by microsoftmicrosoft/skills3.1k stars
351

Azure AI Transcription SDK for Python. Use for real-time and batch speech-to-text transcription with timestamps and diarization. Triggers: "transcription", "speech to text", "Azure AI Transcription", "TranscriptionClient".

Use this Skill: https://skilld.dev/gh/microsoft/skills/azure-ai-transcription-py

This session only. Nothing lands on disk.

referencesnon-hero-scenarios.md

≈925 tokens on demand. Your agent reads this file only when SKILL.md points to it.

azure-ai-transcription-py non-hero scenarios

These scenarios are intentionally separate from hero flows in SKILL.md. They cover secondary/advanced patterns typically used after the primary end-to-end path is working.

Operational hardening

Retry Policy

Configure retries for transient failures via azure-core retry policy:

import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.transcription import TranscriptionClient
from azure.core.pipeline.policies import RetryPolicy

retry_policy = RetryPolicy(retry_total=3, retry_backoff_factor=2)

with TranscriptionClient(
    endpoint=os.environ["TRANSCRIPTION_ENDPOINT"],
    credential=AzureKeyCredential(os.environ["TRANSCRIPTION_KEY"]),
    retry_policy=retry_policy,
) as client:
    job = client.begin_transcription(
        name="meeting-transcription",
        locale="en-US",
        content_urls=["https://<storage>/audio.wav"],
    )
    result = job.result()

LRO Poll with Timeout

Avoid blocking indefinitely on long-running batch jobs:

import os
import time
from azure.core.credentials import AzureKeyCredential
from azure.ai.transcription import TranscriptionClient

with TranscriptionClient(
    endpoint=os.environ["TRANSCRIPTION_ENDPOINT"],
    credential=AzureKeyCredential(os.environ["TRANSCRIPTION_KEY"]),
) as client:
    job = client.begin_transcription(
        name="long-audio",
        locale="en-US",
        content_urls=["https://<storage>/long-audio.wav"],
    )
    # Poll with an explicit deadline; job.result() does not raise on timeout
    deadline = time.monotonic() + 300
    while not job.done():
        if time.monotonic() > deadline:
            raise TimeoutError("Transcription did not complete within 300 s")
        time.sleep(5)
    result = job.result()
    print(result.status)

List and Paginate Transcriptions

list_transcriptions() returns a lazy iterator; paginate explicitly to avoid loading everything at once:

import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.transcription import TranscriptionClient

with TranscriptionClient(
    endpoint=os.environ["TRANSCRIPTION_ENDPOINT"],
    credential=AzureKeyCredential(os.environ["TRANSCRIPTION_KEY"]),
) as client:
    for index, transcription in enumerate(client.list_transcriptions()):
        print(f"[{index}] {transcription.name}: {transcription.status}")

Delete Completed Transcriptions

Remove completed jobs to keep the account tidy:

import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.transcription import TranscriptionClient

with TranscriptionClient(
    endpoint=os.environ["TRANSCRIPTION_ENDPOINT"],
    credential=AzureKeyCredential(os.environ["TRANSCRIPTION_KEY"]),
) as client:
    for transcription in client.list_transcriptions():
        if transcription.status == "Succeeded":
            client.delete_transcription(transcription.transcription_id)

Async Batch Transcription

Use the async client for non-blocking workflows:

import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.transcription.aio import TranscriptionClient

async def run_async_transcription():
    async with TranscriptionClient(
        endpoint=os.environ["TRANSCRIPTION_ENDPOINT"],
        credential=AzureKeyCredential(os.environ["TRANSCRIPTION_KEY"]),
    ) as client:
        job = await client.begin_transcription(
            name="async-meeting",
            locale="en-US",
            content_urls=["https://<storage>/audio.wav"],
            diarization_enabled=True,
        )
        result = await job.result()
        print(result.status)

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides a Python SDK for Azure AI Transcription. It includes security considerations such as the ingestion of external audio data, while adhering to recommended practices for credential management and resource handling. The skill's functionality is consistent with its stated purpose as a Microsoft-authored tool for Azure services.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    2/2 files flagged

Signed by skilld at e19efc2. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
Other metadata
metadata
{
  "author": "Microsoft",
  "version": "1.0.0",
  "package": "azure-ai-transcription"
}

README badge

README badge for microsoft/skills/azure-ai-transcription-py