Skip to main content
LangSmith는 범주형 및 수치형 메트릭을 모두 지원하며, 사용자 정의 평가자를 작성할 때 둘 중 하나를 반환할 수 있습니다. 평가자 결과를 수치형 메트릭으로 기록하려면 다음과 같이 반환해야 합니다:
  • (Python 전용) int, float, 또는 bool
  • {"key": "metric_name", "score": int | float | bool} 형태의 dict
평가자 결과를 범주형 메트릭으로 기록하려면 다음과 같이 반환해야 합니다:
  • (Python 전용) str
  • {"key": "metric_name", "value": str | int | float | bool} 형태의 dict
다음은 몇 가지 예시입니다:
  • Python: langsmith>=0.2.0 필요
  • TypeScript: 다중 점수 지원은 [email protected] 이상에서 사용 가능
def numerical_metric(inputs: dict, outputs: dict, reference_outputs: dict) -> float:
    # 평가 로직...
    return 0.8
    # 또는
    # return {"score": 0.8}
    # 또는
    # return {"key": "numerical_metric", "score": 0.8}

def categorical_metric(inputs: dict, outputs: dict, reference_outputs: dict) -> str:
    # 평가 로직...
    return "english"
    # 또는
    # return {"key": "categorical_metric", "score": "english"}
    # 또는
    # return {"score": "english"}

관련 문서


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