EvaluationLogger
provides a flexible, incremental way to log evaluation data directly from your Python code. You don’t need deep knowledge of Weave’s internal data types; simply instantiate a logger and use its methods (log_prediction
, log_score
, log_summary
) to record evaluation steps.
이 접근 방식은 전체 데이터셋이나 모든 평가 도구가 미리 정의되지 않을 수 있는 복잡한 워크플로우에서 특히 유용합니다.
미리 정의된 Evaluation
object, which requires a predefined Dataset
and list of Scorer
objects, the EvaluationLogger
allows you to log individual predictions and their associated scores incrementally as they become available.
더 구조화된 평가를 선호하시나요?미리 정의된 데이터셋과 평가 도구가 있는 더 체계적인 평가 프레임워크를 선호하신다면, Weave’s standard Evaluation framework를 참조하세요.The
EvaluationLogger
offers flexibility while the standard framework offers structure and guidance.기본 워크플로우
- 로거 초기화: Create an instance of
EvaluationLogger
, optionally providing metadata about themodel
anddataset
. Defaults will be used if omitted. :::important 토큰 사용량 및 비용 추적 LLM 호출(예: OpenAI)에 대한 토큰 사용량과 비용을 캡처하려면,EvaluationLogger
before any LLM invocations**. LLM을 먼저 호출한 다음 나중에 예측을 로깅하면 토큰 및 비용 데이터가 캡처되지 않습니다. ::: - 예측 로깅: Call
log_prediction
for each input/output pair from your system. - 점수 로깅: Use the returned
ScoreLogger
tolog_score
for the prediction. Multiple scores per prediction are supported. - 예측 완료: Always call
finish()
after logging scores for a prediction to finalize it. - 요약 로깅: After all predictions are processed, call
log_summary
to aggregate scores and add optional custom metrics.
예측에 대해
finish()
를 호출한 후에는 해당 예측에 대한 점수를 더 이상 로깅할 수 없습니다.기본 예제
다음 예제는EvaluationLogger
를 사용하여 기존 Python 코드에서 예측과 점수를 인라인으로 로깅하는 방법을 보여줍니다.
The user_model
model function is defined and applied to a list of inputs. For each example:
- 입력과 출력은
log_prediction
를 사용하여 로깅됩니다. - 간단한 정확도 점수(
correctness_score
)는log_score
를 통해 로깅됩니다. finish()
는 해당 예측에 대한 로깅을 완료합니다. 마지막으로,log_summary
는 집계 메트릭을 기록하고 Weave에서 자동 점수 요약을 트리거합니다.
고급 사용법
로깅 전 출력 가져오기
먼저 모델 출력을 계산한 다음 별도로 예측과 점수를 로깅할 수 있습니다. 이를 통해 평가 로직과 로깅 로직을 더 잘 분리할 수 있습니다.풍부한 미디어 로깅
입력, 출력 및 점수에는 이미지, 비디오, 오디오 또는 구조화된 테이블과 같은 풍부한 미디어가 포함될 수 있습니다. 딕셔너리나 미디어 객체를log_prediction
or log_score
methods:
여러 평가 로깅 및 비교
WithEvaluationLogger
, you can log and compare multiple evaluations.
- 아래 표시된 코드 샘플을 실행하세요.
- Weave UI에서
Evals
탭으로 이동하세요. - 비교하려는 평가를 선택하세요.
- Click the Compare 버튼을 클릭하세요. 비교 보기에서 다음을 수행할 수 있습니다:
- 추가하거나 제거할 평가 선택
- 표시하거나 숨길 메트릭 선택
- 특정 예제를 페이지별로 살펴보며 다른 모델이 주어진 데이터셋에서 동일한 입력에 대해 어떻게 수행되었는지 확인 비교에 대한 자세한 내용은 Comparisons


사용 팁
- 각 예측 후 즉시
finish()
를 호출하세요. - Use
log_summary
를 사용하여 단일 예측에 연결되지 않은 메트릭(예: 전체 지연 시간)을 캡처하세요. - 풍부한 미디어 로깅은 정성적 분석에 탁월합니다.