File size: 562 Bytes
877add7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""SFT dataset helpers."""

from __future__ import annotations

from app.common.types import CandidateAction, PolyGuardState


def build_sft_example(state: PolyGuardState, candidates: list[CandidateAction], target_candidate_id: str) -> dict:
    return {
        "prompt": {
            "patient_id": state.patient.patient_id,
            "medications": [m.model_dump(mode="json") for m in state.patient.medications],
            "candidates": [c.model_dump(mode="json") for c in candidates],
        },
        "target_candidate_id": target_candidate_id,
    }