TestSpark - a plugin for generating unit tests. TestSpark natively integrates different AI-based test generation tools and techniques in the IDE. Started by SERG TU Delft. Currently under implementation by JetBrains Research (ICTL) for research purposes.
MIT License
35
stars
9
forks
source link
Make the role of a sender within the `ChatMessage` be an enum type #261
Within org.jetbrains.research.testspark.core.generation.llm.network.RequestManager class we have a field named chatHistory of type MutableList<org.jetbrains.research.testspark.core.data.ChatMessage>; this ChatMessage contains a field role: String which is assumed to be either "user" or "assistant".
What should be done
Change the type of the ChatMessage.role from String to the enum type Role where Role is:
enum class Role {
USER,
ASSISTANT,
}
Why it is helpful
It makes the code more robust and less prone to errors.
It eases the maintenance and increases readability.
Description
Within
org.jetbrains.research.testspark.core.generation.llm.network.RequestManager
class we have a field namedchatHistory
of typeMutableList<org.jetbrains.research.testspark.core.data.ChatMessage>
; thisChatMessage
contains a fieldrole: String
which is assumed to be either"user"
or"assistant"
.What should be done
Change the type of the
ChatMessage.role
fromString
to the enum typeRole
whereRole
is:Why it is helpful