Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adilius/chatgpt-playground
Just testing stuff
https://github.com/adilius/chatgpt-playground
Last synced: 3 days ago
JSON representation
Just testing stuff
- Host: GitHub
- URL: https://github.com/adilius/chatgpt-playground
- Owner: Adilius
- Created: 2024-08-21T16:11:48.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-09-13T10:39:55.000Z (2 months ago)
- Last Synced: 2024-09-13T23:23:49.040Z (2 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Playground for ChatGPT
This is a little proof-of-concept for using ChatGPT API with their [function calling](https://platform.openai.com/docs/assistants/tools/function-calling) tool to retrive locally stored data and pass it to the user. The user prompts the question of getting [Dota 2](https://www.dota2.com/) hero data, if the user provides for example an hero ID then the function calling tool will respond with the function name `getHeroDataByID` and the parameter `id`, if the user instead provides a hero name then the function calling tool will respond with the function name `getHeroByName` and the parameter `name`. With both the function name and parameter we simply run a dynamic function call with the parameter and return the value as `{role: 'tool', content: ...` back to ChatGPT which creates a response that can be sent to the user.## Install & Run
1. Create a `.env` with line `OPENAI_API_KEY=sk-.....`
2. Install depdencies: `npm install`
3. Run application: `node app.js`## Demo
![chatgpt_playground](https://github.com/user-attachments/assets/6299202c-bf79-493b-b4a0-099e59ffc5f8)