Skip to content

ArjixWasTaken/php-gpt-funcs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

PHP GPT-4 Function Calling Example

This is an example code for using the OpenAI GPT-4 API's function calling capability. There is a chatbot.php in the repostiory, which is a command line chatbot that you can use to interact with ChatGPT.

There is also a work-in-progress ChatGPT PHP library in the library/ChatGPT.php file that can work with function calling.

The chatbot has been programmed, using GPT-4 function calling, to answer to queries about the weather with "It's nice and sunny". It also has a shopping cart, into which you can add products and list the contents of.

Usage

Export your OpenAI API key:

$ export OPENAI_API_KEY=YOUR_API_KEY

Run the chatbot:

$ php chatbot.php

Support

If this code is helpful, consider buying me more OpenAI tokens or subscribing to my YouTube channel.

About

GPT-4 Function Calling Example in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • PHP 100.0%