Some useful code for querying ChatGPT.
Works with Python version 3.10
and above ; We use an Anaconda python 3.10 environment.
You can create an anaconda python 3.10 environment called my_env
with:
conda create --name my_env python=3.10
To install dependencies, do the following in your environment:
pip install -r requirements.txt
Run python chatgpt.py
to query chatgpt twice with the following two example queries:
1) What is the capital of France ?
2) What is the capital of India ?
It should store the results in ./test.json
, as follows:
[[0, "The capital of France is Paris."], [1, "The capital of India is New Delhi."]]