Code Monkey home page Code Monkey logo

intellyse-code-solver's Introduction

Intellyse Code Solver

How does it work?

  1. The code solver takes a code description.

Example:

Write a function that counts how many different ways you can make change for an amount of money, given an array of coin denominations. For example, there are 3 ways to give change for 4 if you have coins with denomination 1 and 2:

1+1+1+1, 1+1+2, 2+2.
The order of coins does not matter:

1+1+2 == 2+1+1
Also, assume that you have an infinite amount of coins.

Your function should take an amount to change and an array of unique denominations for the coins:

count_change(4, [1,2]) # => 3
count_change(10, [5,2,3]) # => 4
count_change(11, [5,7]) # => 0
upload_5ceb737b74af7d877b4ce4a020ddcd7e
  1. It generates Python assertions using GPT-3.5-turbo.
  2. It generates Python code solutions using GPT-3.5-turbo and GPT-4-turbo using the following configuration (from cheap solutions to expensive).
configs = [
    {"model": "gpt-35-turbo", "temperature": 0, "seed": 0},
    {"model": "gpt-35-turbo", "n": 7, "seed": 0},
    {"model": "gpt-4-turbo", "temperature": 0, "seed": 1},
    {"model": "gpt-4-turbo", "n": 2, "seed": 2},
]
  1. For each solution, a Docker environment is created, and the code solution with assertion is run.
  2. When the solution is found(python code execution is successful), it is displayed. Otherwise, some failed solutions are displayed.

Example solution:

def count_change(amount, coins):
    if amount == 0:
        return 1
    if amount < 0 or len(coins) == 0:
        return 0
    return count_change(amount - coins[0], coins) + count_change(amount, coins[1:])
upload_87fbec95f4aa333b8dcbb6a4dbb61756

How to setup?

Docker is used for both frontend and backend, so you need to first install Docker.

Frontend

Go to frontend folder.

Create .env file following .env.example.

Build and run the app using:

./run.sh dstart  

By default, it is configured for production environment. For development environment and other configuration options see .env file.

Backend

Go to backend folder.

Create .env file following .env.example. Edit AZURE_OPEN_AI_API_KEY and AZURE_OPEN_AI_ENDPOINT.

If you are using a Unix environment, build and run the app using:

./run.sh dstart  

By default, it is configured for production environment. For development environment and other configuration options see .env file.

You can now visit http://localhost:3000.

If you are running an environment other than Unix:

Option 1

You need to map /tmp to your temporary folder (this is used to save python codes to be runned) and /var/run/docker.sock to your docker socket (this is used to create isolated python executions) in the docker-compose.yml filevolumes section.

Option 2

You can just run pip3 install -r requirements.txt and flask run -h localhost -p 8080.

How to improve?

Logic Improvement

Intellyse code solver elaborates on this article to adaptively select between GPT-3.5-turbo and GPT-4-turbo. To improve this approach, EcoAssistant can be used. For the sake of simplicity and lack of time, I didn't implement EcoAssistant.

Production Improvements

  • User Authentication
  • UI
  • Tests
  • ...

intellyse-code-solver's People

Contributors

utgoer 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.