Package dev.dokimos.core.conversation
Class ConversationSimulator
java.lang.Object
dev.dokimos.core.conversation.ConversationSimulator
Orchestrates multi-turn conversations between a simulated user and an
application.
The simulator manages turn-taking, enforces turn limits, handles stopping conditions, and captures the complete interaction trajectory for evaluation.
Example usage:
ConversationSimulator simulator = ConversationSimulator.builder()
.simulatedUser(UserPersonas.aggressiveCustomer(judgeLM))
.application(myApp)
.maxTurns(10)
.scenario("Handle product return request")
.initialMessage("I want to return this defective product!")
.build();
ConversationTrajectory trajectory = simulator.simulate();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructing conversation simulators. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder for constructing a conversation simulator.simulate()Runs the conversation simulation.Runs the conversation simulation asynchronously using the common fork-join pool.simulateAsync(ExecutorService executor) Runs the conversation simulation asynchronously using the provided executor.
-
Method Details
-
builder
Creates a new builder for constructing a conversation simulator.- Returns:
- a new builder
-
simulate
Runs the conversation simulation.The simulation proceeds as follows:
- If an initial message is provided, it starts the conversation
- Otherwise, the simulated user generates the first message
- The application responds to each user message
- The simulated user generates the next message based on the response
- This continues until maxTurns is reached or stoppingCondition returns true
- Returns:
- the complete conversation trajectory
-
simulateAsync
Runs the conversation simulation asynchronously using the common fork-join pool.- Returns:
- a CompletableFuture that will complete with the trajectory
-
simulateAsync
Runs the conversation simulation asynchronously using the provided executor.- Parameters:
executor- the executor to use for async execution- Returns:
- a CompletableFuture that will complete with the trajectory
-