Skip to content
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

Recursive function analysis #13

Open
AntoineBlaud opened this issue Dec 15, 2022 · 5 comments
Open

Recursive function analysis #13

AntoineBlaud opened this issue Dec 15, 2022 · 5 comments

Comments

@AntoineBlaud
Copy link

AntoineBlaud commented Dec 15, 2022

Hi JusticeRage,

I was trying your tool, and first I found it super easy to use. Then, I got a little idea to improve a bit the analyze. When the current function calls others tiny functions without other calls inside, I think it will be great to first request analyze for the tiny one and rename it. Especially since it doesn't seem to be too wrong when it suggests a name for small functions. Then with some functions name filled, GPT-3 do a better job.

If you think the idea is good, I can make a pull request this week.

@JusticeRage
Copy link
Owner

Hi! While this is a good idea on paper, I think that going into functions recursively could be a little dangerous, especially when you get into the STL and the like where the rabbit hole can turn out to be pretty deep. It would be easy to have OpenAI costs spiral out of control for users.
Maybe in the future I'll think of doing this and implement a max-depth setting or something like this.

@JusticeRage JusticeRage changed the title Suggestion for improvement Recursive function analysis Dec 19, 2022
@AntoineBlaud
Copy link
Author

AntoineBlaud commented Dec 19, 2022

Re JusticeRage,
Yes you're right. The cost can also quickly rise. But I was talking about calls to tiny functions without calls inside.
So MaxDepth=1
By the way I think that you-re uploading twice the function if we want both comments and variables name.
Given that the price depends of the size of the input, maybe we can find a way to upload it only once ?

@JusticeRage
Copy link
Owner

Correct, because the comments added during the first request help davinci-003 provide better suggestions for variable names.

@sudoaza
Copy link

sudoaza commented Jun 16, 2023

I've experimented manually with this and have gotten great results. Knowing what the called functions do help the model see the big picture and understand better the function. You could add the analysis for the called functions as a comment before it is called and then pass it whole to the model, without displaying it to the user.

@JusticeRage
Copy link
Owner

This is definitely something I intend to look into in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants