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 @@ -648,7 +648,10 @@ protected Mono<Msg> summarizing() {
postEvent -> {
Msg finalMsg =
postEvent
.getSummaryMessage();
.getSummaryMessage()
.withGenerateReason(
GenerateReason
.MAX_ITERATIONS);
memory.addMessage(finalMsg);
return finalMsg;
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.agentscope.core.agent.test.TestUtils;
import io.agentscope.core.memory.InMemoryMemory;
import io.agentscope.core.message.ContentBlock;
import io.agentscope.core.message.GenerateReason;
import io.agentscope.core.message.Msg;
import io.agentscope.core.message.MsgRole;
import io.agentscope.core.message.TextBlock;
Expand Down Expand Up @@ -476,9 +477,13 @@ void testMaxIterations() {

// Get response with timeout
// Verify it completes within reasonable time (not infinite loop)
agent.call(userMsg)
.timeout(Duration.ofMillis(TestConstants.DEFAULT_TEST_TIMEOUT_MS))
.block(Duration.ofMillis(TestConstants.DEFAULT_TEST_TIMEOUT_MS));
Msg response =
agent.call(userMsg)
.timeout(Duration.ofMillis(TestConstants.DEFAULT_TEST_TIMEOUT_MS))
.block(Duration.ofMillis(TestConstants.DEFAULT_TEST_TIMEOUT_MS));

// Verify max iterations generate reason was respected
assertEquals(GenerateReason.MAX_ITERATIONS, response.getGenerateReason());

// Verify max iterations was respected
assertTrue(
Expand Down
Loading