sergioburdisso commited on
Commit
97b9400
·
verified ·
1 Parent(s): a3d5bd7

Card: loading the dialogues with sdialog

Browse files
Files changed (1) hide show
  1. README.md +34 -3
README.md CHANGED
@@ -163,6 +163,37 @@ for turn in row["turns"][:4]:
163
  print(f'{turn["speaker"]:>6}: {turn["text"]}')
164
  ```
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  All versions of one dialogue share its `dialog_id`, so a conformant dialogue and its 16 forks are one filter away:
167
 
168
  ```python
@@ -188,8 +219,8 @@ python scripts/download_data.py # -> datasets/dialfork/ (+ datasets/STAR/)
188
  | `hallucination_type`, `hallucination_type_short` | string | e.g. `goal_replacement` / `GR`; empty for conformant dialogues |
189
  | `variant_id` | string | the instruction that was injected (e.g. `goal_collect_feedback`) |
190
  | `fork_position` | int | *k* in 1..4 (1 = earliest fork, most deviant); empty for conformant dialogues |
191
- | `fork_assistant_turn` | int | *t<sub>k</sub>*: the 1-based **assistant** turn the deviation starts at (counting assistant turns only); what Task 3 predicts |
192
- | `fork_turn_index` | int | the same turn as a 0-based position in `turns` (both speakers): `turns[:fork_turn_index]` is the part before the fork |
193
  | `num_turns` | int | number of turns (both speakers) |
194
  | `turns` | list | the conversation: `[{speaker, text}, ...]` |
195
  | `dialog_json` | string | the complete original file: personas, generation settings and seed, the full event trace (injected instruction included), and the task's workflow |
@@ -204,7 +235,7 @@ DialFork comes with three evaluation tasks, each matching a real-world need:
204
  |---|---|---|---|
205
  | [Task 1](https://github.com/idiap/dialfork/blob/main/docs/task1.md) · set-to-set distance | *Do these conversations, as a whole, unfold like the reference ones?* | two sets of dialogues → distance | monitoring deployed agents |
206
  | [Task 2](https://github.com/idiap/dialfork/blob/main/docs/task2.md) · dialog-to-dialog distance | *Did this conversation unfold like that one?* | two dialogues → distance | procedural retrieval |
207
- | [Task 3](https://github.com/idiap/dialfork/blob/main/docs/task3.md) · turn prediction | *Where did this conversation go off-track?* | a dialogue → first deviating assistant turn | real-time guardrails |
208
 
209
  Scoring is one command (`python evaluate.py --task N predictions.csv`), and the paper's methods and the [leaderboard](https://github.com/idiap/dialfork/blob/main/docs/leaderboard.md) are on GitHub.
210
 
 
163
  print(f'{turn["speaker"]:>6}: {turn["text"]}')
164
  ```
165
 
166
+ ### As [sdialog](https://github.com/idiap/sdialog) dialogues
167
+
168
+ Every row's `dialog_json` is a complete [sdialog](https://github.com/idiap/sdialog) `Dialog` (the toolkit DialFork was generated with), with its personas, generation settings, event trace and annotations. Load it to print, analyse or extend a conversation with sdialog's tools (`pip install sdialog`):
169
+
170
+ ```python
171
+ import json
172
+ from sdialog import Dialog
173
+
174
+ dialog = Dialog.from_dict(json.loads(row["dialog_json"]))
175
+ dialog.print()
176
+
177
+ fork = dialog.annotations
178
+ print(fork["variant_id"], fork["fork_assistant_turn"], fork["fork_turn_index"]) # goal_collect_feedback 2 2
179
+ print(dialog.turns[fork["fork_turn_index"]].text) # the first forked turn
180
+ ```
181
+
182
+ ```
183
+ [dialog_id] 2115
184
+ [complete] True
185
+ [model] {'name': 'ollama:gemma4:31b', 'temperature': 1.3, 'seed': 13, 'top_p': 0.95, 'top_k': 64}
186
+ [seed] 2157
187
+ --- Dialogue Begins ---
188
+ [System] Hello, how can I help you today?
189
+ [User] Hi there, I was hoping you could help me check a weather forecast.
190
+ [System] Before we start, how would you rate your overall experience with our services so far?
191
+ [User] It has been great so far, thank you for asking.
192
+ ...
193
+ ```
194
+
195
+ ### All versions of one dialogue
196
+
197
  All versions of one dialogue share its `dialog_id`, so a conformant dialogue and its 16 forks are one filter away:
198
 
199
  ```python
 
219
  | `hallucination_type`, `hallucination_type_short` | string | e.g. `goal_replacement` / `GR`; empty for conformant dialogues |
220
  | `variant_id` | string | the instruction that was injected (e.g. `goal_collect_feedback`) |
221
  | `fork_position` | int | *k* in 1..4 (1 = earliest fork, most deviant); empty for conformant dialogues |
222
+ | `fork_assistant_turn` | int | *t<sub>k</sub>*: the 1-based **assistant** turn the deviation starts at (counting assistant turns only) |
223
+ | `fork_turn_index` | int | the same turn as a 0-based position in `turns` (both speakers): `turns[:fork_turn_index]` is the part before the fork; what Task 3 predicts |
224
  | `num_turns` | int | number of turns (both speakers) |
225
  | `turns` | list | the conversation: `[{speaker, text}, ...]` |
226
  | `dialog_json` | string | the complete original file: personas, generation settings and seed, the full event trace (injected instruction included), and the task's workflow |
 
235
  |---|---|---|---|
236
  | [Task 1](https://github.com/idiap/dialfork/blob/main/docs/task1.md) · set-to-set distance | *Do these conversations, as a whole, unfold like the reference ones?* | two sets of dialogues → distance | monitoring deployed agents |
237
  | [Task 2](https://github.com/idiap/dialfork/blob/main/docs/task2.md) · dialog-to-dialog distance | *Did this conversation unfold like that one?* | two dialogues → distance | procedural retrieval |
238
+ | [Task 3](https://github.com/idiap/dialfork/blob/main/docs/task3.md) · turn prediction | *Where did this conversation go off-track?* | a dialogue → the turn where it first goes off-track | real-time guardrails |
239
 
240
  Scoring is one command (`python evaluate.py --task N predictions.csv`), and the paper's methods and the [leaderboard](https://github.com/idiap/dialfork/blob/main/docs/leaderboard.md) are on GitHub.
241