Creating PHP GPT-4 Function Calling Chatbot From Scratch

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • In today's video I implement a simple terminal based chatbot using the GPT-4 function calling API with PHP. In the next video I will create a library with this so that it will be easy to integrate to your existing project, so make sure to subscribe!
    GitHub: github.com/unconv/php-gpt-funcs
    Buy me more tokens: buymeacoffee.com/unconv
    00:00 Intro
    02:00 Start coding
    08:47 Implement function calling
    17:21 Running out of tokens
    18:10 Implement API error handling
    19:25 Implement chat loop
    22:08 Implement shopping cart chatbot
    34:14 Final demo
  • Věda a technologie

Komentáře • 9

  • @derrickobedgiu
    @derrickobedgiu Před 8 měsíci

    What an incredible video! Commenting from the future where we now have GPT-4 turbo. I was basically confused on that part of looping conversations. My database structure just seem coded for the previous version. Now I have to re-design the flow of conversation history and the function calling. Would be glad if we could see another update php version with the GPT4V version. Not sure it supports function calling too.
    Thanks for the cool video

  • @diseynotilm
    @diseynotilm Před 11 měsíci

    great!

  • @uwegenosdude
    @uwegenosdude Před 5 měsíci

    Interesting video, thanks a lot. I'm also using visual studio code but I didn't know that I can select several characters in several lines of code and replace all marked selections at once. Good to know that this is possible. Do I need a plugin for this or is it a standard feature?

    • @unconv
      @unconv  Před 5 měsíci

      It's a standard feature. If you select a word and then press Ctrl+D it will select the next same word. Then if you type, it will replace all of them at once. You can also use Alt+Shift+Arrow keys to select a "column" of text over multiple lines

  • @tahiranajeebb3890
    @tahiranajeebb3890 Před 7 měsíci

    i have the subscription of ChatGPT 4 plus. i have just put your code in my directory and execute "chatbot_without_library.php".
    it gives me following error: "Fatal error: Uncaught Exception: Error in OpenAI request: The model `gpt-4-0613` does not exist or you do not have access to it. " i am Newby in ChatGPT. Please help me how to resolve this issue.

    • @unconv
      @unconv  Před 7 měsíci

      ChatGPT Plus subscription is separate from the GPT-4 API access. You might still not have access to GPT-4 API. Try changing the model to `gpt-3.5-turbo` or try `gpt-4` without the 0613 extension.

    • @tahiranajeebb3890
      @tahiranajeebb3890 Před 7 měsíci

      i have tried all options like gpt-4, gpt-3.5-turbo...it give me same error like model does ot exist
      @@unconv

    • @tahiranajeebb3890
      @tahiranajeebb3890 Před 7 měsíci

      @@unconv how to get access of GPT-4 API?

  • @hopevzla
    @hopevzla Před 6 měsíci

    have you tryed $last_item_array = end($my_Array);