Skip to content

Python package that allows you to generate code in a Jupyter Notebook using OpenAI's GPT-3 API. The package takes a prompt as an input and returns code that you can use in your notebook.

License

Notifications You must be signed in to change notification settings

ishu121992/JupyterPilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JupyterPilot

Jupyter Pilot is a Python package that uses the OpenAI API to generate code from natural language prompts. It is designed to simplify the process of writing code and to make programming more accessible to non-programmers.

Installation

To install Jupyter Pilot, simply run:

pip install jupyterpilot

PyPi Link

Update 1.0.0

Please run: pip install --upgrade jupyterpilot

  • Removed issues where people were getting In[ ]: in code.
  • Code insertion in new cell
  • All parameters of model can be set using CodetoCell()
  • Improved accuracy with new default params
  • Note: Most of these errors are model generated. For this exact reason, the code creates a test.py in the same working directory as that of the notebook. User can read and manually or programmatically remove these errors.

    Usage

    To use JupyterPilot, import the pysetup class from the jupyterpilot module:

    from jupyterpilot import pysetup

    Then, create an instance of CodetoCell with your OpenAI API key:

    openai_key = "YOUR_API_KEY"
    cc = pysetup.CodetoCell(openai_key)

    Call the get_code method with a natural language prompt to generate code:

    prompt = "Create a function to get stock data from yahoo finance api"
    cc.get_code(prompt)

    This will create a file called test1.py with the generated code and import statements, and then load the code into a Jupyter Notebook cell for further use.

    Options

    You can pass options to the CodetoCell constructor to customize its behavior:

    cc = pysetup.CodetoCell(
        	openai_key=openai_key,
        	model="code-cushman-001", # Choose a different model (optional)
        	tokens=2048, # Increase the number of tokens (optional)
    	tokens=1024 # (optional), 
    	temperature=0.1 # (optional),
    	top_p=1 # (optional),
    	penalty=0, # (optional)
    	presence_penalty=0 # (optional)
    )

    You can choose a different model by setting the model parameter to a different model ID. Other models can be found on the OpenAI API documentation.

    You can increase the number of tokens by setting the tokens parameter to a larger value. The maximum number of tokens supported by the code-cushman-001 model is 2048, while the code-davinci-002 model supports up to 8000 tokens.

    Authors

    @ishu121992

    JupyterPilot is licensed under the MIT License. See the LICENSE file for details.

    About

    Python package that allows you to generate code in a Jupyter Notebook using OpenAI's GPT-3 API. The package takes a prompt as an input and returns code that you can use in your notebook.

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages