Giter Club home page Giter Club logo

optai's Introduction

optai

Optai is a python based command-line tool designed to optimize and enhance your python repositories by rewriting your functions in a cleaner and more optimised way. It helps improve the readability, performance, and maintainability of Python code by applying various transformations.

This is based on the OpenAI LLM and requires you to have an API key.

Features

  • Automatically optimize and clean Python code in a given repository.
  • Improve variable naming, formatting, and code structure.
  • Easily integrate with your Python projects for code enhancement.

Setup

  1. Clone the Python Code Optimizer repository:

    git clone [email protected]:IlluvatarEru/optai.git
    
  2. Install requirements:

    pip install -r requirements.txt
    
  3. Add your OpenAI key and organisation to the .env file:

    echo 'export OPEN_AI_KEY="YOUR_KEY"' >> .env
    
    echo 'export OPEN_AI_ORG="YOUR_ORGA"'>> .env
    
  4. Add Optai to bashrc:

    OPTAI_PATH=$(pwd)
    echo 'alias optai="$OPTAI_PATH/optai.bash"' >> ~/.bashrc
    echo 'export OPTAI_PATH=$OPTAI_PATH'>> ~/.bashrc
    source ~/.bashrc
    
  5. Run on a target repo:

    optai "path_to_repo"

Flags:

  • You can add the flag --opti-only to ask it to just optimize the performance of the code rather than to also improve the variable naming, formatting etc.
  • You can add the flag --file=<file_name> to ask it to only process a single file

What's next?

We plan on:

  • enabling this repo to work on most languages
  • rewriting it in rust so that it is faster
  • improving the rewriting quality
  • making it work with local models rather than only OpenAI

optai's People

Contributors

illuvatareru avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.