Skip to content

Commit

Permalink
fix: use node inspect to handle object types when running reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
dschlabach committed Dec 7, 2024
1 parent 13d64da commit 16ca83e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions packages/evalite/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { appendEvalsToJsonDb, type Evalite } from "@evalite/core";
import { table } from "table";
import c from "tinyrainbow";
import { average, sum } from "./utils.js";
import { inspect } from "util";

export interface EvaliteReporterOptions {
jsonDbLocation: string;
Expand Down Expand Up @@ -230,12 +231,26 @@ export default class EvaliteReporter extends BasicReporter {
c.cyan(c.bold("Output")),
c.cyan(c.bold("Score")),
],
...props.map((p) => [p.input, p.output, displayScore(p.score)]),
...props.map((p) => [
inspect(p.input, {
colors: true,
depth: null,
breakLength: colWidth,
compact: true,
}),
inspect(p.output, {
colors: true,
depth: null,
breakLength: colWidth,
compact: true,
}),
displayScore(p.score),
]),
],
{
columns: [
{ width: colWidth, wrapWord: true },
{ width: colWidth, wrapWord: true },
{ width: colWidth, wrapWord: false },
{ width: colWidth, wrapWord: false },
{ width: scoreWidth },
],
}
Expand Down

0 comments on commit 16ca83e

Please sign in to comment.