-
Notifications
You must be signed in to change notification settings - Fork 20
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
Compilation update #46
Conversation
|
||
// Asking LLM to generate test. Here, we have a loop to make feedback cycle for LLm in case of wrong responses. | ||
while (!generatedTestsArePassing) { | ||
log.info("New iterations of requests") | ||
|
||
if (processStopped(project, indicator)) return | ||
|
||
if (requestsCount >= maxRequests) { | ||
if (isLastIteration(requestsCount) && project.service<Workspace>().testGenerationData.compilableTestCases.isEmpty()) { |
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.
What about the tests that are generated in the last request? In this case, the last request which is saved in line 196, will be ignored.
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.
Fixed loop:
- checking for the last iteration
- request with the updated prompt
- if some error → update the prompt && continue
- else → save result from the request in this iteration
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.
If the maximum number of requests are set to 1, the loop will show invalidGrazieResult
without sending any request. This is because at the beginning of the loop, the number of requests will be increased to 1 and isLastIteration
checks whether the number of requests is greater equal to the maximum number of requests (here 1). I think to solve this issue, the isLastItteration
method should be changed to:
private fun isLastIteration(requestsCount: Int) = requestsCount > maxRequests
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.
fixed
|
||
// check is .class file exists | ||
if (File(classFilePath).exists()) { | ||
project.service<Workspace>().testGenerationData.compilableTestCases.add(testCases[index]) |
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.
When you send feedback, LLM will print the whole test file again. So, it is possible that we have some duplicate in compilable tests
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.
Also, we only add test cases here. We need to check if they are still compilable with the final test suite body of the test file (with imports and mocking-related annotations).
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 checked it, because each test case is in a separate file. I created them here: https://github.com/JetBrains-Research/TestGenie/pull/46/files/0a67016bc734ba460ee0d79ba8e836b35ae04ade#diff-87db339e5713928f5d39e84379b8955a6a684be4aef50c12171fc981e823f2c6R236
And I avoid duplicates, because this is a set of test cases 🙂
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.
Looks good. Thanks 👍
Description of changes made
Saving correct test cases during the incorrect common result