Playing
01. Introduction and demo

Transcript

00:00
Making requests to chat GPT and getting a response back isn't too tricky, particularly when you use something like the OpenAI PHP client.
00:08
But we're going to take this a little step further and look at streamed responses and also maintaining conversation context. So if I tell this bot something, it's
00:19
going to go ahead and remember what I say. Let's go ahead and try this out. So the way that I have set up the prompt here is that it is a friendly bot who will help with any kind of web
00:29
development problems. So let's go ahead and just say, hey. OK, so we're going to wait here. And you can see that the response here
00:35
was streamed in. Rather than waiting for that huge length of time for everything to come back, it will give this to us as it kind of types.
00:44
OK, so I'm just going to say, link me to the Laravel docs. And we'll just wait for here. And you can see that streaming in. It gives us the link.
00:53
We don't have Markdown or anything like this enabled here. So we can't click on this. But we can easily add that in later. OK, so I'm going to ask this to remember something.
01:01
So my name is Alex. And it should respond with something. And I'm just going to ask it what my name is. So what is my name?
01:11
And there we go. Great. So this doesn't happen by default when we send requests to the API.
01:16
Because of course, we send a request off. We get a response back. We don't maintain any kind of context within the conversation history.
01:23
So we're going to be adding that in as well. OK, so let's go ahead and build this. We're going to learn a huge amount about wire stream, which is incredibly useful for other situations as well.
01:34
So you can go ahead and use that for anything where you have streamed content. OK, let's go over and get everything set up and start to build this out.
6 episodes 29 mins

Overview

Let’s learn how wire:stream can help us stream ChatGPT responses as they arrive, by building a chat interface with Livewire.

Each message we send and receive will be shown in chat history. It even remembers the conversation context.

Sure, there are a ton of ChatGPT wrappers out there, but by the end of this course, you’ll have wire:stream in your toolkit for future projects.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Comments

No comments, yet. Be the first to leave a comment.