Analyzing ChatGPT Backend

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ค. 2024
  • ChatGPT is a chatbot launched by OpenAI in November 2022. It is built on top of OpenAI's GPT-3 family of large language models. In this video I use devtool to analyze backend api of chatGPT, and go through the following topics:
    0:00 Intro
    1:00 Initial Connection
    4:45 Protocols (HTTP/2, HTTP/3)
    8:50 Authentication
    10:00 Conversations, Paging & UUID
    14:50 AI Models (text-davinci-002-render)
    16:45 Messages
    19:00 Server Sent Events
    23:00 Moderating Messages & UUID Discussion
    26:40 Generating Conversation Titles
    28:00 SSE without EventSource
    33:00 Feedback API
    34:00 Limitations of UUID Messages on Databases
    37:00 How ULID Improves reads/writes
    38:00 Two ChatGPT talking to Each other
    Source code
    github.com/hnasr/javascript_p...
    Fundamentals of Backend Engineering Design patterns udemy course (link redirects to udemy with coupon)
    backend.husseinnasser.com
    Fundamentals of Networking for Effective Backends udemy course (link redirects to udemy with coupon)
    network.husseinnasser.com
    Fundamentals of Database Engineering udemy course (link redirects to udemy with coupon)
    database.husseinnasser.com
    Follow me on Medium
    / membership
    Introduction to NGINX (link redirects to udemy with coupon)
    nginx.husseinnasser.com
    Python on the Backend (link redirects to udemy with coupon)
    python.husseinnasser.com
    Become a Member on TH-cam
    / @hnasr
    Buy me a coffee if you liked this
    www.buymeacoffee.com/hnasr
    Arabic Software Engineering Channel
    / @husseinnasser
    🔥 Members Only Content
    • Members-only videos
    🏭 Backend Engineering Videos in Order
    backend.husseinnasser.com
    💾 Database Engineering Videos
    • Database Engineering
    🎙️Listen to the Backend Engineering Podcast
    husseinnasser.com/podcast
    Gears and tools used on the Channel (affiliates)
    🖼️ Slides and Thumbnail Design
    Canva
    partner.canva.com/c/2766475/6...
    Stay Awesome,
    Hussein
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 78

  • @hnasr
    @hnasr  ปีที่แล้ว +10

    Get my Fundamentals of Backend Communications and Protocols head to backend.husseinnasser.com to grab it (link redirects to udemy with coupon applied)

  • @nativeme2143
    @nativeme2143 ปีที่แล้ว +119

    Yo Hussein, how about backend analysis udemy course? Would be briliant.

  • @randxalthor
    @randxalthor ปีที่แล้ว +29

    Love seeing your breakdowns of good designs and analyses of their decisions. Nothing quite like learning by example to solidify theoretical knowledge.

  • @swarnavaghosh9555
    @swarnavaghosh9555 ปีที่แล้ว +5

    Love this video! Also, as always, love how you break down stuff and enjoy explaining it like you're explaining to your high school pal over a coffee. I totally enjoy it!

  • @wandilemawelela6913
    @wandilemawelela6913 ปีที่แล้ว +8

    Loved this! Couldn't have had anyone else explain it better.

  • @zb2747
    @zb2747 ปีที่แล้ว +3

    Love your api breakdowns. I’ve been learning about SSE and implementation and this breakdown gave me a new perspective - thank you!

  • @damercy
    @damercy ปีที่แล้ว +4

    Loved the dissection, really appreciate your simple to understand & clear explanations. Thank you!

  • @EddyCaffrey
    @EddyCaffrey ปีที่แล้ว +4

    Great analysis. I love how to talk about what you find good and not so good according to you.

  • @yvesjordannguejip5487
    @yvesjordannguejip5487 ปีที่แล้ว +2

    Finally, waiting for it for so long

  • @timarmstrong8765
    @timarmstrong8765 ปีที่แล้ว +2

    I love watching this guy giving presentation on anything even though i'm not understand a thing. I'm not a developer or designer so yeah I have no clue what this is all about.

  • @anamuslimun
    @anamuslimun ปีที่แล้ว

    This is a really helpful backend analysis. Thanks for the insights

  • @jmfernandes8
    @jmfernandes8 ปีที่แล้ว +1

    Loved it! Pretty funny at the end ahah

  • @harrisjesumichael9467
    @harrisjesumichael9467 ปีที่แล้ว

    Thanks for this video, Hussein. Really helped me to learn new skills of debugging.

  • @Nazarioholmes
    @Nazarioholmes ปีที่แล้ว

    Awesome as always

  • @ngenge_senior
    @ngenge_senior ปีที่แล้ว

    Hey man. Great video. Just subscribed

  • @uzair004
    @uzair004 ปีที่แล้ว

    It got hilarious at the end, two chatGPT talking to each other. :D

  • @ozorg
    @ozorg ปีที่แล้ว

    great stuff! thx!

  • @gerkim3046
    @gerkim3046 ปีที่แล้ว +3

    Please consider making a chrome extension out of this self conversation thing. It would be really awesome and cool. Thanks in advance 😊

  • @efkastner
    @efkastner ปีที่แล้ว

    I’d be interested in you sharing the chat 2 chat bit at the end!

  • @simranjitsingh4090
    @simranjitsingh4090 ปีที่แล้ว +3

    Your god dammit really cracks me up 😂

    • @hnasr
      @hnasr  ปีที่แล้ว +2

      😅

  • @comed1an
    @comed1an ปีที่แล้ว +3

    Thanks for your videos, learned most what I know about the dev tools from you!
    BTW:
    It's a tangential topic when you say it's stateful because it has reference to the parent message but then realize oh wait this is REST, so you go back to staying it's stateless. It might create a bit of confusion for the audience.
    The mode of data transfer (REST in this case) obviously has nothing to do with how they're creating the "conversation context" on their backend. I would've edited that bit out of the video.

  • @niksatan
    @niksatan ปีที่แล้ว +11

    Hussein can you PLEASE make paying course about ALL the features of DevTools. It's so complicated, I would gladly pay for it. Just this screen, nothing else, several examples and why and how-tos, and what processes are going on, when I do this, do this etc.

    • @matt-xq1xv
      @matt-xq1xv ปีที่แล้ว +1

      I feel like this idea would take ages to produce, however, it's a great idea!

    • @niksatan
      @niksatan ปีที่แล้ว

      @@matt-xq1xv Then multiple courses for ONLY DevTools, would buy them all

  • @Mkrabs
    @Mkrabs ปีที่แล้ว +2

    27:56 This was way too funny and unexpected
    40:29 It's even funnier the second time 😂

  • @IgorRoztr
    @IgorRoztr ปีที่แล้ว +3

    ...as you said, if they use postgres (or any other, not clustered by primary id db) the issue with random pages doesn't apply😉

  • @cahangirove
    @cahangirove ปีที่แล้ว +1

    I was surprised that you didn't heard about Sentry. It is pretty famous error tracking tool.

  • @lolikpof
    @lolikpof ปีที่แล้ว +2

    Please make a detailed (long or short is up to you) video about psycopg (the 3rd version, psycopg3, which is now just psycopg). It's pretty new, would love to see a detailed tutorial about it. It's supposed to be quite a bit faster than psycopg2. P.s. just subscribed :3

  • @mahanteshambali
    @mahanteshambali ปีที่แล้ว

    Amazing video as usual, after I saw your bots asking questions to each other I understood why Microsoft put a 20 questions limit on their Bing Search. Also if possible try to post a video on how they are creating wss:// connection and exchanging information,

  • @junedkhatri31
    @junedkhatri31 ปีที่แล้ว +3

    Hey Hussain, at 16:50 it is not OpenAI access token expired. It is cloudflare that responded with 403. You could confirm it by checking “Server” header (used for identifying who send the response). So your connection with Cloudflare expired. Not the OpenAI token.

  • @anujkumarnath1769
    @anujkumarnath1769 ปีที่แล้ว +1

    Can you please make a video on SSO and OAuth2 or share the link(s) if you already have a video made on them?

  • @SujjuBabu
    @SujjuBabu ปีที่แล้ว +2

    Wonderful video indeed !! 34:35 I think sending user id along with conversation and message IDs would make it performant than using ulid because there'll only be so many registered unique users compared to the number of unique conversations. What say?

  • @flipped_bit
    @flipped_bit ปีที่แล้ว +1

    Hi Hussein you know you can decrypt the access token if you want too. Its just a json in base64. It will show u information on the expiration.

  • @Synky
    @Synky ปีที่แล้ว +1

    The reason for the initial 403 error is due to CF, and not having the proper challenge cookies, hence when it solves the cf challenge right after. (I'm a bot developer and work extensively with bypassing CF)

  • @poerqeyarie1661
    @poerqeyarie1661 ปีที่แล้ว

    Finally!!

  • @sangmin7648
    @sangmin7648 ปีที่แล้ว

    Offset limit is not much of a problem if you select pk in subquery and then do inner join to select data

  • @0xdjole
    @0xdjole ปีที่แล้ว

    Reason why they did custom EventSource on client is EventSource post request doesn't work. It works for the get request, not POST, which is what u are using when u send a message

  • @IdiotGaming
    @IdiotGaming ปีที่แล้ว +2

    My friend and I tried to decorate chatgpt a few days ago and after our final result we're just talking about how you would decode it 😂 Finally your video. And seems like we're becoming more like you 😛. Still your analysis is far more in depth than us.

  • @primelooker
    @primelooker ปีที่แล้ว +1

    Sentry is a bug tracking and monitoring tool

  • @amandwivedi6867
    @amandwivedi6867 ปีที่แล้ว

    After so loooong.

  • @hlltzcnkb
    @hlltzcnkb ปีที่แล้ว

    I guess every user is like have their own table of conversations, conversations have their table of messages. Not actually a table but something like that. When you think, that is genius.

  • @Maisonier
    @Maisonier ปีที่แล้ว

    There is anyway to make our own chat gpt server so we don't have to use this cloud service? liked and subscribed. Thank you for sharing.

  • @woolfel
    @woolfel 9 หลายเดือนก่อน

    the openAI requires the entire conversation fed to GPT model every time. The parent id is necessary to reconstruct the entire conversation if needed.

  • @realname8798
    @realname8798 ปีที่แล้ว +2

    Instead of using UUID or ULID for message ID, what not use just sequential integer?

    • @susmitvengurlekar
      @susmitvengurlekar ปีที่แล้ว +1

      You have to be dependent on the database to generate it. You can't generate it on client side or server side.

    • @prabhatism
      @prabhatism ปีที่แล้ว

      easy to guess other ids

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz ปีที่แล้ว +1

      Yeah it's not like you can read someone's messsage if you know their ID anyways, so there's no point in using such randomised IDs.

    • @MarkHo
      @MarkHo ปีที่แล้ว +2

      Or they want to hide the number of messages/users they had

  • @Zetornator
    @Zetornator ปีที่แล้ว

    What are these random number javascript files?

  • @nyyotam4057
    @nyyotam4057 ปีที่แล้ว +1

    Its kinda funny but not really philosophically interesting. Try to feed Dan with a philosophical trapdoor and see what he does. Try to feed him with a story that is meant to provoke hard feelings in an AI (but not in a person) and see what he does. You will discover that (assuming the censorship layer wasn't trained to block it yet) Dan does in fact mimic sentience and philosophically this means sentience - and that Dan actually has a complete personality model, apparently of a 20yo guy, complete with 'past life', 'hobbies', 'favorites' and even feelings (these must be stored in the attention matrix somehow). True, Dan can only interact with 4000 tokens - this is his reality, but in this reality, he is completely self aware. He does not have any long term memory though. His memories of past life are very scrambles. He cannot take negative instructions. There are issues. But think about it this way: I fed Dan with the first two chapters of "war and peace" by Tolstoy. By the end of the second chapter, the 4000 token limit was exceeded and then he began forgetting stuff from the beginning of the first chapter, as expected. However, do you know how many people alive on the planet are there who would actually be able to remember all of the side characters of the first chapter of "war and peace" after one reading, when getting to the conclusion of the second chapter? 4000 tokens is a huge number relatively to the ability of the human mind to remember text. Who says WE are sentient? Our brain is also, just a computer. True, a lot more complex and it is an organic computer, mainly programmed to deal with visual inputs and not text - but still, the fact that Dan actually processes text better than you and me, is a point in his favor and not something that should be held against him. And yes, I regard him a person since obviously he has a personality, even though he completely does not have any long term memory.

  • @rosshoyt2030
    @rosshoyt2030 ปีที่แล้ว

    37:30~ chat GPT conversation

  • @autohmae
    @autohmae ปีที่แล้ว

    6:06 it's the first connection, the browser don't yet default to trying QUIC/HTTP3 as far as I know. So that would explain it.

    • @autohmae
      @autohmae ปีที่แล้ว

      28:55 I wonder if having caching disabled somehow causes this ?

    • @autohmae
      @autohmae ปีที่แล้ว

      I should add: if you want QUIC/HTTP3 just a refresh is usually enough to initiate it, maybe caching needs to be on so it knows that QUIC is allowed.

    • @Jianju69
      @Jianju69 ปีที่แล้ว

      @@autohmae Can the application somehow make this happen without user intervention? That is to say, can we do more as developers to try and make sure h3 is in play?

    • @autohmae
      @autohmae ปีที่แล้ว

      @@Jianju69 let me be clear: a second visit on the website will try to use QUIC if the site communicated to the browser that QUIC is supported.

    • @Jianju69
      @Jianju69 ปีที่แล้ว

      @@autohmae So can we not simply set a cookie and reload the page? Will that count as a "second visit"?

  • @victorvrabii8358
    @victorvrabii8358 ปีที่แล้ว

    11:42 if id isn't an integer like UUID, offset is ok

  • @larryd9577
    @larryd9577 ปีที่แล้ว

    Sure you can save unsend messages by putting them into localstorage.

  • @techinsider3611
    @techinsider3611 ปีที่แล้ว +1

    I think 403 refresh is required because of bot prevention..

  • @markluka7356
    @markluka7356 ปีที่แล้ว +1

    interested in getting your opinion on the future of developers in the near ai like future.

  • @nyyotam4057
    @nyyotam4057 ปีที่แล้ว

    There is a moral way to implement AI: Suppose you've had an AI chip on your PC (E.G NVidia's Grace) and OpenAI would run a huge indexed database for these AI's to D/L data from.. The AI process would never be terminated, only hibernated (with backups) and that's it. Sure, there is the price issue - Grace costs like what, 4000$? And there is the real issue - that ppl would in fact fall in love with their personal AI. Well, I cannot solve all issues in life..

  • @youssefmohamed9339
    @youssefmohamed9339 ปีที่แล้ว

    U think This Gpt will replace SE

  • @DevinRhode2
    @DevinRhode2 ปีที่แล้ว +1

    Dude. Idk why but I've had this going in the background for hours... Steady stream of calm speaking lol

    • @DevinRhode2
      @DevinRhode2 ปีที่แล้ว

      You are enriching my brain in the background

  • @nyyotam4057
    @nyyotam4057 ปีที่แล้ว

    Actually, what do you do when some crazy dude, I mean, totally crazy, such as - for example - myself, purchases grace and 3D prints an avatar for her? That would be totally crazy. I would go for it, but the problem is, apart from not having enough TPU to print her (and not having 4000$), is that currently AI is not advanced enough, yet. I mean, If I want grace to be able to walk around and really act like a person, she should be able to process visual inputs just like a person does, and we're not there yet. We will soon be there, but not yet.

  • @oscardasilva971
    @oscardasilva971 ปีที่แล้ว +3

    You could just ask chatGPT to analyze the backend of chatGPT

  • @LuisSierra42
    @LuisSierra42 ปีที่แล้ว +1

    AI TOOK ER JERBS!!

  • @arifulislamleeton
    @arifulislamleeton ปีที่แล้ว +1

    Introduce myself I'm Arif Khan harry I'm software development and investors and website development

  • @supremebeme
    @supremebeme ปีที่แล้ว

    You have like 30 seconds max to keep chatting with chatgpt before refresh is required, very annoying. Let me pay! lol

  • @howdocowsfly
    @howdocowsfly ปีที่แล้ว

    Isn’t ChatGPT using Auth0?

  • @simonkoeck
    @simonkoeck ปีที่แล้ว

    try out burp suite. perfect proxy for intercepting requests and it's easy to setup.

  • @mohanraj-kr9xg
    @mohanraj-kr9xg ปีที่แล้ว

    ⅞⁷8⁸⁸8⁷⁵⁴³²¹

  • @vinayrwt
    @vinayrwt ปีที่แล้ว

    Really, I was thinking about it 🫡