Skip to content

[bot] Instrument aws-sdk-polly (3,227 weekly downloads) #93

Description

@braintrust-bot

Summary

The Braintrust Rust SDK has no instrumentation for aws-sdk-polly, AWS's official Rust SDK crate for Amazon Polly, AWS's text-to-speech (speech synthesis) generative-audio service. Braintrust's own OpenAI integration already documents tracing OpenAI's Speech (text-to-speech) API as a first-class audio-generation capability, but no Braintrust SDK instruments Polly, the AWS equivalent hosted service.

What is missing

aws_sdk_polly::Client exposes these execution-oriented operations (per https://docs.rs/aws-sdk-polly/latest/aws_sdk_polly/client/struct.Client.html):

  • synthesize_speech — the core generation call: converts input text or SSML into a synthesized audio stream using a specified voice/engine/output format. Direct analog of OpenAI's audio.speech.create.
  • start_speech_synthesis_task — asynchronous speech generation for long-form text, writing output audio to S3.
  • start_speech_synthesis_stream — bidirectional streaming synthesis session (text/control events in, audio events out) for low-latency generative-audio use cases (e.g. voice agents).
  • get_speech_synthesis_task / list_speech_synthesis_tasks — status/result retrieval for async synthesis jobs.

None of this is wired into the SDK:

  1. No usage extraction pathextract_openai_usage()/extract_anthropic_usage() in src/extractors.rs parse a JSON usage object with token counts. Polly's SynthesizeSpeechOutput returns a raw audio Blob (e.g. MP3/PCM/OGG bytes) plus a request_characters header — no token-usage concept at all — so neither extractor applies, and there is no character-based usage/cost extractor for Polly's per-character billing model.
  2. No stream/span wrapperBraintrustStream/wrap_stream_with_span() (src/stream.rs) require an async Stream<Item = Result<Value, E>> deserializing OpenAI Chat-Completions-shaped JSON chunks. Polly's start_speech_synthesis_stream returns a bidirectional audio-event stream with no JSON/choices structure, structurally incompatible with the existing helper.
  3. No audio-generation span type — there is no equivalent of a "speech synthesis span" (input text, voice/engine parameters, output audio reference, character count) anywhere in src/types.rs.

Library significance

Weekly downloads

Weekly downloads: 3,227 (as of 2026-08-12; https://crates.io/api/v1/crates/aws-sdk-polly/downloads)

Methodology: exact sum of the crates.io downloads API's daily version_downloads entries (summed across all versions publishing downloads on a given day) plus meta.extra_downloads entries, for the complete 7-day window 2026-08-06 through 2026-08-12 inclusive (checked on 2026-08-17; more recent days were excluded due to crates.io's daily-aggregation lag). Per-day combined totals: 08-06: 502; 08-07: 506; 08-08: 328; 08-09: 173; 08-10: 382; 08-11: 579; 08-12: 757. Sum = 3,227. 90-day recent_downloads reported directly by crates.io: 51,327 (consistent with this weekly figure, ≈3.9K/week average).

Braintrust docs status

supported for the underlying capability class (text-to-speech), but not_found for Polly/AWS specifically. Checked https://www.braintrust.dev/docs/integrations/ai-providers/openai directly on 2026-08-17: the Python span-coverage table lists "Audio APIs (audio captured as an attachment)" as covering "Transcription, Translation, Speech" — confirming Braintrust already treats speech synthesis (OpenAI's audio.speech.create) as a traced, in-scope generative-audio capability. Neither Amazon Polly nor any AWS speech-synthesis service is mentioned on https://www.braintrust.dev/docs/integrations/ai-providers (AWS Bedrock is the only AWS entry listed) or https://www.braintrust.dev/docs/integrations/ai-providers/bedrock.

Relationship to existing issues

Upstream sources

Braintrust docs sources

Local repo files inspected

  • src/extractors.rsextract_openai_usage() and extract_anthropic_usage() both operate on token-usage JSON; no character-based usage extractor for Polly's Blob-typed audio response
  • src/stream.rsBraintrustStream::aggregate()/wrap_stream_with_span() require a Stream<Item = Result<Value, E>> deserializing OpenAI-shaped chunks; incompatible with Polly's bidirectional audio-event stream
  • src/types.rs — no speech-synthesis/audio-generation span fields (voice, engine, output format, character count)
  • src/lib.rs — public API exports; no Polly/AWS speech references
  • Cargo.toml — no aws-sdk-polly dependency
  • Full local codebase search for polly, synthesize_speech, SpeechSynthesis — zero results

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions