- 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](https://private-user-images.githubusercontent.com/26162975/330097260-2ef8c263-5334-407d-911c-bb13d9124ad2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyNjMyMDcsIm5iZiI6MTcyMjI2MjkwNywicGF0aCI6Ii8yNjE2Mjk3NS8zMzAwOTcyNjAtMmVmOGMyNjMtNTMzNC00MDdkLTkxMWMtYmIxM2Q5MTI0YWQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI5VDE0MjE0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRiNzNhYzE0Y2E1NGRhZTY1NGMyZmQxZDllZWViNzc1YmI4YmI4NTM1YTIwYzIyZjMyZDBhYmIwODJhMjViOWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.q14JzYqzZuqyoeL9M-LJs3Lry4VOFpkEcN7d9ZCGCcY)
- It generates Python assertions using GPT-3.5-turbo.
- 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},
]
- For each solution, a Docker environment is created, and the code solution with assertion is run.
- 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](https://private-user-images.githubusercontent.com/26162975/330097420-bd5d205a-89a1-48f0-9812-6368380f5f0c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyNjMyMDcsIm5iZiI6MTcyMjI2MjkwNywicGF0aCI6Ii8yNjE2Mjk3NS8zMzAwOTc0MjAtYmQ1ZDIwNWEtODlhMS00OGYwLTk4MTItNjM2ODM4MGY1ZjBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI5VDE0MjE0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU4MDRjZDFiNzE1N2ZlMDgzYjJjZmFjODQ2OWMxNGExNjIyMTJjNDk1YjU5MDY4OWQzZGFlMjk0OThlZGVjNmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zupt2ao2aXr_yjAub8UaIWkyh-TeuGBc2tghd6Y_oCA)
Docker is used for both frontend and backend, so you need to first install Docker.
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.
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:
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.
You can just run pip3 install -r requirements.txt
and flask run -h localhost -p 8080
.
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.
- User Authentication
- UI
- Tests
- ...