Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

418 B
Raw Blame
import { Transform, type TransformCallback } from "stream";
import { stringify } from "../../../utils/stringify";

export function transformStreamToJsonl(): Transform {
  return new Transform({
    objectMode: true,

    transform(
      row: Record<string, any>,
      encoding: BufferEncoding,
      callback: TransformCallback,
    ): void {
      this.push(stringify(row) + "\n");
      callback();
    },
  });
}