I built a *streaming* AI chat app

Поділитися
Вставка
  • Опубліковано 16 чер 2023
  • Learn how to use the new Vercel AI SDK to quickly build streaming AI chat apps with APIs like OpenAI, Anthropic, HuggingFace, LangChain, and more.
    Upgrade to get the full SvelteKit Course at fireship.io/pro
    Use promo code FKIT to save 35%
    Vercel AI Announcement vercel.com/blog/introducing-t...

КОМЕНТАРІ • 150

  • @yashkhd1100
    @yashkhd1100 11 місяців тому +536

    It's incredible how many hats he is able to wear at the same time. I mean making high quality super dense tech videos, making top notch Courses, keeping track of all happenings and also creating such incredible side projects. Please do make a video about ur time management...I'm sure it's gonna worth ton to lot of people...!!

    • @chouaibdjerdi9092
      @chouaibdjerdi9092 11 місяців тому +22

      Yes exactly, How can someone keep up with todays tech updates and even do projects and tuto about it barely can keep up with what has been done 10 years ago HAHA

    • @bigs2469
      @bigs2469 11 місяців тому +27

      I run a 20k sub software dev channel on a separate account - It's hard to explain, but the drive you get from "I need to build this for content" is insane. I can hardly focus on my non-channel side projects because I don't have that fire under me, but when I'm building something for a video I just get carried away. Perhaps Fireship has a similar mentality.

    • @mwansa430
      @mwansa430 11 місяців тому +14

      Maybe he made an AI that is able to replicate his voice and he uses it to make the videos

    • @JBroMCMXCI
      @JBroMCMXCI 11 місяців тому +3

      In a previous video he showed his workflow using all generative AI tools so I think it takes very little time to make these videos, just time to develop the workflow

    • @glmchn
      @glmchn 11 місяців тому +2

      U got bamboozled, it's just an AI making the content since day 1 🤯

  • @JoshuaGenders
    @JoshuaGenders 11 місяців тому +2

    just started working with sveltekit, so nice

  • @AdrianMark
    @AdrianMark 11 місяців тому +10

    Fantastic work man. Can't wait for the Vercel course to be out on Fireship pro

  • @SirDamatoIII
    @SirDamatoIII 11 місяців тому +2

    Man I am excited for the SvelteKit course! Jeff for President!

  • @bowfun-yt
    @bowfun-yt 11 місяців тому +9

    Great video, very exciting for this! This video is very useful for me. Thanks!

    • @ropoxdev
      @ropoxdev 11 місяців тому +2

      Dude how did you watch it under 1 minute

  • @mohaimanulislammahin4095
    @mohaimanulislammahin4095 11 місяців тому +12

    0:01 train is from my country. Love from Bangladesh

  • @carlosfortega3470
    @carlosfortega3470 11 місяців тому +45

    in the time he programs, edits, and uploads the video, I made the basic chat app. lmao

    • @Eurotool
      @Eurotool 11 місяців тому +4

      In that time I made nothing

    • @YuriG03042
      @YuriG03042 11 місяців тому +2

      are you actually comparing yourself to someone with over a decade of experience? bruh moment

    • @heroe1486
      @heroe1486 10 місяців тому +1

      ​@@YuriG03042Could play a role but those are mostly hello world examples, things that take time are usually little details you need when developing a real app, you can ignore those for video tutorial purposes

  • @abeechr
    @abeechr 11 місяців тому +13

    Dear Jeff and any of you super coders out there, How would this work at scale? If deployed, how many simultaneous users could stream data given the standard paid api? And what might the code look like to deal with hitting that limit?

    • @chukaraslan9051
      @chukaraslan9051 8 місяців тому +2

      Easy. Use multiple accounts each with their own api keys and go brrrrrrrrr

    • @abeechr
      @abeechr 7 місяців тому

      ​@@chukaraslan9051 So create an api key for each of my users?

  • @dongums
    @dongums 11 місяців тому

    thank youuuu

  • @greendsnow
    @greendsnow 11 місяців тому +2

    Vercel jumped on it because it takes 5+ seconds to complete a stream, during which they charge you for each 50 ms of edge function your using.
    So 100 edge units for each answer. USD 2 for 1 million units.

    • @chukaraslan9051
      @chukaraslan9051 8 місяців тому

      function makeMoreOpenAIAccountsForUnlimitedAPIKeysAndFckVercel () {
      return "nothing to see here)
      }

  • @VaibhavShewale
    @VaibhavShewale 11 місяців тому +1

    time to make one for myself!

  • @muhammad.mohsen
    @muhammad.mohsen 11 місяців тому +5

    The "fkit" course 😭😭💀you're too good man!!

    • @YuriG03042
      @YuriG03042 11 місяців тому

      FirebaseKit stack is too strong

  • @TheSteelcry
    @TheSteelcry 11 місяців тому +3

    For anyone trying to follow along at home for your own app, in case you get a 400 code (malformed response) and no other info the possible causes can be:
    - Invalid or maxed out API key
    - Bad prompt with illegal characters or too long
    - in my case I passed in const messages to the request instead of const {messages} (oops!)

  • @other_perfection
    @other_perfection 11 місяців тому +11

    did you know that you can do it without Vercel AI SDK using OpenAI SSE (Server-Sent Events) Streaming API? it's not much more complicated

    • @marvinkr
      @marvinkr 11 місяців тому

      Got content or recs on how to pull that?

  • @salmanbehen4384
    @salmanbehen4384 11 місяців тому

    Frick all this... We need a video on how you keep yourself updated with all this and manage your time.

  • @ScytherDOTA
    @ScytherDOTA 11 місяців тому +13

    Newbie question from someone with no backend knowledge: What would I need to look up for if I would want to make a AI chatbot such as that in React? Any tips for starters?

    • @stunseedfortnite
      @stunseedfortnite 11 місяців тому +10

      Fortnite

    • @stunseedfortnite
      @stunseedfortnite 11 місяців тому +8

      Amongus

    • @stunseedfortnite
      @stunseedfortnite 11 місяців тому +6

      Cheeseburger

    • @shapelessed
      @shapelessed 11 місяців тому +9

      First of all - Don't build it in React... It's overhyped, overcomplicated and just plain slow. Meanwhile Svelte is like drugs, once you try it you don't wanna go back.

    • @marusdod3685
      @marusdod3685 11 місяців тому +3

      @@shapelessed svelte is react but shit. give me jsx expression any day of the week

  • @Jip1912
    @Jip1912 11 місяців тому +5

    What is the benefit of using this over just using the ChatGPT API? Is the only benefit that its streaming so typing the result instead of waiting for the whole result before showing it?

    • @DemPilafian
      @DemPilafian 11 місяців тому +1

      The *_"typing effect"_* makes it sentient.

    • @the_ws
      @the_ws 11 місяців тому

      Well I built that weeks ago using simple vanilla js (with streaming)

  • @agesnipes
    @agesnipes 11 місяців тому

    So in this example, you're using readable streams over HTTP? Are there any advantages/disadvantages to this approach compared to websockets?

    • @skyhappy
      @skyhappy 11 місяців тому

      nope

    • @potatohater5599
      @potatohater5599 11 місяців тому

      Pretty sure it uses a lot more bandwidth, since I think each HTTP request has a lot more boilerplate, like headers.

    • @its.arjun.s
      @its.arjun.s 9 місяців тому +1

      Unlike having to keep a connection alive with WebSockets, HTTP is much more simpler, and better in cases where client->server streaming isn't required. Also HTTP is probably more familiar anyway.
      SSEs have always been a great option

    • @KnorxThieus
      @KnorxThieus 3 місяці тому

      ​@@potatohater5599No, HTTP SSE uses a single connection

  • @MrAmack2u
    @MrAmack2u 11 місяців тому

    Any idea how to maintain the streaming text while using the new function calling api openai just reelased? I had to disable stream to get it to work properly.

    • @cholst1
      @cholst1 11 місяців тому +1

      Not an answer, but a sidenote, functions are fucking incredible.

  • @pepperpeterpiperpickled9805
    @pepperpeterpiperpickled9805 11 місяців тому +2

    does Open AI gather your data?

  • @jorgesaxon3781
    @jorgesaxon3781 11 місяців тому +6

    Im not gonna say first that would be cliche, me being early means nothing, so Ill just say fireship if you see this you should make a video on hugging face transformers

    • @beyondfireship
      @beyondfireship  11 місяців тому +1

      Soon... HF transformers are awesome

  • @shateq
    @shateq 11 місяців тому

    Vercel's ai hype train 😂😂

  • @dhruvshetty3244
    @dhruvshetty3244 10 місяців тому

    can we use this in next js?

  • @mrala
    @mrala 11 місяців тому

    can we use open source local models?

  • @devgenesis6436
    @devgenesis6436 11 місяців тому

    I want to built this for my webapp..i mean it would be nyc if the user ask question on my web app and based on the data on the web app the chatbot responds..like if the app is about stack overflow for ex..the chatbot responds to the data according to user so he dont have to go through all the articles...can someone help me

  • @radumihaidiaconu
    @radumihaidiaconu 11 місяців тому +2

    i just did it in NuxtJS

  • @fagnersales532
    @fagnersales532 11 місяців тому +1

  • @ChadThieleChaddeus
    @ChadThieleChaddeus 4 місяці тому

    This isn’t possible with Firebase cloud functions is it? (The streaming part)

  • @YHK_YT
    @YHK_YT 11 місяців тому

    What if I want to run my own modem and have it train locally?

  • @Action2me
    @Action2me 8 місяців тому

    When I use this code, the roles are rendered as "undefined". What am I doing wrong?

  • @random__weeb
    @random__weeb 11 місяців тому +3

    OpenAI has revoked all free monthly limits for API Calls and has become a paid service now. Can someone suggest which other platform is free?

    • @ea_naseer
      @ea_naseer 11 місяців тому

      hugging face

  • @zzonawav
    @zzonawav 11 місяців тому

    thanks Fireship .. this github repository is definitely broken lololol

  • @noooOne462
    @noooOne462 7 місяців тому

    i deployed an openai chat app into an Ubuntu server but as soon I make it https the stream stops working, any clue why is It happening

  • @inowatchvideos
    @inowatchvideos 11 місяців тому +4

    This was definitely his AI voice

  • @muntakim.data.scientist
    @muntakim.data.scientist 11 місяців тому +1

    Bangladeshi Train for a sec 0:01

  • @voidmind
    @voidmind 11 місяців тому

    I wonder if customer support bots based on ChatGPT, used by big corporations, could be manipulated to get unlimited prompts on things not related to a real support conversation

    • @agorushkin
      @agorushkin 11 місяців тому

      Good question... huh. ChatGPT api afaik, has a system message - this messages basically tells the bot what it is. But hey, I'll have to look into that, sounds really interesting

    • @bittersweet4074
      @bittersweet4074 11 місяців тому +1

      They should do additional training on that part probably. Otherwise people just gonna write an entire book with it.

    • @Batman-lg2zj
      @Batman-lg2zj 10 місяців тому

      @@bittersweet4074and that’s bad thing

    • @chukaraslan9051
      @chukaraslan9051 8 місяців тому

      ​@@Batman-lg2zjnot nessicarily. As a matter of fact I may or may not have achieved huge success with the aforementioned method and may or may not choose to make the repo public in the near future

  • @daleryanaldover6545
    @daleryanaldover6545 10 місяців тому

    Thanks I have the app built now, I just need an API KEY 😵

  • @muddi900
    @muddi900 11 місяців тому

    So is the stream is just library streaming the full response? Because the API does not provide a stream of the responses.

    • @unconv
      @unconv 11 місяців тому

      The API does it already. You just need to add "stream: true" to the request.

  • @hey_james
    @hey_james 11 місяців тому

    I absolutely love your videos man! But as some one with sensitivity to sibilance, your s’s sound very piercing. It would be amazing if you could tame the sibilance a tad with a de-esser 😅😅👌

  • @7heMech
    @7heMech 11 місяців тому +7

    Fireship really doesn't rest. (but he did rest, if you see what I did there 😉😉)

    • @johnsausage
      @johnsausage 11 місяців тому

      Rest assured that he will rest at some point in time 😂

  • @arthuradriansens3291
    @arthuradriansens3291 11 місяців тому

    Is there a free alternative to this?

  • @chroxify8913
    @chroxify8913 11 місяців тому +7

    its important to note that it might be a good idea to add rate limiting to your endpoint incase you arent elon musk and can afford it either way

    • @facciolite
      @facciolite 11 місяців тому +6

      I am Elon Musk.

  • @vectoralphaAI
    @vectoralphaAI 11 місяців тому +2

    When you say app in all your videos do you mean mobile app or website? Because websites are not mobile apps.

    • @notalanjoseph
      @notalanjoseph 11 місяців тому +2

      Neither.. he means web application

  • @manemobiili
    @manemobiili 11 місяців тому

    I was in the middle of working and i put up this video as whitenoise
    Got instantly more overwhelmed.

  • @ricardocnn
    @ricardocnn 11 місяців тому

    Waiting for Vue and Nuxt support.

    • @compton8301
      @compton8301 11 місяців тому

      Waiting? Why don't you give it a short?

    • @leerob
      @leerob 11 місяців тому +1

      Vue support just landed!

    • @ricardocnn
      @ricardocnn 11 місяців тому

      @@leerob awesome!

  • @unidosemprendedores
    @unidosemprendedores 11 місяців тому

    Now make it work with firebase

  • @spyllite
    @spyllite 11 місяців тому +1

    Yo

  • @Nameless-jp2hj
    @Nameless-jp2hj 11 місяців тому +3

    His voice is definitely ai generated

  • @Dev-Siri
    @Dev-Siri 11 місяців тому

    Beyond Fireship
    IS the new
    Fireship

  • @gourav7315
    @gourav7315 11 місяців тому +1

    where is nextjs video 😅

  • @PlasticEARTH
    @PlasticEARTH 3 місяці тому

    Streamberry

  • @bthundergun
    @bthundergun 11 місяців тому

    Can anyone here give me an idea what the best way would be to have a LLM that's trained on my knowledge base?

    • @chukaraslan9051
      @chukaraslan9051 8 місяців тому

      Get a life
      That being said, look into langchain and RAGs

  • @flor.7797
    @flor.7797 11 місяців тому

    This is how AI super viruses will be created 😢

  • @ruocaled
    @ruocaled 10 місяців тому

    they just keep building SDKs on top of SDKs... guys, there are like 3 api endpoints of openai, these companies tries so hard to get a share and get you hooked to their eco-systems.

  • @Happyday-nn6rh
    @Happyday-nn6rh 11 місяців тому

    how can customized data for answer ????

    • @unconv
      @unconv 11 місяців тому +2

      By sending a system message

    • @Happyday-nn6rh
      @Happyday-nn6rh 11 місяців тому

      @@unconv i want use my data example a pdf and just see this file and answer , dont answer another question ...

  • @boreddad420
    @boreddad420 11 місяців тому

    npm i ai

  • @nz69
    @nz69 11 місяців тому

    69th

  • @vietnam3196
    @vietnam3196 10 місяців тому

    Can you do python

  • @AZisk
    @AZisk 11 місяців тому

    Schwarzenegger

  • @rubenuijtde
    @rubenuijtde 11 місяців тому

    Was this recorded with your AI voice clone?

  • @yolla_4
    @yolla_4 11 місяців тому

    @Beyond Fireship btw the earth is flat.

  • @kp-here5169
    @kp-here5169 11 місяців тому +1

    First comment :)

    • @ropoxdev
      @ropoxdev 11 місяців тому +1

      No I am

    • @cholaempire
      @cholaempire 11 місяців тому +1

      @@ropoxdev no you are not

    • @ropoxdev
      @ropoxdev 11 місяців тому +1

      @@cholaempire yes I am

  • @ropoxdev
    @ropoxdev 11 місяців тому +2

    Hi (first)

  • @JeffBarron1
    @JeffBarron1 11 місяців тому

    cool ill use your chat bot instead of openai so i dont have to pay for it 😂 jk

  • @smplchmp
    @smplchmp 11 місяців тому

    triggered by all these serif fonts. otherwise, brilliant as usual 🖖

  • @chromus9149
    @chromus9149 11 місяців тому +1

    first

    • @ropoxdev
      @ropoxdev 11 місяців тому

      No I am

  • @JBroMCMXCI
    @JBroMCMXCI 11 місяців тому +2

    Isn’t it a bit tasteless to make jokes about India and trains?

    • @YuriG03042
      @YuriG03042 11 місяців тому +1

      it's not a joke about either india or their trains? it's about AI and hype

  • @JuanFmTech
    @JuanFmTech 11 місяців тому +9

    The typing effect gets old for the user waiting on long replies, just don’t use it

    • @riyaadhabrahams
      @riyaadhabrahams 11 місяців тому +13

      But then you will have to show nothing or a loading spinner until the request is done. Which I think is a worse experience

    • @zokalyx
      @zokalyx 11 місяців тому +13

      @@riyaadhabrahams exactly, as far as I know, it's not an effect, it's just the actual speed of the generation.

    • @ahsokaincognito
      @ahsokaincognito 11 місяців тому +9

      That's the actual inference process, hence streaming. It's not a fake delay

    • @underscore.
      @underscore. 11 місяців тому +1

      dumb comment

  • @MichaelEHastings
    @MichaelEHastings 11 місяців тому

    Love the subtle fl@t urth truths that your smarter audience picks up on. Th

    • @YuriG03042
      @YuriG03042 11 місяців тому

      truths LMAO smarter audience

  • @kritikusi-666
    @kritikusi-666 11 місяців тому

    Can you do a tutorial on how (www.twitch.tv/trumporbiden2024 this) is done? Not sure what they are using for the backend. The AI model is uncensored. Be cool to know the process.

  • @fabyosk2664
    @fabyosk2664 11 місяців тому +2

    first

    • @ropoxdev
      @ropoxdev 11 місяців тому +1

      No I am

    • @Dev-Siri
      @Dev-Siri 11 місяців тому +1

      @@ropoxdev no fabyosk2664 is
      check the comments from top to bottom