JetBrains-Research / TestSpark

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

Closed Vladislav0Art closed 1 week ago

Vladislav0Art commented 3 weeks ago

Description

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

  1. It makes the code more robust and less prone to errors.
  2. It eases the maintenance and increases readability.