-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented a AI function to enhance the time and space efficiency of… #16
base: master
Are you sure you want to change the base?
Implemented a AI function to enhance the time and space efficiency of… #16
Conversation
Hi @Torantulino, Can you please review the changes and merge them if you find them acceptable? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this is an interesting one!
It's a cool idea but a little different from the initial idea of AI Functions, and it executes completley unknown and unseen code without allowing the user to review it - which is pretty risky.
Also, could you not just use AI Functions as they currently exist for this?:
I would expect this to output |
Thank you very much for the review. Although it carries some risk, in our situation, it proves beneficial because if you were to provide these functions as a pip package in the future, it would enable developers to promptly verify optimized code. While it may not produce the exact output a developer anticipates, it certainly offers some insight into areas for improvement. |
Yes, you are correct; I could have directly used the AI function. However, I assumed that you would be creating additional functions like this. Yes, the output is |
Hello Torantulino, I have made some code changes that add a function capable of optimizing the time and space complexity of an existing function using GPT models. Can you please review the changes and merge them if you find them acceptable?
"In this example, I have provided two implementations to calculate the square of a number. The first implementation is an unoptimized code that uses a while loop to repeatedly add the number to itself. The second implementation is the result generated by the GPT model, which simply returns the square of the input using the power operator."
def calculate_square(x):
"""
This function returns the square of its input.
"""
n = x
res = 0
while n > 0:
res += x
n -= 1
return res
to
def calculate_square(x):
return x**2