refactor(sampler): replace family_spec param with level+constraint
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -181,10 +181,11 @@ class TestSampleMaterialV2:
|
||||
rng = random.Random(42)
|
||||
result = sample_material_v2(
|
||||
tree=real_tree,
|
||||
family_spec=RETRIEVAL_FAMILY,
|
||||
task_type="Action Reasoning",
|
||||
used_node_ids=set(),
|
||||
rng=rng,
|
||||
level=2,
|
||||
constraint=RETRIEVAL_FAMILY.sampling,
|
||||
)
|
||||
|
||||
assert isinstance(result, MaterialContext)
|
||||
@@ -213,10 +214,11 @@ class TestSampleMaterialV2:
|
||||
|
||||
result = sample_material_v2(
|
||||
tree=real_tree,
|
||||
family_spec=RETRIEVAL_FAMILY,
|
||||
task_type="Action Reasoning",
|
||||
used_node_ids=used,
|
||||
rng=rng,
|
||||
level=2,
|
||||
constraint=RETRIEVAL_FAMILY.sampling,
|
||||
)
|
||||
|
||||
# 锚节点应该是那个未被排除的 L2
|
||||
@@ -233,10 +235,11 @@ class TestSampleMaterialV2:
|
||||
with pytest.raises(RuntimeError, match="max_attempts"):
|
||||
sample_material_v2(
|
||||
tree=sparse_tree,
|
||||
family_spec=VISUAL_FAMILY,
|
||||
task_type="Object Recognition",
|
||||
used_node_ids=set(),
|
||||
rng=rng,
|
||||
level=3,
|
||||
constraint=VISUAL_FAMILY.sampling,
|
||||
max_attempts=3,
|
||||
)
|
||||
|
||||
@@ -248,10 +251,11 @@ class TestSampleMaterialV2:
|
||||
|
||||
result = sample_material_v2(
|
||||
tree=real_tree,
|
||||
family_spec=REASONING_FAMILY,
|
||||
task_type="Causal Reasoning",
|
||||
task_type="Action Reasoning",
|
||||
used_node_ids=set(),
|
||||
rng=rng,
|
||||
level=2,
|
||||
constraint=REASONING_FAMILY.sampling,
|
||||
)
|
||||
|
||||
# cross_l2_span=True 时必须有跨 L2 文本
|
||||
@@ -265,10 +269,11 @@ class TestSampleMaterialV2:
|
||||
|
||||
result = sample_material_v2(
|
||||
tree=real_tree,
|
||||
family_spec=RETRIEVAL_FAMILY,
|
||||
task_type="Action Reasoning",
|
||||
used_node_ids=set(),
|
||||
rng=rng,
|
||||
level=2,
|
||||
constraint=RETRIEVAL_FAMILY.sampling,
|
||||
)
|
||||
|
||||
# real_tree 所有节点都有字幕,所以 subtitle_sentences 非空
|
||||
|
||||
Reference in New Issue
Block a user