Skip to content

Commit

Permalink
Rename enum cases
Browse files Browse the repository at this point in the history
  • Loading branch information
raulraja committed Jun 29, 2023
1 parent bd097c0 commit ef1c24c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class CoreAIScope(
}

suspend fun buildChatRequest(): ChatCompletionRequest {
val messages: List<Message> = listOf(Message(Role.system.name, promptWithContext))
val messages: List<Message> = listOf(Message(Role.SYSTEM.name, promptWithContext))
return ChatCompletionRequest(
model = model.name,
user = user,
Expand All @@ -268,7 +268,7 @@ class CoreAIScope(
}

suspend fun chatWithFunctionsRequest(): ChatCompletionRequestWithFunctions {
val role: String = Role.user.name
val role: String = Role.USER.name
val firstFnName: String? = functions.firstOrNull()?.name
val messages: List<Message> = listOf(Message(role, promptWithContext))
return ChatCompletionRequestWithFunctions(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package com.xebia.functional.xef.llm.models.chat

data class Message(val role: String, val content: String?, val name: String? = Role.assistant.name)
data class Message(val role: String, val content: String?, val name: String? = Role.ASSISTANT.name)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ data class MessageWithFunctionCall(
val role: String,
val content: String? = null,
val functionCall: FunctionCall?,
val name: String? = Role.assistant.name
val name: String? = Role.ASSISTANT.name
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.xebia.functional.xef.llm.models.chat

enum class Role {
system,
user,
assistant,
function
SYSTEM,
USER,
ASSISTANT,
FUNCTION
}

0 comments on commit ef1c24c

Please sign in to comment.