본문으로 건너뛰기

빠른 점검

Quick Checks는 일반적인 어설션을 위한 LLM이 없는 구성 가능한 마이크로 점수 측정기입니다. 그들은 기존에 연결scorers: [...]득점자가 사용되는 모든 곳의 배열:runEvals, 라이브 채점, 실험 및 Studio.

내부적으로는 표준 createScorer() 인스턴스이므로 다른 채점기와 동일한 Observability, 스토리지 및 파이프라인 통합 기능을 제공합니다.

사용예
사용예에 대한 직접 링크

src/evals/weather-checks.ts
import { checks } from '@mastra/evals/checks'
import { runEvals } from '@mastra/core/evals'
import { myAgent } from '../agents'

const result = await runEvals({
data: [{ input: 'What is the weather in Brooklyn?' }],
target: myAgent,
scorers: [
checks.includes('sunny'),
checks.calledTool('get_weather'),
checks.toolOrder(['get_weather', 'summarize']),
checks.noToolErrors(),
],
})

console.log(result.scores)

텍스트 확인
텍스트 확인에 대한 직접 링크

checks.includes(expected, options?)
checksincludesexpected-options에 대한 직접 링크

Agent의 출력 텍스트에 예상된 하위 문자열이 포함되어 있으면 1점을 받고, 그렇지 않으면 0점을 얻습니다.

checks.includes('sunny')
checks.includes('Sunny', { ignoreCase: false })

expected:

string
출력에서 검색할 부분 문자열입니다.

options.ignoreCase?:

boolean
= true
대소문자를 구분하지 않는 일치입니다.

반환값: 발견되면 1, 그렇지 않으면 0입니다.

checks.excludes(unwanted, options?)
checksexcludesunwanted-options에 대한 직접 링크

Agent의 출력 텍스트에 하위 문자열이 포함되어 있지 않으면 1점을 받고, 그렇지 않으면 0점을 얻습니다.

checks.excludes('error')
checks.excludes('Error', { ignoreCase: false })

unwanted:

string
출력에 나타나서는 안 되는 부분 문자열입니다.

options.ignoreCase?:

boolean
= true
대소문자를 구분하지 않는 일치입니다.

반환값: 없으면 1, 그렇지 않으면 0입니다.

checks.equals(expected, options?)
checksequalsexpected-options에 대한 직접 링크

선택적 정규화 후 출력 텍스트가 예상 문자열과 정확히 일치하면 1점을 얻습니다.

checks.equals('Hello, world!')
checks.equals('Hello', { ignoreCase: false })

expected:

string
출력과 정확히 일치해야 하는 문자열입니다.

options.ignoreCase?:

boolean
= true
대소문자를 구분하지 않는 일치입니다.

반환값: 같으면 1, 그렇지 않으면 0입니다.

checks.matches(pattern, options?)
checksmatchespattern-options에 대한 직접 링크

출력이 정규식과 일치하면 1점을 얻습니다.

checks.matches(/\d+°[FC]/)
checks.matches(/^hello$/, { exact: true })

pattern:

RegExp
출력에 대해 테스트할 정규 표현식입니다.

options.exact?:

boolean
= false
전체 출력과 일치하도록 패턴을 앵커링합니다(^ 및 $ 추가).

반환값: 일치하면 1, 그렇지 않으면 0입니다.

checks.similarity(expected, options?)
checkssimilarityexpected-options에 대한 직접 링크

Dice 계수를 사용하여 출력과 예상 문자열 사이의 문자열 유사성 점수(0~1)를 반환합니다. threshold가 설정되면 대신 이진 값 1/0을 반환합니다.

checks.similarity('Sunny, 72°F')
checks.similarity('Sunny, 72°F', { threshold: 0.7 })

expected:

string
비교할 기준 문자열입니다.

options.threshold?:

number
1을 반환하기 위한 최소 유사성 점수입니다(0~1). 생략하면 원시 유사성 점수를 반환합니다.

options.ignoreCase?:

boolean
= true
대소문자를 구분하지 않는 비교입니다.

반환값: 원시 유사성 점수(0~1) 또는 threshold가 설정된 경우 이진 값 1/0입니다.

Tool 호출 확인
Tool 호출 확인에 대한 직접 링크

checks.calledTool(toolName, options?)
checkscalledtooltoolname-options에 대한 직접 링크

Agent가 지정된 Tool을 필요한 횟수 이상 호출하면 1점을 얻습니다.

checks.calledTool('get_weather')
checks.calledTool('search', { times: 2 })

toolName:

string
찾을 Tool의 이름입니다.

options.times?:

number
= 1
Tool이 호출되어야 하는 최소 횟수입니다.

반환값: times회 이상 호출되면 1, 그렇지 않으면 0입니다.

checks.didNotCall(toolName)
checksdidnotcalltoolname에 대한 직접 링크

Agent가 지정된 Tool을 호출하지 않은 경우 1점을 얻습니다.

checks.didNotCall('delete_user')

toolName:

string
나타나서는 안 되는 Tool의 이름입니다.

반환값: Tool이 호출되지 않았으면 1, 그렇지 않으면 0입니다.

checks.toolOrder(expectedOrder)
checkstoolorderexpectedorder에 대한 직접 링크

Tool이 지정된 순서로 호출되면 1점을 얻습니다. 편안한 매칭을 사용합니다. 예상되는 Tool 간의 다른 Tool 호출이 허용됩니다.

checks.toolOrder(['search', 'summarize', 'respond'])

expectedOrder:

string[]
예상 호출 순서의 Tool 이름입니다. 실제 Tool 호출의 부분 수열로 나타나야 합니다.

반환값: 예상 순서를 충족하면 1, 그렇지 않으면 0입니다.

checks.maxToolCalls(max)
checksmaxtoolcallsmax에 대한 직접 링크

Agent가 다음 이상을 사용하지 않은 경우 1점을 얻습니다.max tool calls.

checks.maxToolCalls(5)

max:

number
허용되는 최대 Tool 호출 횟수입니다.

반환값: 제한 이내이면 1, 그렇지 않으면 0입니다.

checks.usedNoTools()
checksusednotools에 대한 직접 링크

Agent가 Tool 호출을 전혀 하지 않은 경우 1점을 얻습니다.

checks.usedNoTools()

반환값: 호출된 Tool이 없으면 1, 그렇지 않으면 0입니다.

checks.noToolErrors()
checksnotoolerrors에 대한 직접 링크

어떤 Tool 호출에서도 오류 상태가 발생하지 않으면 1점을 얻습니다. 오류 결과(result.error가 있음)와 완료되지 않은 Tool 호출(state === 'call')을 모두 감지합니다.

checks.noToolErrors()

반환값: 모든 Tool 호출이 성공하면 1, 그렇지 않으면 0입니다.

다른 채점자와 수표 결합
다른 채점자와 수표 결합에 대한 직접 링크

동일한 LLM 기반 및 코드 기반 채점자를 사용하여 구성을 확인합니다.scorers array:

src/evals/combined-eval.ts
import { checks } from '@mastra/evals/checks'
import { createAnswerRelevancyScorer } from '@mastra/evals/scorers/prebuilt'
import { runEvals } from '@mastra/core/evals'
import { myAgent } from '../agents'

const result = await runEvals({
data: [{ input: 'What is the weather in Brooklyn?' }],
target: myAgent,
scorers: [
// Zero-LLM checks
checks.includes('Brooklyn'),
checks.calledTool('get_weather'),
checks.noToolErrors(),
// LLM-based scorer
createAnswerRelevancyScorer({ model: 'openai/gpt-5-mini' }),
],
})