sttp.openai.requests.completions.chat.ChatRequestResponseData.scala Maven / Gradle / Ivy
package sttp.openai.requests.completions.chat
import sttp.openai.json.SnakePickle
import sttp.openai.requests.completions.Usage
object ChatRequestResponseData {
/** @param role
* The role of the author of this message.
* @param content
* The contents of the message.
* @param functionCall
* The name and arguments of a function that should be called, as generated by the model.
*/
case class Message(role: Role, content: String, toolCalls: Seq[ToolCall] = Nil, functionCall: Option[FunctionCall] = None)
object Message {
implicit val messageRW: SnakePickle.Reader[Message] = SnakePickle.macroR[Message]
}
case class Choices(
message: Message,
finishReason: String,
index: Int
)
object Choices {
implicit val choicesR: SnakePickle.Reader[Choices] = SnakePickle.macroR[Choices]
}
case class ChatResponse(
id: String,
choices: Seq[Choices],
created: Int,
model: String,
`object`: String,
usage: Usage,
systemFingerprint: Option[String] = None
)
object ChatResponse {
implicit val chatResponseR: SnakePickle.Reader[ChatResponse] = SnakePickle.macroR[ChatResponse]
}
}