from dataclasses import dataclass
from autoblocks.testing.models import BaseTestCase
from autoblocks.testing.models import HumanReviewField
from autoblocks.testing.models import HumanReviewFieldContentType
from autoblocks.testing.run import RunManager
from autoblocks.testing.util import md5
# Update with your test case type
@dataclass
class TestCase(BaseTestCase):
input: str
def serialize_for_human_review(self) -> list[HumanReviewField]:
return [
HumanReviewField(
name="Input",
value=self.input,
content_type=HumanReviewFieldContentType.TEXT,
),
]
def hash(self) -> str:
return md5(self.input)
# Update with your output type
@dataclass
class Output:
output: str
def serialize_for_human_review(self) -> list[HumanReviewField]:
return [
HumanReviewField(
name="Output",
value=self.output,
content_type=HumanReviewFieldContentType.TEXT,
),
]
run = RunManager[TestCase, Output](
test_id="test-id",
)
run.start()
# Add results from your test suite here
run.add_result(
test_case=TestCase(input="Hello, world!"),
output=Output(output="Hi, world!"),
)
run.end()
run.create_human_review_job(
assignee_email_address="${emailAddress}",
name="Review for accuracy",
)