Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

feat(audio): add tracking for audio transcriptions in OpenAI client#400

Open
JasonLovesDoggo wants to merge 3 commits intoPostHog:masterPostHog/posthog-python:masterfrom
JasonLovesDoggo:feat/support-transcribeJasonLovesDoggo/posthog-python:feat/support-transcribeCopy head branch name to clipboard
Open

feat(audio): add tracking for audio transcriptions in OpenAI client#400
JasonLovesDoggo wants to merge 3 commits intoPostHog:masterPostHog/posthog-python:masterfrom
JasonLovesDoggo:feat/support-transcribeJasonLovesDoggo/posthog-python:feat/support-transcribeCopy head branch name to clipboard

Conversation

@JasonLovesDoggo
Copy link

@JasonLovesDoggo JasonLovesDoggo commented Jan 2, 2026

This adds support for tracking transcriptions from OpenAI. It does this via a new event $ai_transcription which follows the pattern of embeddings. I figure that audio -> text Is different enough from text-to-text to deserve its own event.

Confirmed it worked in my own testing. Feel free to impersonate and view https://us.posthog.com/project/254263/events/2e8ded5c-acd2-45b4-b10f-7a85a438ffaa/2026-01-02T15%3A02%3A00.007000-05%3A00

Copilot AI review requested due to automatic review settings January 2, 2026 19:47
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 2, 2026

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds tracking support for OpenAI audio transcriptions via a new $ai_transcription event. The implementation follows the existing pattern used for embeddings, treating audio-to-text as a distinct operation from text-to-text transformations.

  • Introduces WrappedAudio and WrappedTranscriptions classes for both sync and async OpenAI clients
  • Captures transcription metadata including model, input file name, output text, latency, and optional properties like language and audio duration
  • Supports privacy mode, groups, and custom properties consistent with other AI tracking features

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
posthog/ai/openai/openai.py Adds WrappedAudio and WrappedTranscriptions classes to track transcription usage in the sync OpenAI client
posthog/ai/openai/openai_async.py Adds async versions of WrappedAudio and WrappedTranscriptions to track transcription usage in the async OpenAI client
posthog/test/ai/openai/test_openai.py Adds comprehensive test coverage for transcription tracking including basic usage, duration tracking, language parameter, groups, privacy mode, and async support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

posthog/ai/openai/openai.py Show resolved Hide resolved
posthog/ai/openai/openai_async.py Show resolved Hide resolved
posthog/test/ai/openai/test_openai.py Show resolved Hide resolved
posthog/test/ai/openai/test_openai.py Show resolved Hide resolved
@JasonLovesDoggo
Copy link
Author

cc @andrewm4894

@rafaeelaudibert
Copy link
Member

We've updated our release process. We require sampo now. Please rebase on master and check README to understand what should be done.

@rafaeelaudibert rafaeelaudibert requested a review from a team February 19, 2026 03:20
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.