@@ -4,14 +4,17 @@ import ai.koog.agents.core.tools.ToolDescriptor
4
4
import ai.koog.agents.core.tools.ToolParameterDescriptor
5
5
import ai.koog.agents.core.tools.ToolParameterType
6
6
import ai.koog.prompt.dsl.Prompt
7
+ import ai.koog.prompt.executor.llms.SingleLLMPromptExecutor
7
8
import ai.koog.prompt.executor.model.PromptExecutorExt.execute
9
+ import ai.koog.prompt.executor.ollama.client.OllamaClient
8
10
import kotlinx.coroutines.flow.Flow
9
11
import kotlinx.coroutines.flow.flow
10
12
import kotlinx.coroutines.test.runTest
11
13
import kotlinx.serialization.Serializable
12
14
import org.junit.jupiter.api.Disabled
13
15
import org.junit.jupiter.api.extension.ExtendWith
14
16
import kotlin.test.Test
17
+ import kotlin.test.assertEquals
15
18
import kotlin.test.assertTrue
16
19
import kotlin.time.Duration.Companion.seconds
17
20
@@ -20,6 +23,7 @@ class OllamaClientIntegrationTest {
20
23
companion object {
21
24
@field:InjectOllamaTestFixture
22
25
private lateinit var fixture: OllamaTestFixture
26
+ private val baseUrl get() = fixture.baseUrl
23
27
private val executor get() = fixture.executor
24
28
private val model get() = fixture.model
25
29
}
@@ -37,6 +41,30 @@ class OllamaClientIntegrationTest {
37
41
assertTrue(response.content.contains(" Paris" ), " Response should contain 'Paris'" )
38
42
}
39
43
44
+ @Test
45
+ fun `ollama_test execute simple prompt with options` () = runTest(timeout = 600 .seconds) {
46
+ // Create a custom client
47
+ val client = OllamaClient (
48
+ baseUrl = baseUrl,
49
+ requestBuilderAction = { _, _ ->
50
+ seed = 0
51
+ numCtx = 100
52
+ numPredict = 10
53
+ },
54
+ )
55
+ val executor = SingleLLMPromptExecutor (client)
56
+
57
+ val prompt = Prompt .build(" test-with-options" ) {
58
+ system(" You are a helpful assistant." )
59
+ user(" What is the capital of France?" )
60
+ }
61
+
62
+ val response = executor.execute(prompt = prompt, model = model)
63
+
64
+ assertTrue(response.content.isNotEmpty(), " Response should not be empty" )
65
+ assertEquals(" The capital of France is Paris." , response.content)
66
+ }
67
+
40
68
@Test
41
69
fun `ollama_test execute tools with required parameters` () = runTest(timeout = 600 .seconds) {
42
70
val searchTool = ToolDescriptor (
@@ -607,4 +635,4 @@ class OllamaClientIntegrationTest {
607
635
println ()
608
636
}
609
637
}
610
- }
638
+ }
0 commit comments