hilmanski / openai-function-calling-example

Example of using function calling and connecting it to an external API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

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

Use case

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

Tools need

Run

  1. Install packages
npm install
  1. Copy env_template to .env and fill in your API keys

  2. Run the program

node index.js

Feel free to adjust the prompt inside the program

About

Example of using function calling and connecting it to an external API


Languages

Language:JavaScript 100.0%