때때로 custom evaluator 또는 summary evaluator가 여러 메트릭을 반환하는 것이 유용할 수 있습니다. 예를 들어, LLM judge에 의해 여러 메트릭이 생성되는 경우, 여러 번의 LLM 호출을 하는 대신 여러 메트릭을 생성하는 단일 LLM 호출을 수행하여 시간과 비용을 절약할 수 있습니다. Python SDK를 사용하여 여러 점수를 반환하려면, 다음 형식의 dictionary/object 리스트를 반환하면 됩니다:
[
    # 'key' is the metric name
    # 'score' is the value of a numerical metric
    {"key": string, "score": number},
    # 'value' is the value of a categorical metric
    {"key": string, "value": string},
    ... # You may log as many as you wish
]
JS/TS SDK에서 이를 수행하려면, ‘results’ 키를 가진 object를 반환하고 위와 같은 형식의 리스트를 포함시키면 됩니다
{results: [{ key: string, score: number }, ...]};
이러한 각 dictionary는 feedback fields 중 일부 또는 전부를 포함할 수 있습니다. 자세한 내용은 링크된 문서를 확인하세요. 예시:
  • Python: langsmith>=0.2.0 필요
  • TypeScript: 여러 점수에 대한 지원은 [email protected] 이상에서 사용 가능합니다
def multiple_scores(outputs: dict, reference_outputs: dict) -> list[dict]:
    # Replace with real evaluation logic.
    precision = 0.8
    recall = 0.9
    f1 = 0.85
    return [
        {"key": "precision", "score": precision},
        {"key": "recall", "score": recall},
        {"key": "f1", "score": f1},
    ]
결과 experiment의 행에는 각 점수가 표시됩니다. multiple_scores.png

관련 항목


Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I