Summary
The ruby_llm gem provides RubyLLM.speak(input, ...) for text-to-speech synthesis using AI TTS models. This API is not instrumented by this SDK. The current RubyLLM integration only instruments RubyLLM::Chat — covering chat completions, tool execution, and streaming. speak is a distinct generative AI execution surface (it drives a TTS model to produce audio from text) and produces usage data (token counts via some providers), yet no span is created for it.
This is a direct parity gap with the OpenAI Audio integration gap (#146), which notes that TTS execution via client.audio.speech.create is also uninstrumented. Both use AI models to generate audio from text input.
What is missing
RubyLLM.speak(input, model:, voice:, ...) / RubyLLM::Speech.speak(input, ...) — invokes a TTS provider (OpenAI tts-1, tts-1-hd, or equivalent) and returns a RubyLLM::Speech object containing:
data — raw audio bytes
model — model ID used for synthesis
voice — voice selected
format — audio format (mp3, wav, flac, etc.)
What a span should capture
- Input: the text string passed to
speak
- Metadata: model, voice, format, provider
- Output: audio format and size (not the raw binary bytes)
- Metrics:
time_to_first_token (latency)
The implementation pattern already exists: RubyLLM::Embed, RubyLLM::Paint, and RubyLLM::Transcription are single-method execution surfaces (see issue #136). RubyLLM::Speech follows the same shape and would be instrumented with the same approach: a new SpeechPatcher wrapping the speak class method.
Braintrust docs status
not_found — The Braintrust RubyLLM integration docs at https://www.braintrust.dev/docs/integrations/sdk-integrations/ruby-llm document only chat completions, tool calls, token usage, and streaming. Speech synthesis is not mentioned.
Upstream sources
Local repo files inspected
lib/braintrust/contrib/ruby_llm/patcher.rb — defines only ChatPatcher; no SpeechPatcher
lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb — wraps Chat#complete and Chat#execute_tool only
lib/braintrust/contrib/ruby_llm/integration.rb — registers [ChatPatcher] only
Appraisals — tests ruby_llm at versions 1.8, 1.9, and latest; speech.rb is present in all supported versions
- Grep for
speak, Speech, tts, SpeechPatcher across lib/braintrust/ returns zero matches
Summary
The
ruby_llmgem providesRubyLLM.speak(input, ...)for text-to-speech synthesis using AI TTS models. This API is not instrumented by this SDK. The current RubyLLM integration only instrumentsRubyLLM::Chat— covering chat completions, tool execution, and streaming.speakis a distinct generative AI execution surface (it drives a TTS model to produce audio from text) and produces usage data (token counts via some providers), yet no span is created for it.This is a direct parity gap with the OpenAI Audio integration gap (#146), which notes that TTS execution via
client.audio.speech.createis also uninstrumented. Both use AI models to generate audio from text input.What is missing
RubyLLM.speak(input, model:, voice:, ...)/RubyLLM::Speech.speak(input, ...)— invokes a TTS provider (OpenAItts-1,tts-1-hd, or equivalent) and returns aRubyLLM::Speechobject containing:data— raw audio bytesmodel— model ID used for synthesisvoice— voice selectedformat— audio format (mp3, wav, flac, etc.)What a span should capture
speaktime_to_first_token(latency)The implementation pattern already exists:
RubyLLM::Embed,RubyLLM::Paint, andRubyLLM::Transcriptionare single-method execution surfaces (see issue #136).RubyLLM::Speechfollows the same shape and would be instrumented with the same approach: a newSpeechPatcherwrapping thespeakclass method.Braintrust docs status
not_found— The Braintrust RubyLLM integration docs at https://www.braintrust.dev/docs/integrations/sdk-integrations/ruby-llm document only chat completions, tool calls, token usage, and streaming. Speech synthesis is not mentioned.Upstream sources
Speechclass: https://github.com/crmne/ruby_llm/blob/main/lib/ruby_llm/speech.rbspeakmethod: https://github.com/crmne/ruby_llm/blob/main/lib/ruby_llm.rbLocal repo files inspected
lib/braintrust/contrib/ruby_llm/patcher.rb— defines onlyChatPatcher; noSpeechPatcherlib/braintrust/contrib/ruby_llm/instrumentation/chat.rb— wrapsChat#completeandChat#execute_toolonlylib/braintrust/contrib/ruby_llm/integration.rb— registers[ChatPatcher]onlyAppraisals— tests ruby_llm at versions 1.8, 1.9, and latest;speech.rbis present in all supported versionsspeak,Speech,tts,SpeechPatcheracrosslib/braintrust/returns zero matches