This repo contains Node.js examples using the OpenAI API.
-
If you don’t have Node.js installed, install it from here
-
Clone this repository
-
Install the requirements
$ npm install
-
Make a copy of the example environment variables file
On Linux systems:
$ cp .env.example .env
On Windows:
$ copy .env.example .env
-
Add your API key to the newly created
.env
file -
Run the app
$ node xxx.js
- prepare your data set in a json file
- execute the following command to verify the data set in OpenAI
openai tools fine_tunes.prepare_data -f <LOCAL_FILE>
- Create a fine-tuned model. Base model includes
davinci
,curie
,babbage
,ada
,gpt3
openai api fine_tunes.create -t <TRAIN_FILE_ID_OR_PATH> -m <BASE_MODEL>
- To list all fine-tuned models
openai api fine_tunes.list
- To use a fine-tuned model
openai api completions.create -m <FINE_TUNED_MODEL> -p <YOUR_PROMPT>
- To delete a fine-tuned model
openai api fine_tunes.delete -i <FINE_TUNED_MODEL>
list all key in redis
redis-cli --scan --pattern '*'
get value of a key in redis
redis-cli get <KEY>