Chatbot with Ruby on Rails, Turbo Streams, and OpenAI

Sdílet
Vložit
  • čas přidán 29. 05. 2024
  • In this episode, we build a chatbot in Ruby on Rails using Turbo Streams to create a real-time chat experience.
    00:00 - Introduction
    We generate a Chat controller, model, and migrations to get started. Then we create the main chat index and show pages.
    02:35 - Implement Chat Messaging
    We build out sending and displaying chat messages using Turbo Streams to update the page without reloading. We also add a background job to process the chat messages.
    05:30 - Integrate OpenAI API
    We send the chat message history to the OpenAI API to generate responses. Then we display the "thinking" message before replacing it with the actual response via Turbo Streams.
    09:10 - Refactor for Live Feedback
    We refactor the OpenAI job to immediately show the "thinking" message, then later replace it with the final response. This provides live feedback as the response is generated.
    12:30 - Next Steps
    Some ideas for future improvements like authentication, fine-tuning an AI model, and streaming the OpenAI response.
    Overall, we build a real-time chatbot with Rails and OpenAI using Turbo Streams for a smooth user experience. The code is available on GitHub to try it out yourself!
    #rubyonrails #openai
  • Jak na to + styl

Komentáře • 10

  • @dfriis
    @dfriis Před 6 měsíci

    Thank you so much for sharing. Love your content. Especially love that you allow for errors in your videos. It's super helpful to see how you debug 🙏

  • @badta5te
    @badta5te Před 7 měsíci

    A few weeks ago, I did something similar, but it was a bit messier. Now it's time to refactor. Thank you!

  • @YoussefGazzar
    @YoussefGazzar Před 7 měsíci

    I was afraid of another hiatus but thank God I was wrong! Always happy to receive a new video notification from your channel, keep going bro ❤

  • @55BLOCKS
    @55BLOCKS Před 6 měsíci

    Good content, Mike from kenya

  • @abdullahsaleh7196
    @abdullahsaleh7196 Před 2 měsíci

    keep going

  • @tolaseadegbite1027
    @tolaseadegbite1027 Před 7 měsíci

    Welcome back CJ

  • @doasido5757
    @doasido5757 Před 7 měsíci

    Do you have a video on how to connect the “Woo My accounts” with the “Stripe connect card holders” so that my customers can see there account balance in the same location as the dashboard on Woo My account? Thank you

  • @Adnankhan-dr7qn
    @Adnankhan-dr7qn Před 6 měsíci

    Thank you so much and can you give us a source code please ?

  • @piotrekdabrowski7516
    @piotrekdabrowski7516 Před měsícem

    Is there any github with code?