Skip to content

Commit 0a10b1e

Browse files
committed
Fix java tests compillation
1 parent 1b0b48b commit 0a10b1e

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

agents/agents-core/src/jvmTest/java/ai/koog/agents/core/agent/JavaAPIAgentBuilderJavaTest.java

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,24 @@
2626
public class JavaAPIAgentBuilderJavaTest {
2727

2828
private static AIAgentConfig baseConfig() {
29-
return new AIAgentConfig(
30-
Prompt.builder("id")
31-
.system("system")
32-
.user("user")
33-
.assistant("assistant")
34-
.user("user")
35-
.assistant("assistant")
36-
.toolCall("id-1", "tool-1", "args-1")
37-
.toolResult("id-1", "tool-1", "result-1")
38-
.toolCall("id-2", "tool-2", "args-2")
39-
.toolResult("id-2", "tool-2", "result-2")
40-
.build(),
41-
OpenAIModels.Chat.GPT4_1,
42-
100,
43-
Executors.newSingleThreadExecutor(),
44-
Executors.newSingleThreadExecutor()
45-
);
29+
return AIAgentConfig.builder(OpenAIModels.Chat.GPT4_1)
30+
.prompt(
31+
Prompt.builder("id")
32+
.system("system")
33+
.user("user")
34+
.assistant("assistant")
35+
.user("user")
36+
.assistant("assistant")
37+
.toolCall("id-1", "tool-1", "args-1")
38+
.toolResult("id-1", "tool-1", "result-1")
39+
.toolCall("id-2", "tool-2", "args-2")
40+
.toolResult("id-2", "tool-2", "result-2")
41+
.build()
42+
)
43+
.maxAgentIterations(100)
44+
.llmRequestExecutorService(Executors.newSingleThreadExecutor())
45+
.strategyExecutorService(Executors.newSingleThreadExecutor())
46+
.build();
4647
}
4748

4849
@Test
@@ -80,7 +81,12 @@ public void testFunctionalStrategyWithLambda() {
8081

8182
var agent = AIAgent.builder()
8283
.promptExecutor(executor)
83-
.agentConfig(new AIAgentConfig(Prompt.builder("p").user("hi").build(), OpenAIModels.Chat.GPT4o, 3))
84+
.agentConfig(
85+
AIAgentConfig.builder(OpenAIModels.Chat.GPT4o)
86+
.prompt(Prompt.builder("p").user("hi").build())
87+
.maxAgentIterations(3)
88+
.build()
89+
)
8490
.functionalStrategy("myStrategy", (AIAgentFunctionalContext context, String userInput) -> {
8591
// just echo last LLM answer to ensure the pipeline works
8692
Message.Response resp = context.requestLLM(userInput);
@@ -124,7 +130,12 @@ public void testFunctionalStrategyWithClass() {
124130

125131
var agent = AIAgent.builder()
126132
.promptExecutor(executor)
127-
.agentConfig(new AIAgentConfig(Prompt.builder("p").user("hi").build(), OpenAIModels.Chat.GPT4o, 3))
133+
.agentConfig(
134+
AIAgentConfig.builder(OpenAIModels.Chat.GPT4o)
135+
.prompt(Prompt.builder("p").user("hi").build())
136+
.maxAgentIterations(3)
137+
.build()
138+
)
128139
.functionalStrategy(new MyJavaStrategy())
129140
.build();
130141

0 commit comments

Comments
 (0)