Skip to content

Commit 028a335

Browse files
committed
test(ollama): only check response is always the same with seed=0
1 parent 923f51d commit 028a335

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

integration-tests/src/jvmTest/kotlin/ai/koog/integration/tests/OllamaClientIntegrationTest.kt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ class OllamaClientIntegrationTest {
5757
user("What is the capital of France?")
5858
}
5959

60-
val response = executor.execute(prompt = prompt, model = model)
60+
val firstResponse = executor.execute(prompt = prompt, model = model)
6161

62-
assertTrue(response.content.isNotEmpty(), "Response should not be empty")
63-
assertEquals("The capital of France is Paris.", response.content)
62+
assertTrue(firstResponse.content.isNotEmpty(), "Response should not be empty")
63+
assertTrue(firstResponse.content.contains("Paris"), "Response should contain 'Paris'")
64+
65+
val secondResponse = executor.execute(prompt = prompt, model = model)
66+
67+
assertEquals(firstResponse.content, secondResponse.content)
6468
}
6569

6670
@Test
@@ -268,7 +272,10 @@ class OllamaClientIntegrationTest {
268272

269273
@Serializable
270274
enum class CalculatorOperation {
271-
ADD, SUBTRACT, MULTIPLY, DIVIDE
275+
ADD,
276+
SUBTRACT,
277+
MULTIPLY,
278+
DIVIDE
272279
}
273280

274281
@Test
@@ -459,7 +466,7 @@ class OllamaClientIntegrationTest {
459466
val name: String,
460467
val capital: String,
461468
val population: String,
462-
val language: String
469+
val language: String,
463470
)
464471

465472
fun markdownCountryDefinition(): String {
@@ -501,7 +508,7 @@ class OllamaClientIntegrationTest {
501508
class MarkdownParser(
502509
private val headerHandler: ((String) -> Unit)?,
503510
private val bulletHandler: ((String) -> Unit)?,
504-
private val finishHandler: (() -> Unit)?
511+
private val finishHandler: (() -> Unit)?,
505512
) {
506513
suspend fun parseStream(stream: Flow<String>) {
507514
val buffer = kotlin.text.StringBuilder()

0 commit comments

Comments
 (0)