Skip to content

AI student podcast backend, part 3#72707

Open
Nokondi wants to merge 4 commits into
stagingfrom
add-ai-student-podcast-3-controller-and-job
Open

AI student podcast backend, part 3#72707
Nokondi wants to merge 4 commits into
stagingfrom
add-ai-student-podcast-3-controller-and-job

Conversation

@Nokondi
Copy link
Copy Markdown
Contributor

@Nokondi Nokondi commented May 18, 2026

Adds AiStudentPodcastsController with show and generate_podcast endpoints. generate_podcast deduplicates against any existing podcast record for the same user + lesson + exact objective set before enqueuing AiStudentPodcastsJob, which delegates to AiStudentPodcastsHelper.create_and_save_to_s3 to produce and upload the audio. Both endpoints are gated on the 'lesson-tutor' single user experiment.

Links

Tech Spec

Testing story

Adds additional unit tests

Deployment notes

Privacy and security

Nokondi and others added 3 commits May 18, 2026 16:20
Adds the AiStudentPodcastObjective join model and updates the
AiStudentPodcast has_many :objectives association to use :through.
Adds StudentPodcastPromptHelper, which builds the OpenAI system
prompt for student podcast script generation from a lesson plus a
selected subset of learning objectives.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds AiStudentPodcastsHelper, which generates a podcast script via
OpenAI and converts it to audio via ElevenLabs, then uploads the
result to S3. The helper short-circuits when an mp3 already exists
in S3, when an existing podcast record already has a saved script,
when another user has already generated a script for the same
lesson + objective set, or when ElevenLabs credits are exhausted.
Includes inner OpenaiClient and ElevenlabsClient HTTP wrappers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds AiStudentPodcastsController with show and generate_podcast
endpoints. generate_podcast deduplicates against any existing
podcast record for the same user + lesson + exact objective set
before enqueuing AiStudentPodcastsJob, which delegates to
AiStudentPodcastsHelper.create_and_save_to_s3 to produce and upload
the audio. Both endpoints are gated on the 'lesson-tutor' single
user experiment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Nokondi Nokondi changed the title Add AI student podcast controller, job, and routes AI student podcast backend, part 3 May 18, 2026
@Nokondi Nokondi requested a review from Erin007 May 18, 2026 21:38
@Nokondi Nokondi marked this pull request as ready for review May 18, 2026 21:38

# GET /ai_student_podcasts/:id
def show
return head :forbidden unless SingleUserExperiment.enabled?(user: current_user, experiment_name: 'lesson-tutor')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤔 Does this work? The experiment flag that we're using so far is a url param for a client side "experiment"

experiments.LESSON_TUTOR = 'lesson-tutor';
Did I miss where the backend experiment is set up?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that you don't have to set up a backend experiment - you just have to add a SingleUserExperiment with that name for whatever user / user subset you want to access the experiment.

Base automatically changed from add-ai-student-podcast-2-generation-helper to staging May 19, 2026 19:08
@Nokondi Nokondi requested a review from Erin007 May 19, 2026 20:27
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