Prompt4Code is a command line tool that facilitates in-context learning, automatically by reading local source code examples and extracting doctrings and turning them into a conversation with openai's GPT models.
Run pip install -r requirements.txt
Run python main.py -h
or python main.py --help
:
usage: main.py [-h] [-d DATA] [-v] [-p PROMPT] [-m MODEL] [-s SAVE] [-ca] [-l LIMIT] [-sh] [-r]
options:
-h, --help show this help message and exit
-d DATA, --data DATA training source code files directory
-v, --verbose display detailed processing information
-p PROMPT, --prompt PROMPT a short sentence or phrase that is used to initiate a conversation
-m MODEL, --model MODEL gpt model to be used
-s SAVE, --save SAVE directory to save the prompt as a json file
-ca, --callapi calls openai api to generate response based on the input prompt
-l LIMIT, --limit LIMIT limit the number of input files for context learning
-sh, --shuffle shuffle the order of the list of files to traverse
-r, --run immediately run and verbose the generated code
python main.py
--prompt "this is my example prompt"
--data ./examples
--verbose
--limit 3
--shuffle
--save ./responses/
python main.py --prompt "write a python program using simpy that simulates teachers activities during a day. teachers will receive notifications on their smartphone every 2 hours. then depending on their situation they either respond to the notification or ignore it. estimate the response rate to such notfication. run such program for 50 teachers" --data ./examples --verbose --shuffle --run --save ./responses/ --callapi