This commit is contained in:
@@ -49,6 +49,7 @@ class GenerateTrainingDataTests(unittest.TestCase):
|
||||
"sdg_host": None,
|
||||
"sdg_user": None,
|
||||
"sdg_key": None,
|
||||
"sdg_model_alias": "nvidia-text",
|
||||
"num_records": 1000,
|
||||
"timestamp": 1234567890,
|
||||
}
|
||||
@@ -120,6 +121,58 @@ class GenerateTrainingDataTests(unittest.TestCase):
|
||||
"training-data/module_controller_intents_123",
|
||||
)
|
||||
|
||||
def test_data_designer_config_declares_structured_expansion(self):
|
||||
config = bridge.data_designer_config(
|
||||
dataset_key="module_controller_intents_123",
|
||||
generated_at=123,
|
||||
remote_seed="/tmp/seed.jsonl",
|
||||
action_ids=["logger"],
|
||||
model_alias="nvidia-text",
|
||||
)
|
||||
self.assertIn("load_config_builder", config)
|
||||
self.assertIn('column_type="llm-structured"', config)
|
||||
self.assertIn('model_alias="nvidia-text"', config)
|
||||
self.assertIn("expanded_record", config)
|
||||
|
||||
def test_remote_data_designer_command_sources_mimir_env(self):
|
||||
command = bridge.remote_data_designer_create_command(
|
||||
remote_config="/tmp/controller.py",
|
||||
num_records=42,
|
||||
dataset_key="module_controller_intents_123",
|
||||
artifact_path="/tmp/artifacts",
|
||||
)
|
||||
self.assertIn(bridge.MIMIR_DATA_DESIGNER_ENV, command)
|
||||
self.assertIn(bridge.MIMIR_DATA_DESIGNER_BIN, command)
|
||||
self.assertIn("--num-records 42", command)
|
||||
self.assertIn("--no-tui", command)
|
||||
|
||||
def test_remote_bash_command_quotes_inner_command(self):
|
||||
command = bridge.remote_bash_command("set -a; echo ready")
|
||||
self.assertTrue(command.startswith("bash -lc "))
|
||||
self.assertIn("'set -a; echo ready'", command)
|
||||
|
||||
def test_normalize_expanded_jsonl_extracts_expanded_record(self):
|
||||
raw = self.root / "expanded.raw.jsonl"
|
||||
normalized = self.root / "expanded.jsonl"
|
||||
source_row = {
|
||||
"expanded_record": {
|
||||
"instruction": bridge.INSTRUCTION,
|
||||
"input": "record this message",
|
||||
"output": json.dumps({"action_id": "logger", "payload": {"message": "hello"}}),
|
||||
"metadata": {
|
||||
"action_id": "logger",
|
||||
"source": "data_designer",
|
||||
"split": "train",
|
||||
"generated_at": 123,
|
||||
},
|
||||
}
|
||||
}
|
||||
bridge.write_jsonl(raw, [source_row])
|
||||
bridge.normalize_expanded_jsonl(raw, normalized)
|
||||
rows = bridge.read_jsonl(normalized)
|
||||
self.assertEqual(len(rows), 1)
|
||||
self.assertEqual(rows[0]["metadata"]["action_id"], "logger")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user