Currently it can work at function level, and can make reasonable modifications to existing code (sometimes buggy, but that may be fixable with a larger model and better training data).
The current chat UI isn't suitable for working with larger codebases, but it seems within realm of possibility to extend it to be an IDE like CoPilot with tooling that feeds it your whole codebase and documentation to work with.
Yupp, it can! I've been able to get it to do simple examples. I was able to get it to print out a 'sum of digits' style function. I was then purposefully placed a silly bug in it by hand. I then ran the code through a 'please code review' style prompt, got a number of decent suggestions out. Using those suggestions, I was able to prompt it to refactor the function to: fix the bug, add documentation comments, include type definitions, and even add tests!.
A simple example, and not 'perfect', but it's quite impressive. Even a simple case of throwing your code 'over the wall' to the AI for review before going to an actual person is a huge time-saver.
The token size limit is the killer here, it means larger files, let alone projects, can't be fully processed in a single prompt.
Initial code produced:
```
def sum_of_digits(n):
if n == 0:
return 0
else:
return n % 10 + sum_of_digits(n // 10)
```
I didn't save the exact code review, but essentially it was just a list of suggested code changes. The prompt was:
```
prompt =
f'Python3. Act like you are a senior engineer writing a code review comment on the code. Write at least two specific changes to make, being sure to check for any errors first: {prompt}. Be as concise and correct as possible, and also be sure to write in a way that is easy to understand.
```
The resulting output code was:
```
import unittest
def sum_of_digits(n):
if n < 0: # Added base case check for negative numbers
return None
elif not isinstance(n, int): # Check type of argument passed in
raise TypeError("Input must be an integer")
elif n == 0:
return 0
else:
return n % 10 + sum_of_digits(n // 10)
Currently it can work at function level, and can make reasonable modifications to existing code (sometimes buggy, but that may be fixable with a larger model and better training data).
The current chat UI isn't suitable for working with larger codebases, but it seems within realm of possibility to extend it to be an IDE like CoPilot with tooling that feeds it your whole codebase and documentation to work with.