Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object ChatChunkRequestResponseData {

case class Choices(
delta: Delta,
finishReason: Option[String],
finishReason: Option[String] = None,
index: Int
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ object ChatChunkFixture {
| "system_fingerprint": "systemFingerprint",
| "choices": [
| {
| "delta": {
| "content": "..."
| },
| "index": 0
| },
| {
| "delta": {
| "role": "assistant",
| "content": " Hi",
Expand All @@ -140,7 +146,7 @@ object ChatChunkFixture {
| ]
| },
| "finish_reason": "stop",
| "index": 0
| "index": 1
| }
| ]
|}""".stripMargin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,31 @@ class ChatChunkDataSpec extends AnyFlatSpec with Matchers with EitherValues {
// given
val jsonResponse = fixtures.ChatChunkFixture.jsonResponse

val delta: Delta = Delta(
role = Some(Role.Assistant),
content = Some(" Hi"),
toolCalls = toolCalls
)

val choices: Choices = Choices(
delta = delta,
finishReason = Some("stop"),
index = 0
val choices = Seq(
Choices(
delta = Delta(
content = Some("...")
),
finishReason = None,
index = 0
),
Choices(
delta = Delta(
role = Some(Role.Assistant),
content = Some(" Hi"),
toolCalls = toolCalls
),
finishReason = Some("stop"),
index = 1
)
)

val expectedResponse: ChatChunkResponse = ChatChunkResponse(
id = "chatcmpl-76FxnKOjnPkDVYTAQ1wK8iUNFJPvR",
`object` = "chat.completion",
created = 1681725687,
model = "gpt-3.5-turbo-0301",
choices = Seq(choices),
choices = choices,
systemFingerprint = Some("systemFingerprint")
)

Expand Down