-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feature: added new cody receipe optimize #51974
feature: added new cody receipe optimize #51974
Conversation
We require contributors to sign our Contributor License Agreement (CLA), and we don't have yours on file. In order for us to review and merge your code, please sign CLA to get yourself added. Sourcegraph teammates should refer to Accepting contributions for guidance. |
We require contributors to sign our Contributor License Agreement (CLA), and we don't have yours on file. In order for us to review and merge your code, please sign CLA to get yourself added. Sourcegraph teammates should refer to Accepting contributions for guidance. |
@cla-bot check |
The GitHub CLA Bot is rechecking to see that you have signed the CLA - note that it may take up to 30 minutes for your response to be synchronized. |
@cla-bot check |
The GitHub CLA Bot is rechecking to see that you have signed the CLA - note that it may take up to 30 minutes for your response to be synchronized. |
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.
Thanks for the PR, @Momilijaz96! Very interesting. Do you have examples of how it worked? Did you test it on some code and got good results?
There's some linting issues, according to CI:
> @ format:check /root/buildkite/build/sourcegraph
--
| > prettier '**/{*.{js?(on),ts?(x),graphql,md,scss},.*.js?(on)}' --config prettier.config.js --check --write=false
|
| Checking formatting...
| [warn] client/cody-shared/src/chat/recipes/vscode-recipes.ts
| [warn] client/cody/src/main.ts
| [warn] Code style issues found in 2 files. Forgot to run Prettier?
Those need to be fixed
new GenerateDocstring(), | ||
new GenerateTest(), | ||
new GitHistory(), | ||
new ImproveVariableNames(), | ||
new InlineChat(), |
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.
Why the reorder?
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.
I removed the reordering, I guess that was extra.
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.
This is really interesting. I feel like we should have a recipe regarding time and space complexity!! Thank you so much for this.
I would also love to see some examples as @mrnugget suggested
I installed prettier and ran it manually by |
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
Sure thing! |
Overall the models suggest good optimizations for the code but |
Looking at the examples here (#51974 (comment)) it seems like the formatting is broken, no? Every reply is prefixed with "Here is the response" and then it's raw Markdown. That should be fixed before we merge this |
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.
See my comment inline and the previous comment further up
Don't include the input code in your response. Beautify the response for better readability.\ | ||
Response format should be: This code can/cannot be optimzed. Optimization Steps: {} Time and Space Usage: {} Updated Code: {}\ | ||
However if no optimization is possible; just say the code is already optimized. \n\n\`\`\`${extension}\n${truncatedSelectedText}\n\`\`\`\n${MARKDOWN_FORMAT_PROMPT}` | ||
const assistantResponsePrefix = `Here is the response \n\`\`\`${extension}\n` |
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.
I think this breaks the formatting: we don't want every response prefixed with "Here is the response"
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.
🎉 @Momilijaz96 do you mind solving the merge conflict? I can look into it as well if you're busy. Ping me here when you did this so I can run the latest changes on CI and we can ship this 🚀 |
Hey @philipp-spiess I don't have the write access to resolve the conflict. |
@Momilijaz96 You should be able to update your forked repository. Try something like this in the terminal. If that doesn't work, I can look into it :)
|
Alright, i guess it's ready to be merged. |
@@ -0,0 +1,60 @@ | |||
import { ChatQuestion } from './chat-question' |
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.
Huh there seems to be a conflict here, this file was moved into the client/cody
folder on main
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.
I accidently merged current branch into main, I "undo" it and pushed again, I guess that would resolve this conflict.
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.
I think linting is failing on some files too, I can't see which ones though.
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.
This file still seems to be added instead. Is it okay if I push onto your branch to try and resolve this??
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.
yeah sure, go ahead
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.
Apparently my forked repo's main branch is a few commits ahead of the upstream's main. I am trying to fetch upstream and merge into my fork's main, but that is not introducing any changes.
Hey @philipp-spiess , Thanks for taking care of this. 👍 |
@Momilijaz96 All done from your end 🎉 I’m just working on getting CI to pass before I can merge this 🙂 |
@Momilijaz96 There appears to be a bug in our CI setup right now, I've asked internally for some advice. I'll have this PR bookmarked though and will continue to look into it 🙇 |
No worries, Sounds good. |
Y'all we did it! 🎉 @Momilijaz96 @mrnugget |
Great 💯 |
This is a fantastic addition, great work @Momilijaz96! And thank you @mrnugget @philipp-spiess for reviewing it. |
## Test plan Tested the feature locally by running Cody from "Run and Debug" option of VSCode; with different DSA algorithms in python and general DS/ML based applications and projects. The recipe suggests good code optimizationsto improve memory and time optimizations. --------- Co-authored-by: Philipp Spiess <hello@philippspiess.com>
Test plan
Tested the feature locally by running Cody from "Run and Debug" option of VSCode; with different DSA algorithms in python and general DS/ML based applications and projects. The recipe suggests good code optimizationsto improve memory and time optimizations.