This is an example of how to use Function Calling
by OpenAI and connect the response with external API.
Blog post explanation: Connect OpenAI with external API using function calling
In this sample we're building a shopping assistant, with this flow:
- It reads user input (natural language)
- Extract the important data
- Call an API based on that data
- Response in natural language
- Install packages
npm install
-
Copy env_template to .env and fill in your API keys
-
Run the program
node index.js
Feel free to adjust the prompt inside the program