OpenAI API Integration

Episode #390 by Teacher's Avatar David Kimura

Summary

In this episode, we have a look at using the OpenAI API to create an AI Response to comments. Instead of simply using the API directly with Net::HTTP, we're also going to create an API wrapper around Net::HTTP so that we can simplify the responsibility of our OpenAI integration.
rails api ai 26:33

Chapters

  • Introduction (0:00)
  • Initial project walkthrough (2:01)
  • Getting an OpenAI API Key (3:01)
  • Setting up the routes (3:11)
  • OpenAI comments controller (4:35)
  • Creating the OpenAI button (5:10)
  • OpenAI controller endpoint (7:06)
  • Creating OpenAI API calls (10:41)
  • Creating the API wrapper (16:51)
  • Demo (23:53)
  • Final thoughts (25:07)
Student & Teacher
$ 9 /mo

Valid School Email Required

Same Access as Pro

Subscribe Now
Pro Monthly
$ 19 /mo

Access to Pro Episodes

Invite to Slack Channel

Priority Suggestions

Ad Free

Subscribe Now
Pro Annual
$ 190 /yr

Access to Pro Episodes

Invite to Slack Channel

Priority Suggestions

Ad Free

Subscribe Now
Teams
$ 57 /mo

3 Users Minimum

$19.00 / user / month

Same Access as Pro

Subscribe to Teams