Skip to content

Commit

Permalink
feat(BE-215): ollama fim api support
Browse files Browse the repository at this point in the history
 - add missing ut
  • Loading branch information
hanrw committed Jun 19, 2024
1 parent 4a5a8a3 commit 2c2c780
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,47 @@ import org.junit.jupiter.api.Test

class CompletionTest {

@Test
fun `should return dummy completion`() {
val completion = Completion.dummy()

with(completion) {
assertEquals("id", id)
assertEquals(0, created)
assertEquals("model", model)
assertEquals("systemFingerprint", systemFingerprint)
assertEquals("object", `object`)
assertNotNull(usage)
}
}

@Test
fun `should return completion with required fields`() {
val completion = Completion(
id = "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
choices = listOf(
CompletionChoice(
text = "\n\nThis is indeed a test",
index = 0
)
),
created = 1589478378,
model = "gpt-3.5-turbo-instruct"
)

with(completion) {
assertEquals("cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", id)
assertEquals(1589478378, created)
assertEquals("gpt-3.5-turbo-instruct", model)
assertEquals(1, choices.size)
assertEquals("\n\nThis is indeed a test", choices[0].text)
assertEquals(0, choices[0].index)
assertEquals("", choices[0].finishReason)
assertNull(choices[0].logprobs)
assertNull(usage)
}
}

@Test
fun `should return completion`() {
val completionJson = """
Expand Down

0 comments on commit 2c2c780

Please sign in to comment.