Skip to content

[bot] Spring AI OpenAI auto-instrumentation only covers chat — Image/Audio (speech & transcription) models are not instrumented #151

Description

@braintrust-bot

<!-- provider-gap-audit: springai-openai-image-audio-not-instrumented -->

Summary

SpringAIOpenAIInstrumentationModule only installs a ByteBuddy hook on org.springframework.ai.openai.OpenAiChatModel$Builder.build(). Spring AI's spring-ai-openai artifact also ships stable, documented execution-model classes for image generation (OpenAiImageModel) and audio (OpenAiAudioTranscriptionModel, OpenAiAudioSpeechModel) — none of these are targeted by any TypeInstrumentation, so calls made through them produce no spans at all (not even generic/untagged ones, since the interception point itself never fires).

This is distinct from the already-filed embedding gap ("Spring AI instrumentation limited to OpenAI and Anthropic chat models; no embedding model support"), which covers OpenAiEmbeddingModel. It's also distinct from the direct-OpenAI-SDK gaps ("OpenAI Images API spans missing input/output capture", "OpenAI audio transcription and speech spans missing braintrust.output_json"), which are about com.openai:openai-java's own client.images()/client.audio(), not the Spring AI wrapper.

What is missing

braintrust-sdk/instrumentation/springai_1_0_0/src/main/java/dev/braintrust/instrumentation/springai/v1_0_0/auto/SpringAIOpenAIInstrumentationModule.java:

@Override
public List<TypeInstrumentation> typeInstrumentations() {
    return List.of(new OpenAiChatModelBuilderInstrumentation());
}

Only OpenAiChatModelBuilderInstrumentation (matching org.springframework.ai.openai.OpenAiChatModel$Builder) is registered. There is no equivalent TypeInstrumentation for:

  • org.springframework.ai.openai.OpenAiImageModel — image generation execution API (ImageModel.call())
  • org.springframework.ai.openai.OpenAiAudioTranscriptionModel — speech-to-text execution API
  • org.springframework.ai.openai.OpenAiAudioSpeechModel — text-to-speech execution API

All three are constructed independently of OpenAiChatModel and make their own HTTP calls through Spring AI's OpenAiAudioApi/OpenAiImageApi, which are not wrapped by BraintrustRestInterceptor/BraintrustWebClientFilter the way OpenAiApi (used by chat) is. Manual wrapping via BraintrustSpringAI also has no entry point for these model types — grep for ImageModel, AudioTranscriptionModel, AudioSpeechModel in braintrust-sdk/instrumentation/springai_1_0_0/ returns zero matches.

Braintrust docs status

not_found — the Braintrust docs for Spring AI / Java integrations do not mention image or audio model coverage; only chat completion examples are shown.

Upstream sources

Local files inspected

  • braintrust-sdk/instrumentation/springai_1_0_0/src/main/java/dev/braintrust/instrumentation/springai/v1_0_0/auto/SpringAIOpenAIInstrumentationModule.java — lines 39–58 (only chat model builder instrumentation registered)
  • braintrust-sdk/instrumentation/springai_1_0_0/src/main/java/dev/braintrust/instrumentation/springai/v1_0_0/BraintrustSpringAI.java — no image/audio model wrap entry point
  • braintrust-sdk/instrumentation/springai_1_0_0/src/test/java/dev/braintrust/instrumentation/springai/v1_0_0/BraintrustSpringAITest.java — only chat model tests (OpenAI + Anthropic, call/stream)
  • Full-module grep for ImageModel, AudioTranscriptionModel, AudioSpeechModel — zero matches

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