MCPcopy Create free account
hub / github.com/astercloud/aster / runSingleTestCase

Function runSingleTestCase

pkg/evals/batch.go:154–174  ·  view source on GitHub ↗

runSingleTestCase 运行单个测试用例的所有评分器

(ctx context.Context, testCase *BatchTestCase, scorers []Scorer)

Source from the content-addressed store, hash-verified

152
153// runSingleTestCase 运行单个测试用例的所有评分器
154func runSingleTestCase(ctx context.Context, testCase *BatchTestCase, scorers []Scorer) *BatchResult {
155 startTime := time.Now()
156
157 result := &BatchResult{
158 TestCaseID: testCase.ID,
159 Scores: make([]*ScoreResult, 0, len(scorers)),
160 Metadata: testCase.Metadata,
161 }
162
163 for _, scorer := range scorers {
164 score, err := scorer.Score(ctx, testCase.Input)
165 if err != nil {
166 result.Error = fmt.Sprintf("scorer error: %v", err)
167 break
168 }
169 result.Scores = append(result.Scores, score)
170 }
171
172 result.Duration = time.Since(startTime)
173 return result
174}
175
176// calculateSummary 计算汇总统计
177func calculateSummary(results []*BatchResult) *BatchSummary {

Callers 1

RunBatchFunction · 0.85

Calls 1

ScoreMethod · 0.65

Tested by

no test coverage detected