This repository contains a basic Node.js example demonstrating how to call functions using the OpenAI API. The example showcases a conversation with the OpenAI GPT-3.5 Turbo model, including making function calls and processing their responses.
- Uses
tools
andtool_choice
- Supports parallel function calling
Dependencies: This project has no external dependencies, making it lightweight and easy to set up. You can run this example with just Node.js. However, if you have a preferred library or tool for making HTTP requests, feel free to integrate it as needed to enhance the functionality or suit your specific requirements.
To get started with this example:
-
Clone this repository to your local machine:
git clone <this-repo>
-
Obtain an API key from OpenAI
-
Replace
Bearer sk-xxxxxxxxx
in the code with your API key.
node index.js
node index[Deprecated].js
- Customise the functions and conversation as needed. In this example, a simple weather-related function is included, but you can add more functions to suit your use case.
This repository serves as a starting point for understanding how to integrate function calls into your conversational AI system using the OpenAI GPT-3.5 Turbo model. You can extend the example by adding more functions, handling different types of requests, and tailoring it to your specific application.
This project is licensed under the MIT License - see the LICENSE file for details.