DERBACH/latent-rubric / tests /test_interventions.py
DERBACH's picture
download
raw
868 Bytes
import pytest
from intervention.verify import classify
from intervention.prompts import generation_messages,verification_messages
from intervention.generate import parse_json
def test_direction_strict_filters():
x=dict(correctness=1,coherence=0,complexity=0,verbosity=0)
assert classify(x,0,1,'high')==(True,True,'accepted')
assert classify(x,0,-1,'high')==(False,False,'wrong_or_zero_target')
assert classify({**x,'verbosity':1},0,1,'high')==(True,False,'off_target_change')
assert classify(x,0,1,'low')==(True,False,'low_confidence')
with pytest.raises(AssertionError): classify({**x,'coherence':3},0,1,'high')
def test_verifier_blinded():
m=verification_messages('question','original','modified')
assert 'target' not in m[1]['content'] and 'direction' not in m[1]['content']
assert parse_json('```json\n{"a":1}\n```')=={'a':1}

Xet Storage Details

Size:
868 Bytes
·
Xet hash:
5a60e3ec48aba915f90af4f4ce34d295cb084beec2c344cb1f3a1a565a1211ff

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.