Skip to content

Commit 4f6b9ee

Browse files
committed
updated docs
1 parent d511647 commit 4f6b9ee

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

docs/content/docs/conversation-simulator-stopping-logic.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Only define the arguments your controller needs. `deepeval` will pass supported
5353

5454
- [Optional] `turns`: the current list of `Turn`s in the simulation.
5555
- [Optional] `golden`: the `ConversationalGolden` being simulated.
56-
- [Optional] `index`: the index of the golden being simulated.
56+
- [Optional] `index`: the index of the turn being simulated.
5757
- [Optional] `thread_id`: the unique thread ID for the simulated conversation.
5858
- [Optional] `simulated_user_turns`: the number of new simulated user turns generated so far.
5959
- [Optional] `max_user_simulations`: the maximum number of user-assistant message cycles allowed.
@@ -65,11 +65,14 @@ Only define the arguments your controller needs. `deepeval` will pass supported
6565
If your controller returns anything other than `proceed()` or `end()`, `deepeval` treats it the same as `proceed()`. This is useful when you only want to explicitly handle terminal states:
6666

6767
```python
68-
from deepeval.simulator.controller import end
68+
import random
69+
from deepeval.simulator.controller import end, proceed
6970

70-
def controller(last_assistant_turn):
71-
if last_assistant_turn and "refund processed" in last_assistant_turn.content.lower():
72-
return end(reason="Refund flow completed")
71+
def controller():
72+
if random.random() > 0.5:
73+
return end(reason="Random early stop")
74+
75+
return proceed()
7376
```
7477

7578
Your controller can return:

0 commit comments

Comments
 (0)