gepa-ts
Version:
TypeScript implementation of GEPA (Gradient-free Evolution of Prompts and Agents) - Complete port with 100% feature parity
36 lines • 1.53 kB
JavaScript
export class GEPAResult {
bestCandidate;
bestScore;
allCandidates;
allScores;
paretoFrontCandidates;
bestOutputs;
totalEvaluations;
constructor(bestCandidate, bestScore, allCandidates, allScores, paretoFrontCandidates, totalEvaluations, bestOutputs) {
this.bestCandidate = bestCandidate;
this.bestScore = bestScore;
this.allCandidates = allCandidates;
this.allScores = allScores;
this.paretoFrontCandidates = paretoFrontCandidates;
this.totalEvaluations = totalEvaluations;
this.bestOutputs = bestOutputs;
}
static fromState(state) {
const bestIdx = state.programFullScoresValSet.indexOf(Math.max(...state.programFullScoresValSet));
const bestOutputs = state.trackBestOutputs ?
state.programOutputsValSet[bestIdx] : undefined;
return new GEPAResult(state.programs[bestIdx], state.programFullScoresValSet[bestIdx], state.programs, state.programFullScoresValSet, state.programAtParetoFrontValset, state.totalNumEvals, bestOutputs);
}
toJSON() {
return {
bestCandidate: this.bestCandidate,
bestScore: this.bestScore,
totalEvaluations: this.totalEvaluations,
numCandidatesEvaluated: this.allCandidates.length,
paretoFrontSize: this.paretoFrontCandidates.length,
scoreImprovement: this.bestScore - (this.allScores[0] || 0),
bestOutputs: this.bestOutputs
};
}
}
//# sourceMappingURL=result.js.map