Skip to content

feat(cohere): trace audio transcription calls#333

Open
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit intomainfrom
abhi-feat-327-cohere-audio-transcription-tracing
Open

feat(cohere): trace audio transcription calls#333
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit intomainfrom
abhi-feat-327-cohere-audio-transcription-tracing

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

Instrument client.audio.transcriptions.create() (sync and async) on Cohere's v1 clients so Braintrust captures transcription requests added in cohere==6.1.0. Spans record the audio file as an Attachment, the transcribed text as output, provider/model/language/temperature as metadata, and standard timing metrics.

  • patchers target cohere.audio.transcriptions.client.{Async,}TranscriptionsClient.create via target_module, so the integration degrades gracefully on older Cohere SDKs that predate the audio surface.
  • wrap_cohere() walks client.audio.transcriptions to instance-patch the leaf create method for per-client tracing.
  • clean_cohere_methods test fixture now also clears wrapt-forwarded markers on the restored original function.

Covered by three VCR-backed tests (sync, async, setup) against the real v2/audio/transcriptions endpoint.

Fixes #327

Instrument `client.audio.transcriptions.create()` (sync and async) on
Cohere's v1 clients so Braintrust captures transcription requests added
in cohere==6.1.0. Spans record the audio file as an `Attachment`, the
transcribed text as output, provider/model/language/temperature as
metadata, and standard timing metrics.

- patchers target `cohere.audio.transcriptions.client.{Async,}TranscriptionsClient.create`
  via `target_module`, so the integration degrades gracefully on older
  Cohere SDKs that predate the audio surface.
- `wrap_cohere()` walks `client.audio.transcriptions` to instance-patch
  the leaf `create` method for per-client tracing.
- `clean_cohere_methods` test fixture now also clears wrapt-forwarded
  markers on the restored original function.

Covered by three VCR-backed tests (sync, async, setup) against the real
`v2/audio/transcriptions` endpoint.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bot] Cohere: Audio Transcription API (client.audio.transcriptions.create()) not instrumented

1 participant