File size: 696 Bytes
48c27bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from models import classifier, judge


def llm_workflow(old_revision, new_revision, mode="aligned-fewshot"):
    """
    Run LLM workflow (input to response)

    Args:
        mode: "aligned-fewshot" for few-shot alignment or "aligned-heuristic" for heuristic alignment
    """

    # Run classifier and judge models
    heuristic = classifier(old_revision, new_revision, "heuristic")
    few_shot = classifier(old_revision, new_revision, "few-shot")
    judge_response = judge(
        old_revision,
        new_revision,
        heuristic["rationale"],
        few_shot["rationale"],
        mode=mode,
    )

    return {"heuristic": heuristic, "few-shot": few_shot, "judge": judge_response}