Stream OpenAI Chat Completions Like ChatGPT in JavaScript

  Рет қаралды 28,058

Codevolution

Codevolution

Күн бұрын

Пікірлер: 40
@Codevolution
@Codevolution Жыл бұрын
Part 1 - kzbin.info/www/bejne/naOad5yIptiqfJI Source code for copy pasting - bit.ly/3Lm8iyQ
@Matt-Banham
@Matt-Banham Жыл бұрын
for people asking how to create a stream from a back end to front end you can load tokens into a queue and initiate the queue on a separate thread then read the queue from that thread asynchronously on your front end
@employedgorilla
@employedgorilla Жыл бұрын
Struggling with the backend and frontend communication, do you have an example you could share
@carlosm9111
@carlosm9111 Жыл бұрын
How would this work exactly? Javascript is fundamentally single threaded and outside of using a websocket, there is no way to send communication back to the browser from the back end ...
@mokeddesasma1240
@mokeddesasma1240 8 ай бұрын
did u found an example please? Thank u@@employedgorilla
@corsaronero5619
@corsaronero5619 Жыл бұрын
you are a star, i was looking how to simulate the streaming result using openai api, thank you so much, hope you keep it up on AI videos
@ankitkumarjha8109
@ankitkumarjha8109 Жыл бұрын
Can you make a video for Backend implementation of the same? I am able to get the data in chunks, how to read and stream the same in Front end?
@TheAIEpiphany
@TheAIEpiphany Жыл бұрын
Thanks for the video! How does one send stream from the backend instead? Not sure why everyone is creating a version where you have to share the key from the front-end 😅
@gurunnevada17
@gurunnevada17 Жыл бұрын
I have this version, working well on localhost, not on versel haha.
@hishamabbasi815
@hishamabbasi815 10 ай бұрын
When returning the response which involves the code block the chat gpt uses two occurrences of three back ticks ``` is there a way using vanilla javascript to replace those three back ticks with opening and closing html code tags
@jaysharmaumbc
@jaysharmaumbc Жыл бұрын
Thanks for the video. Seems like parsing logic need to change for gpt4 response. Is there any generic way for parsing response?
@MohammedElshorbagy
@MohammedElshorbagy Жыл бұрын
Thanks for the great coding. Is there away to hide or secure the API key in your code from being public exposed? I've already tried . env but I didn't succeed to make it work. Thanks in advance.
@gurunnevada17
@gurunnevada17 Жыл бұрын
up. Same question.
@MichaelLearnsToCode
@MichaelLearnsToCode Жыл бұрын
AFAIK, you can't do that on client side. make a new API Gateway and setup your API key there. and call the API you just created without requiring any API key on the client side.
@aakash6238
@aakash6238 Жыл бұрын
Mazza aa gya 🌹🔥🔥☺️
@mvskiran4727
@mvskiran4727 Жыл бұрын
Appreciate for sharing the video. But, I have a questions. Wouldn’t it be bad to update UI from every chunk of data from backend. Are there any parser to handle chunks to update UI?
@danielChibuogwu
@danielChibuogwu Ай бұрын
Thank you 🙏
@andrewcbuensalida
@andrewcbuensalida 3 күн бұрын
What are the pros and cons compared to WebSockets?
@Spk7711
@Spk7711 Жыл бұрын
If I am using Angular for a chat GPT API call, where can I store my API key in Angular? Even if we store it in the environment variable while making the request, it would be visible in the network tab, right? So how can we get security?
@SebastianLouisSG
@SebastianLouisSG 9 ай бұрын
very useful thousand likes
@_V__.
@_V__. Жыл бұрын
Awesome 🎉
@abhishekvishwakarma9045
@abhishekvishwakarma9045 Жыл бұрын
Great video, thanks for sharing
@sagarramaswamy8368
@sagarramaswamy8368 Жыл бұрын
can u please do a tutorial on how to integrate openAi whisper model .
@zacboyles1396
@zacboyles1396 Жыл бұрын
Great video thanks
@imnbsp
@imnbsp 7 ай бұрын
but how to stream structured data though? if my data is in a multi-level deep json format how to I make sure I get a similar response?
@Miguel-Barcelo
@Miguel-Barcelo Жыл бұрын
Thanks for sharing
@田中洋-f6i
@田中洋-f6i Жыл бұрын
nice vid!!
@Ga2-20
@Ga2-20 Жыл бұрын
Is it possible to read stream using axios?
@ХасановЛенар-в3р
@ХасановЛенар-в3р Жыл бұрын
Yes - stream.on('data', (data) => {//...)
@sreedhar1006
@sreedhar1006 2 ай бұрын
Please can you have the same for react-native ?
@harischaudhry8366
@harischaudhry8366 Жыл бұрын
I am getting an error . "Cannot read property 'getReader' of undefined"
@sanjay261982
@sanjay261982 Жыл бұрын
I am also getting this error. Were you able to resolve it? If yes, how?
@nicholasjankovic1040
@nicholasjankovic1040 Жыл бұрын
Same here. I've been stuck on this error for days. If either of you were able to fix it, please let me know.
@muhammedsinanck7234
@muhammedsinanck7234 Жыл бұрын
Try to use normal fetch without importing any library in code , when i used isomorphic-fetch i got this error
@Movies_mania_grt
@Movies_mania_grt Жыл бұрын
i'm also stuck on same issue since 2 months, did you get ans. plz let me know
@LuberthDijkman
@LuberthDijkman Жыл бұрын
Now md to html javacript parser for chat that triple backtick code fields wil be in code
@aakash6238
@aakash6238 Жыл бұрын
Sir, my free credit got expired 😭, now how to practice these prompts in a free way ?
@AayushSkp
@AayushSkp Жыл бұрын
❤❤❤
@sandeeplakhiwal7043
@sandeeplakhiwal7043 Жыл бұрын
💙
OpenAI Embeddings and Vector Databases Crash Course
18:41
Adrian Twarog
Рет қаралды 516 М.
Create APIs With ZERO Coding
10:47
Codevolution
Рет қаралды 7 М.
Jaidarman TOP / Жоғары лига-2023 / Жекпе-жек 1-ТУР / 1-топ
1:30:54
Как Ходили родители в ШКОЛУ!
0:49
Family Box
Рет қаралды 2,3 МЛН
Building AI-Powered JavaScript Apps Is Way Easier Than You Think
16:01
Full Stack MERN Todo App with React 19, Express v5, MongoDB, Node.js, and SWR
2:51:32
MUST KNOW ChatGPT Prompts for Web Developers
22:20
Codevolution
Рет қаралды 20 М.
How to integrate OpenAI GPT3 with a Databases - Crash Course
16:49
Adrian Twarog
Рет қаралды 302 М.
How To Debug React Apps
17:45
Codevolution
Рет қаралды 18 М.
ChatGPT Crash Course | 10 Practical Use Cases For Developers
32:34
Traversy Media
Рет қаралды 164 М.
Streaming OpenAI Chat Completions Using React and Node JS
4:21
Tosh Velaga
Рет қаралды 14 М.
JavaScript Visualized - Event Loop, Web APIs, (Micro)task Queue
12:35
Jaidarman TOP / Жоғары лига-2023 / Жекпе-жек 1-ТУР / 1-топ
1:30:54