Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sshivaditya committed Dec 13, 2024
1 parent dd39b3b commit cfe8c4d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions evals/llm.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const baseContext: Partial<Context> = {
octokit: new Octokit({ auth: process.env.GITHUB_TOKEN }),
};

export const main = async () => {
export async function main() {
const result = await Eval<EvalInput, EvalOutput, string, void, void>(
"Command Ask LLM",
{
Expand Down Expand Up @@ -178,18 +178,18 @@ export const main = async () => {
const metrics = result.summary.metrics || {};

// Helper function to format diff with arrow
const formatDiff = (value: number | undefined, isTime = false) => {
function formatDiff(value: number | undefined, isTime = false) {
if (value === undefined) return "-";
const arrow = value > 0 ? "↑" : "↓";
const formatted = isTime ? Math.abs(value).toFixed(2) + "s" : Math.abs(value).toFixed(4);
return `${arrow} ${formatted}`;
};
}

// Helper function to get status emoji
const getStatus = (regressions: number | undefined) => {
function getStatus(regressions: number | undefined) {
if (regressions === undefined) return "❓";
return regressions > 0 ? "⚠️" : "✅";
};
}

// Write results as markdown table
const markdown = `## Evaluation Results
Expand All @@ -201,6 +201,6 @@ export const main = async () => {
| Duration | ${metrics.duration?.metric.toFixed(2) || "-"}s | ${formatDiff(metrics.duration?.diff, true)} | ${getStatus(metrics.duration?.regressions)} |
| Cost | $${metrics.estimated_cost?.metric.toFixed(6) || "-"} | ${formatDiff(metrics.estimated_cost?.diff)} | ${getStatus(metrics.estimated_cost?.regressions)} |`;
writeFileSync("eval-results.md", markdown);
};
}

void main();

0 comments on commit cfe8c4d

Please sign in to comment.