https://github.com/hilmanski/openai-function-calling-example
Example of using function calling and connecting it to an external API
https://github.com/hilmanski/openai-function-calling-example
ai openai
Last synced: 3 days ago
JSON representation
Example of using function calling and connecting it to an external API
- Host: GitHub
- URL: https://github.com/hilmanski/openai-function-calling-example
- Owner: hilmanski
- Created: 2023-12-28T08:06:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-28T08:06:22.000Z (over 1 year ago)
- Last Synced: 2025-04-14T23:43:44.138Z (3 days ago)
- Topics: ai, openai
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - hilmanski/openai-function-calling-example - Example of using function calling and connecting it to an external API (JavaScript)
README
# 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](https://serpapi.com/blog/connect-openai-with-external-apis-with-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
- [Function Calling by OpenAI](https://platform.openai.com/docs/guides/function-calling)
- [Google Shopping API by SerpApi](https://serpapi.com/google-shopping-api)## Run
1. Install packages
```
npm install
```2. Copy env_template to .env and fill in your API keys
3. Run the program
```
node index.js
```Feel free to adjust the prompt inside the program