Synthesizing Interactions
Module for generating multi-turn dialogues between a student and tutor agent using large language models.
This class wraps backend-specific model interfaces and orchestrates the simulation of conversations between two agents. It supports customizable educational modes and sampling behavior and ensures reproducibility via global seeding. Outputs are returned as structured pandas DataFrames.
Attributes:
Name | Type | Description |
---|---|---|
backend |
str
|
Backend to use for inference. Options are "hf" (Hugging Face) or "mlx" (MLX). |
model_id |
str
|
The identifier of the model to use, e.g., "gpt2" (Hugging Face) or "Qwen2.5-7B-Instruct-1M-4bit" (MLX). |
sampling_params |
Optional[dict]
|
Sampling hyperparameters such as temperature, top_p, or top_k. |
Methods:
Name | Description |
---|---|
simulate_dialogue |
Simulates a dialogue and returns it as a pandas DataFrame. |
Source code in src/educhateval/core.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
simulate_dialogue(mode='general_task_solving', turns=5, seed_message_input="Hi, I'm a student seeking assistance with my studies.", log_dir=None, save_csv_path=None, seed=42, custom_prompt_file=None, system_prompts=None)
Simulates a multi-turn dialogue using either built-in or custom prompts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Mode key to select prompt pair (student/tutor). |
'general_task_solving'
|
turns
|
int
|
Number of back-and-forth turns to simulate. |
5
|
seed_message_input
|
str
|
First message from the student. |
"Hi, I'm a student seeking assistance with my studies."
|
log_dir
|
Optional[Path]
|
Directory to save raw log (optional). |
None
|
save_csv_path
|
Optional[Path]
|
Path to save structured DataFrame (optional). |
None
|
seed
|
int
|
Random seed for reproducibility. |
42
|
custom_prompt_file
|
Optional[Path]
|
Optional path to custom YAML defining prompt modes. |
None
|
system_prompts
|
Optional[dict]
|
Optional dictionary of custom dict of prompt modes. |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: Structured DataFrame of the conversation. |
Source code in src/educhateval/core.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|