prompt4code

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.

https://github.com/khnshn/prompt4code

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords

code-generation llm
Last synced: 4 months ago · JSON representation ·

Repository

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.

Basic Info
  • Host: GitHub
  • Owner: khnshn
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 101 KB
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
code-generation llm
Created over 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

Prompt4Code logo

Prompt4Code: Automated In-Context Learning to Generate Code Provided Examples with Docstrings

Prompt4Code version license

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.

Before you begin

Run pip install -r requirements.txt

Usage

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

Example 1

python main.py --prompt "this is my example prompt" --data ./examples --verbose --limit 3 --shuffle --save ./responses/

Example 2

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

Owner

  • Name: Alireza Khanshan
  • Login: khnshn
  • Kind: user
  • Location: Eindhoven, Netherlands
  • Company: Eindhoven University of Technology (TU/e)

PhD in the making

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Prompt4Code
message: >-
  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.
type: software
authors:
  - given-names: Alireza
    family-names: Khanshan
    orcid: 'https://orcid.org/0000-0002-9112-4695'
repository-code: 'https://github.com/khnshn/prompt4code'
keywords:
  - prompt engineering
  - large language model
license: MIT
version: 0.1.0

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Dependencies

requirements.txt pypi
  • aiohttp ==3.8.4
  • aiosignal ==1.3.1
  • async-timeout ==4.0.2
  • attrs ==23.1.0
  • certifi ==2023.5.7
  • charset-normalizer ==3.1.0
  • colorama ==0.4.6
  • docstring-extractor ==0.4.0
  • docstring-parser ==0.7.3
  • frozenlist ==1.3.3
  • idna ==3.4
  • multidict ==6.0.4
  • openai ==0.27.8
  • python-dotenv ==1.0.0
  • requests ==2.31.0
  • tqdm ==4.65.0
  • urllib3 ==2.0.3
  • yarl ==1.9.2