LLMTestCase 클래스

Dahun Yoo·2026년 8월 1일

Deep Eval

목록 보기
2/9
post-thumbnail

이번 포스트에서는 LLMTestCase 에 대해 간략한 설명을 기재한다.

LLMTestCase ?

A single-turn test case is a blueprint provided by deepeval to unit test LLM outputs, and represents a single, atomic unit of interaction with your LLM app.

https://deepeval.com/docs/evaluation-test-cases#llm-test-cases

DeepEval에서는 테스트케이스의 형태에 대해 크게 2가지로 나눈다.

  • single-turn : 단답형으로 떨어지는 형태
  • multi-turn : 대화를 이어나가며 소위 "핑퐁" 하며 llm과 대화하는 형태

기본적인 테스트케이스는 LLMTestCase 로 테스트케이스를 관리할 수 있다. multi-turn의 경우는 ConversationalTestCase 를 사용한다.

간단한 예시

from deepeval.test_case import LLMTestCase, ToolCall

test_case = LLMTestCase(
    input="What if these shoes don't fit?",
    expected_output="You're eligible for a 30 day refund at no extra cost.",
    actual_output="We offer a 30-day full refund at no extra cost.",
    context=["All customers are eligible for a 30 day full refund at no extra cost."],
    retrieval_context=["Only shoes can be refunded."],
    tools_called=[ToolCall(name="WebSearch")]
)

위 LLMTestCase 클래스가, 하나의 테스트케이스 형태이다.

필드쉬운 의미언제 결정되는가?
input앱에 넣을 질문평가 전에 준비
expected_output좋은 답변의 예시평가 전에 준비
context정답으로 신뢰할 수 있는 공식 근거평가 전에 준비
expected_tools에이전트가 사용해야 하는 도구평가 전에 준비
actual_output앱이 실제 생성한 답변앱 실행 후 관찰
retrieval_context검색기가 실제 가져온 문서앱 실행 후 관찰
tools_called에이전트가 실제 호출한 도구앱 실행 후 관찰

파라미터는 RAG가 제대로 된 근거로부터 답변을 가져오는지 확인할 수 있는 retrieval_context 나, 에이전트가 어떤 도구를 호출했는지를 확인할 수 있는 tools_called 파라미터도 있다.

이 LLMTestCase 자체로 무언가를 할 수 있는 것은 아니고, 다시 평가지표 와 함께 실제로 assertion을 실행시켜야한다.

고민해야할 점

당연할 수도 있겠지만, 테스트케이스나 기대결과, 컨텍스트의 체계적인 관리가 중요해진다. 몇천개 정도의 레벨로 가면 재사용하는 값들이 있을텐데 그것들을 어떻게 관리하는지가 관리부하를 줄일 수 있을 것이다.

profile
QA Engineer

0개의 댓글