Using Server-Sent Events with PHP to Stream Responses from OpenAI ChatGPT API

  Рет қаралды 6,780

Unconventional Coding

Unconventional Coding

Күн бұрын

Пікірлер: 27
@LaoCoi
@LaoCoi Жыл бұрын
My coding skill just increased. Thank you bro!
@VahidDabbagh-g8k
@VahidDabbagh-g8k Жыл бұрын
Amazing tutorial, thanks!
@shawnmckenzie_offcial9598
@shawnmckenzie_offcial9598 Жыл бұрын
Hi, This really Gold Nuggets!!! Thank you, Thank you very much!!! ❤
@দ্যালুজার
@দ্যালুজার Жыл бұрын
This is just awesome . Thanks
@danielbengtsson9833
@danielbengtsson9833 Ай бұрын
I'm trying to get the servers external IP (ie, my laptop), so I currently curl a page on another server and I get my IP number in like 0.05 seconds, which is really slow vs loading the same page in an or geetting it with a xmlhttp request in javascript. Is this faster? I get that it's purpose is for multiple requests, but if we just look at the connection speed for a single request, is it faster than curl?
@wellingtonziotto
@wellingtonziotto Жыл бұрын
Hi! I grasp the importance of testing the application locally. However, once the local testing phase is complete, I'm unsure of the steps to deploy it on an internet host. I've been unable to locate any instructional videos outlining this process. Thanks!🤔
@unconv
@unconv Жыл бұрын
You can check out my video "Deploying a PHP web app on AWS EC2" to get some idea of how deploying can be done. In it I set up a whole server though, so a simpler way might be using a "regular" web hosting provider. I might make a video on that at some point, too.
@azazahmedlipu9738
@azazahmedlipu9738 7 ай бұрын
Hey, hope you fine I am facing issue during markdown to html converting when i did without using streaming method, it was showing perfectly after converting to html , but now it making issue let's say when, it making table markdown it's not converting to html table How chatgpt handle this?
@shawnmckenzie_offcial9598
@shawnmckenzie_offcial9598 Жыл бұрын
Hi, I recieved "414 Request-URI Too Long"... upon check the GET Message.. it includes all previous message "message=Alright%20thank%20you%0A&context=%5B%5B"hi%5Cn"%2C"Hello!%20How%20can%20I%20assist%20you%20today%3" how can we clear this GET Message, so that it always refresh and only send Message based on latest request
@unconv
@unconv Жыл бұрын
I will have to fix this in a future video, so that the message history is not sent in every request, but instead saved in a session.
@shawnmckenzie_offcial9598
@shawnmckenzie_offcial9598 Жыл бұрын
@@unconv Thanks Sensei. I have learned a lot from you. Really appreciate it.
@CLFhama
@CLFhama Жыл бұрын
happy for you
@devseer8340
@devseer8340 8 ай бұрын
Really nice video. Can you make video for server sent event when api callback?
@shawnmckenzie_offcial9598
@shawnmckenzie_offcial9598 Жыл бұрын
Sensei, I want you ask you...where I occasional I received the text "Sorry, but I don't know how to answer that" in between text... it still can generate response but it include the ""Sorry, but I don't know how to answer that" in that reponse. Below is the sample of the anwers:- is it because of special characters it generate? "Cobra is a venomous snake, known for its distinct hood, which itSorry, but I don't know how to answer that. flare out when threatened. There are more than 20 species of cobras found in different parts of the world,"
@unconv
@unconv Жыл бұрын
That happened to me too while making the video, but I'm not able to replicate it right now. It has something to do with the way I check for errors (badly) in the response. You could try adding an error_log("Weird error:".print_r($json, true)); after line 69 in message.php where that text is printed and see what is logged when that happens. Or you can just set $content to an empty string on line 69. I need to look into this further.
@ashikmehermobin9926
@ashikmehermobin9926 11 ай бұрын
I was trying to learn PHP streams, now I have gold mines when found your video. Please make a video on server sent event.
@worldofplayingcards
@worldofplayingcards Жыл бұрын
Hi, I downloaded the chat-wtf GitHub repo and ran it on my localhost, but it doesn't seem to stream? Is the code the the latest version? Thanks!
@unconv
@unconv Жыл бұрын
Does it not respond at all or just doesn't stream?
@worldofplayingcards
@worldofplayingcards Жыл бұрын
@@unconv Yes, it does respond, but just in one block, not streaming each character like ChatGPT.
@worldofplayingcards
@worldofplayingcards Жыл бұрын
@unconv another update on this. If I ask chat-wtf to produce a large output (e.g write me a short story with 10 paragons), then I’ve realised it shows about 5 paragraphs after a few seconds and then the remaining 5 a few more seconds after that. So it seems like it’s streaming very large chunks of the output rather than individual characters.
@unconv
@unconv Жыл бұрын
Interesting... Can you check the Chrome dev tools network tab and the request to message.php, what is shown in the EventStream tab? Might be a Markdown rendering performance issue too
@drors01
@drors01 5 ай бұрын
Hi I am having the same issue. It is responding but no stream. Running on IIS 10 with php8.3. Read that it is related to compression and disabled it but still not working. Did you manage to fix it?
@panpanwardiman3763
@panpanwardiman3763 Жыл бұрын
awesome.
@abdallakaram5376
@abdallakaram5376 8 ай бұрын
amazing
@techlovers4462
@techlovers4462 4 ай бұрын
please make with anthropic API stream
@michabbb
@michabbb Жыл бұрын
you are aware that your mic is terrible?
@unconv
@unconv Жыл бұрын
Yes
Creating PHP GPT-4 Function Calling Chatbot From Scratch
36:07
Unconventional Coding
Рет қаралды 3,1 М.
ChatGPT in HTMX
17:19
Unconventional Coding
Рет қаралды 10 М.
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 108 МЛН
小丑揭穿坏人的阴谋 #小丑 #天使 #shorts
00:35
好人小丑
Рет қаралды 48 МЛН
Wait for it 😂
00:19
ILYA BORZOV
Рет қаралды 11 МЛН
Answer Questions about PDF files using ChatGPT API (NO EMBEDDINGS)
45:37
Unconventional Coding
Рет қаралды 8 М.
Server-Sent Events Crash Course
29:48
Hussein Nasser
Рет қаралды 96 М.
I made my own ChatGPT...
17:58
Unconventional Coding
Рет қаралды 4,1 М.
API Platform Conference 2022 - Pauline Vos - PHP WebSockets
40:52
Les-Tilleuls.coop
Рет қаралды 2,2 М.
Techconference Vienna 2024: OpenAI and .NET - State of the Union
48:16
ChatGPT API in Python
35:18
sentdex
Рет қаралды 181 М.
$0 Embeddings (OpenAI vs. free & open source)
1:24:42
Rabbit Hole Syndrome
Рет қаралды 267 М.
Using EventSource with SSE
27:52
Covalence
Рет қаралды 9 М.
OpenAI GPT-4 Function Calling: Unlimited Potential
23:49
sentdex
Рет қаралды 229 М.
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 108 МЛН