@lmnr-ai/lmnr 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/worker/index.cjs +2 -2
- package/dist/cli/worker/index.mjs +2 -2
- package/dist/cli.cjs +2 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/{decorators-CeehP1mt.cjs → decorators-D_61ettZ.cjs} +2 -2
- package/dist/{decorators-CeehP1mt.cjs.map → decorators-D_61ettZ.cjs.map} +1 -1
- package/dist/{decorators-BJhlVK7E.mjs → decorators-pvNDRRJD.mjs} +2 -2
- package/dist/{decorators-BJhlVK7E.mjs.map → decorators-pvNDRRJD.mjs.map} +1 -1
- package/dist/{dist-DymjawoS.cjs → dist-Bysv-rfd.cjs} +3 -3
- package/dist/{dist-DymjawoS.cjs.map → dist-Bysv-rfd.cjs.map} +1 -1
- package/dist/{dist-Dzv6_-6p.mjs → dist-ghfEJ89k.mjs} +3 -3
- package/dist/{dist-Dzv6_-6p.mjs.map → dist-ghfEJ89k.mjs.map} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +6 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('../../chunk-BrXtsOCC.cjs');
|
|
2
|
-
require('../../dist-
|
|
2
|
+
require('../../dist-Bysv-rfd.cjs');
|
|
3
3
|
require('../../utils-dnHn-Dz-.cjs');
|
|
4
|
-
const require_decorators = require('../../decorators-
|
|
4
|
+
const require_decorators = require('../../decorators-D_61ettZ.cjs');
|
|
5
5
|
const require_cli_worker_build = require('./build.cjs');
|
|
6
6
|
let readline = require("readline");
|
|
7
7
|
readline = require_chunk.__toESM(readline);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../dist-
|
|
1
|
+
import "../../dist-ghfEJ89k.mjs";
|
|
2
2
|
import "../../utils-nkOGZxcV.mjs";
|
|
3
|
-
import { l as Laminar, p as consumeStreamResult } from "../../decorators-
|
|
3
|
+
import { l as Laminar, p as consumeStreamResult } from "../../decorators-pvNDRRJD.mjs";
|
|
4
4
|
import { buildFile, loadModule, selectRolloutFunction } from "./build.mjs";
|
|
5
5
|
import * as readline from "readline";
|
|
6
6
|
|
package/dist/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-BrXtsOCC.cjs');
|
|
3
|
-
const require_dist = require('./dist-
|
|
3
|
+
const require_dist = require('./dist-Bysv-rfd.cjs');
|
|
4
4
|
const require_utils = require('./utils-dnHn-Dz-.cjs');
|
|
5
5
|
let path = require("path");
|
|
6
6
|
path = require_chunk.__toESM(path);
|
|
@@ -812,7 +812,7 @@ async function cli() {
|
|
|
812
812
|
});
|
|
813
813
|
});
|
|
814
814
|
program.command("dev").description("Start a rollout debugging session").argument("[file]", "Path to file containing the agent function(s)").allowExcessArguments(true).allowUnknownOption(true).action(() => {
|
|
815
|
-
console.error("\x1B[33m%s\x1B[0m", "\nThe 'lmnr dev' command has been moved to a separate package.\n\nPlease use:\n npx
|
|
815
|
+
console.error("\x1B[33m%s\x1B[0m", "\nThe 'lmnr dev' command has been moved to a separate package.\n\nPlease use:\n npx lmnr-cli@latest dev [file] [options]\n\n");
|
|
816
816
|
process.exit(1);
|
|
817
817
|
});
|
|
818
818
|
if (!process.argv.slice(2).length) {
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["y","logger","initializeLogger","collectedFiles: string[]","fs","parsed: any","results: any[]","result: Datapoint<D, T>[]","asString","generateCsv","mkConfig","logger","initializeLogger","result: Datapoint<D, T>[]","LaminarClient","logger","initializeLogger","__filename","__dirname","getDirname","evalFiles: string[]","scores: {\n file: string,\n scores: Record<string, number>,\n url: string,\n evaluationId: string,\n }[]","initializeLogger","Command","version"],"sources":["../../../node_modules/.pnpm/csv-parser@3.2.0/node_modules/csv-parser/index.js","../../../node_modules/.pnpm/export-to-csv@1.4.0/node_modules/export-to-csv/output/index.js","../src/cli/file-utils.ts","../src/cli/datasets.ts","../src/cli/evals.ts","../src/cli/index.ts"],"sourcesContent":["const { Transform } = require('stream')\n\nconst [cr] = Buffer.from('\\r')\nconst [nl] = Buffer.from('\\n')\nconst defaults = {\n escape: '\"',\n headers: null,\n mapHeaders: ({ header }) => header,\n mapValues: ({ value }) => value,\n newline: '\\n',\n quote: '\"',\n raw: false,\n separator: ',',\n skipComments: false,\n skipLines: null,\n maxRowBytes: Number.MAX_SAFE_INTEGER,\n strict: false,\n outputByteOffset: false\n}\n\nclass CsvParser extends Transform {\n constructor (opts = {}) {\n super({ objectMode: true, highWaterMark: 16 })\n\n if (Array.isArray(opts)) opts = { headers: opts }\n\n const options = Object.assign({}, defaults, opts)\n\n options.customNewline = options.newline !== defaults.newline\n\n for (const key of ['newline', 'quote', 'separator']) {\n if (typeof options[key] !== 'undefined') {\n ([options[key]] = Buffer.from(options[key]))\n }\n }\n\n // if escape is not defined on the passed options, use the end value of quote\n options.escape = (opts || {}).escape ? Buffer.from(options.escape)[0] : options.quote\n\n this.state = {\n empty: options.raw ? Buffer.alloc(0) : '',\n escaped: false,\n first: true,\n lineNumber: 0,\n previousEnd: 0,\n rowLength: 0,\n quoted: false\n }\n\n this._prev = null\n\n if (options.headers === false) {\n // enforce, as the column length check will fail if headers:false\n options.strict = false\n }\n\n if (options.headers || options.headers === false) {\n this.state.first = false\n }\n\n this.options = options\n this.headers = options.headers\n this.bytesRead = 0\n }\n\n parseCell (buffer, start, end) {\n const { escape, quote } = this.options\n // remove quotes from quoted cells\n if (buffer[start] === quote && buffer[end - 1] === quote) {\n start++\n end--\n }\n\n let y = start\n\n for (let i = start; i < end; i++) {\n // check for escape characters and skip them\n if (buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote) {\n i++\n }\n\n if (y !== i) {\n buffer[y] = buffer[i]\n }\n y++\n }\n\n return this.parseValue(buffer, start, y)\n }\n\n parseLine (buffer, start, end) {\n const { customNewline, escape, mapHeaders, mapValues, quote, separator, skipComments, skipLines } = this.options\n\n end-- // trim newline\n if (!customNewline && buffer.length && buffer[end - 1] === cr) {\n end--\n }\n\n const comma = separator\n const cells = []\n let isQuoted = false\n let offset = start\n\n if (skipComments) {\n const char = typeof skipComments === 'string' ? skipComments : '#'\n if (buffer[start] === Buffer.from(char)[0]) {\n return\n }\n }\n\n const mapValue = (value) => {\n if (this.state.first) {\n return value\n }\n\n const index = cells.length\n const header = this.headers[index]\n\n return mapValues({ header, index, value })\n }\n\n for (let i = start; i < end; i++) {\n const isStartingQuote = !isQuoted && buffer[i] === quote\n const isEndingQuote = isQuoted && buffer[i] === quote && i + 1 <= end && buffer[i + 1] === comma\n const isEscape = isQuoted && buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote\n\n if (isStartingQuote || isEndingQuote) {\n isQuoted = !isQuoted\n continue\n } else if (isEscape) {\n i++\n continue\n }\n\n if (buffer[i] === comma && !isQuoted) {\n let value = this.parseCell(buffer, offset, i)\n value = mapValue(value)\n cells.push(value)\n offset = i + 1\n }\n }\n\n if (offset < end) {\n let value = this.parseCell(buffer, offset, end)\n value = mapValue(value)\n cells.push(value)\n }\n\n if (buffer[end - 1] === comma) {\n cells.push(mapValue(this.state.empty))\n }\n\n const skip = skipLines && skipLines > this.state.lineNumber\n this.state.lineNumber++\n\n if (this.state.first && !skip) {\n this.state.first = false\n this.headers = cells.map((header, index) => mapHeaders({ header, index }))\n\n this.emit('headers', this.headers)\n return\n }\n\n if (!skip && this.options.strict && cells.length !== this.headers.length) {\n const e = new RangeError('Row length does not match headers')\n this.emit('error', e)\n } else {\n if (!skip) {\n const byteOffset = this.bytesRead - buffer.length + start\n this.writeRow(cells, byteOffset)\n }\n }\n }\n\n parseValue (buffer, start, end) {\n if (this.options.raw) {\n return buffer.slice(start, end)\n }\n\n return buffer.toString('utf-8', start, end)\n }\n\n writeRow (cells, byteOffset) {\n const headers = (this.headers === false) ? cells.map((value, index) => index) : this.headers\n\n const row = cells.reduce((o, cell, index) => {\n const header = headers[index]\n if (header === null) return o // skip columns\n if (header !== undefined) {\n o[header] = cell\n } else {\n o[`_${index}`] = cell\n }\n return o\n }, {})\n\n if (this.options.outputByteOffset) {\n this.push({ row, byteOffset })\n } else {\n this.push(row)\n }\n }\n\n _flush (cb) {\n if (this.state.escaped || !this._prev) return cb()\n this.parseLine(this._prev, this.state.previousEnd, this._prev.length + 1) // plus since online -1s\n cb()\n }\n\n _transform (data, enc, cb) {\n if (typeof data === 'string') {\n data = Buffer.from(data)\n }\n\n const { escape, quote } = this.options\n let start = 0\n let buffer = data\n this.bytesRead += data.byteLength\n\n if (this._prev) {\n start = this._prev.length\n buffer = Buffer.concat([this._prev, data])\n this._prev = null\n }\n\n const bufferLength = buffer.length\n\n for (let i = start; i < bufferLength; i++) {\n const chr = buffer[i]\n const nextChr = i + 1 < bufferLength ? buffer[i + 1] : null\n\n this.state.rowLength++\n if (this.state.rowLength > this.options.maxRowBytes) {\n return cb(new Error('Row exceeds the maximum size'))\n }\n\n if (!this.state.escaped && chr === escape && nextChr === quote && i !== start) {\n this.state.escaped = true\n continue\n } else if (chr === quote) {\n if (this.state.escaped) {\n this.state.escaped = false\n // non-escaped quote (quoting the cell)\n } else {\n this.state.quoted = !this.state.quoted\n }\n continue\n }\n\n if (!this.state.quoted) {\n if (this.state.first && !this.options.customNewline) {\n if (chr === nl) {\n this.options.newline = nl\n } else if (chr === cr) {\n if (nextChr !== nl) {\n this.options.newline = cr\n }\n }\n }\n\n if (chr === this.options.newline) {\n this.parseLine(buffer, this.state.previousEnd, i + 1)\n this.state.previousEnd = i + 1\n this.state.rowLength = 0\n }\n }\n }\n\n if (this.state.previousEnd === bufferLength) {\n this.state.previousEnd = 0\n return cb()\n }\n\n if (bufferLength - this.state.previousEnd < data.length) {\n this._prev = data\n this.state.previousEnd -= (bufferLength - data.length)\n return cb()\n }\n\n this._prev = buffer\n cb()\n }\n}\n\nmodule.exports = (opts) => new CsvParser(opts)\n","var q;(function(x){x[\"csv\"]=\"text/csv\";x[\"tsv\"]=\"text/tab-separated-values\";x[\"plain\"]=\"text/plain\"})(q||(q={}));var X=(W)=>W,z=(W)=>W,Z=X,_=X,Y=X,N=X,V=X;var h={fieldSeparator:\",\",decimalSeparator:\".\",quoteStrings:!0,quoteCharacter:'\"',showTitle:!1,title:\"My Generated Report\",filename:\"generated\",showColumnHeaders:!0,useTextFile:!1,fileExtension:\"csv\",mediaType:q.csv,useBom:!0,columnHeaders:[],useKeysAsHeaders:!1,boolDisplay:{true:\"TRUE\",false:\"FALSE\"},replaceUndefinedWith:\"\"},F=\"\\r\\n\",R=\"\\uFEFF\",G=(W)=>Object.assign({},h,W);class K extends Error{constructor(W){super(W);this.name=\"CsvGenerationError\"}}class B extends Error{constructor(W){super(W);this.name=\"EmptyHeadersError\"}}class L extends Error{constructor(W){super(W);this.name=\"CsvDownloadEnvironmentError\"}}class P extends Error{constructor(W){super(W);this.name=\"UnsupportedDataFormatError\"}}var s=function(W,$){if($=='\"'&&W.indexOf('\"')>-1)return W.replace(/\"/g,'\"\"');return W},w=(W)=>typeof W===\"object\"?N(W.key):N(W),y=(W)=>typeof W===\"object\"?V(W.displayLabel):V(W),T=(W,...$)=>$.reduce((j,x)=>x(j),W),E=(W)=>($)=>W.useBom?_(z($)+R):$,M=(W)=>($)=>W.showTitle?S(_(z($)+W.title))(Y(\"\")):$,S=(W)=>($)=>_(z(W)+z($)+F),O=(W)=>($,j)=>l(W)(Y(z($)+z(j))),l=(W)=>($)=>X(z($)+W.fieldSeparator),b=(W,$)=>(j)=>{if(!W.showColumnHeaders)return j;if($.length<1)throw new B(\"Option to show headers but none supplied. Make sure there are keys in your collection or that you've supplied headers through the config options.\");let x=Y(\"\");for(let A=0;A<$.length;A++){const J=y($[A]);x=O(W)(x,v(W,z(J)))}return x=Y(z(x).slice(0,-1)),S(j)(x)},C=(W,$,j)=>(x)=>{let A=x;for(var J=0;J<j.length;J++){let I=Y(\"\");for(let U=0;U<$.length;U++){const H=w($[U]),D=j[J][z(H)];I=O(W)(I,v(W,D))}I=Y(z(I).slice(0,-1)),A=S(A)(I)}return A},k=z,m=(W)=>+W===W&&(!isFinite(W)||Boolean(W%1)),p=(W,$)=>{if(m($)){if(W.decimalSeparator===\"locale\")return Z($.toLocaleString());if(W.decimalSeparator)return Z($.toString().replace(\".\",W.decimalSeparator))}return Z($.toString())},Q=(W,$)=>{let j=$;if(W.quoteStrings||W.fieldSeparator&&$.indexOf(W.fieldSeparator)>-1||W.quoteCharacter&&$.indexOf(W.quoteCharacter)>-1||$.indexOf(\"\\n\")>-1||$.indexOf(\"\\r\")>-1)j=W.quoteCharacter+s($,W.quoteCharacter)+W.quoteCharacter;return Z(j)},g=(W,$)=>{const j=$?\"true\":\"false\";return Z(W.boolDisplay[j])},r=(W,$)=>{if(typeof $===\"undefined\"&&W.replaceUndefinedWith!==void 0)return Q(W,W.replaceUndefinedWith+\"\");if($===null)return Q(W,\"null\");return Q(W,\"\")},v=(W,$)=>{if(typeof $===\"number\")return p(W,$);if(typeof $===\"string\")return Q(W,$);if(typeof $===\"boolean\"&&W.boolDisplay)return g(W,$);if($===null||typeof $===\"undefined\")return r(W,$);throw new P(`\n typeof ${typeof $} isn't supported. Only number, string, boolean, null and undefined are supported.\n Please convert the data in your object to one of those before generating the CSV.\n `)};var BW=(W)=>($)=>{const j=G(W),x=j.useKeysAsHeaders?Object.keys($[0]):j.columnHeaders;let A=T(_(\"\"),E(j),M(j),b(j,x),C(j,x,$));if(z(A).length<1)throw new K(\"Output is empty. Is your data formatted correctly?\");return A},f=(W)=>($)=>{const j=G(W),x=z($),A=j.useTextFile?\"text/plain\":j.mediaType;return new Blob([x],{type:`${A};charset=utf8;`})},LW=(W)=>($)=>{if(!window)throw new L(\"Downloading only supported in a browser environment.\");const j=f(W)($),x=G(W),A=x.useTextFile?\"txt\":x.fileExtension,J=`${x.filename}.${A}`,I=document.createElement(\"a\");I.download=J,I.href=URL.createObjectURL(j),I.setAttribute(\"visibility\",\"hidden\"),document.body.appendChild(I),I.click(),document.body.removeChild(I)};export{G as mkConfig,BW as generateCsv,LW as download,k as asString,f as asBlob,q as MediaType};\n","import csv from 'csv-parser';\nimport { asString, generateCsv, mkConfig } from 'export-to-csv';\nimport { createReadStream } from 'fs';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\n\nimport { Datapoint } from '../evaluations';\nimport { initializeLogger } from '../utils';\n\nconst logger = initializeLogger();\n\n/**\n * Check if a file has a supported extension.\n */\nconst isSupportedFile = (file: string): boolean => {\n const ext = path.extname(file).toLowerCase();\n return ['.json', '.csv', '.jsonl'].includes(ext);\n};\n\n/**\n * Collect all supported files from the given paths.\n * Handles both files and directories.\n */\nexport const collectFiles = async (\n paths: string[],\n recursive: boolean = false,\n): Promise<string[]> => {\n const collectedFiles: string[] = [];\n\n for (const filepath of paths) {\n try {\n const stats = await fs.stat(filepath);\n\n if (stats.isFile()) {\n if (isSupportedFile(filepath)) {\n collectedFiles.push(filepath);\n } else {\n logger.warn(`Skipping unsupported file type: ${filepath}`);\n }\n } else if (stats.isDirectory()) {\n const entries = await fs.readdir(filepath);\n\n for (const entry of entries) {\n const fullPath = path.join(filepath, entry);\n const entryStats = await fs.stat(fullPath);\n\n if (entryStats.isFile() && isSupportedFile(fullPath)) {\n collectedFiles.push(fullPath);\n } else if (recursive && entryStats.isDirectory()) {\n const subFiles = await collectFiles([fullPath], true);\n collectedFiles.push(...subFiles);\n }\n }\n }\n } catch (error) {\n logger.warn(\n `Path does not exist or is not accessible: ${filepath}. `\n + `Error: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n return collectedFiles;\n};\n\n/**\n * Read a JSON file and return its contents.\n */\nconst readJsonFile = async (filepath: string): Promise<any[]> => {\n const content = await fs.readFile(filepath, 'utf-8');\n const parsed = JSON.parse(content);\n return Array.isArray(parsed) ? parsed : [parsed];\n};\n\n/**\n * Try to parse a string as JSON. If it fails, return the original string.\n */\nconst tryParseJson = (content: string): any => {\n // Don't try to parse if it's not a string or doesn't look like JSON\n if (typeof content !== 'string') {\n return content;\n }\n\n // If it doesn't start with { or [, it's probably not JSON\n const trimmed = content.trim();\n if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {\n return content;\n }\n\n try {\n return JSON.parse(content);\n } catch (error) {\n logger.debug(\n `Error parsing JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n return content;\n }\n};\n\n/**\n * Parse each field in a CSV row, attempting to convert JSON strings back to objects.\n */\nconst parseCsvRow = (row: Record<string, string>): any => {\n const parsed: any = {};\n for (const [key, value] of Object.entries(row)) {\n parsed[key] = tryParseJson(value);\n }\n return parsed;\n};\n\n/**\n * Read a CSV file and return its contents as an array of objects.\n */\nconst readCsvFile = async (filepath: string): Promise<any[]> => new Promise((resolve, reject) => {\n const results: any[] = [];\n createReadStream(filepath)\n .pipe(csv())\n .on('data', (data) => results.push(parseCsvRow(data)))\n .on('end', () => resolve(results))\n .on('error', reject);\n});\n\n/**\n * Read a JSONL file and return its contents as an array of objects.\n */\nasync function readJsonlFile(filepath: string): Promise<any[]> {\n const content = await fs.readFile(filepath, 'utf-8');\n const lines = content.split('\\n').filter((line) => line.trim());\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return lines.map((line) => JSON.parse(line));\n}\n\n/**\n * Read a single file and return its contents.\n */\nasync function readFile(filepath: string): Promise<any[]> {\n const ext = path.extname(filepath).toLowerCase();\n\n if (ext === '.json') {\n return readJsonFile(filepath);\n } else if (ext === '.csv') {\n return readCsvFile(filepath);\n } else if (ext === '.jsonl') {\n return readJsonlFile(filepath);\n } else {\n throw new Error(`Unsupported file type: ${ext}`);\n }\n}\n\n/**\n * Load data from all files in the specified paths.\n */\nexport const loadFromPaths = async <D = any, T = any>(\n paths: string[],\n recursive: boolean = false,\n): Promise<Datapoint<D, T>[]> => {\n const files = await collectFiles(paths, recursive);\n\n if (files.length === 0) {\n logger.warn('No supported files found in the specified paths');\n return [];\n }\n\n logger.info(`Found ${files.length} file(s) to read`);\n\n const result: Datapoint<D, T>[] = [];\n\n for (const file of files) {\n try {\n const data = await readFile(file);\n result.push(...data);\n logger.info(`Read ${data.length} record(s) from ${file}`);\n } catch (error) {\n logger.error(\n `Error reading file ${file}: ${error instanceof Error ? error.message : String(error)}`,\n );\n throw error;\n }\n }\n\n return result;\n};\n\n/**\n * Write data to a JSON file.\n */\nconst writeJsonFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const content = JSON.stringify(data, null, 2);\n await fs.writeFile(filepath, content, 'utf-8');\n};\n\n/**\n * Write data to a CSV file.\n */\nconst writeCsvFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n if (data.length === 0) {\n throw new Error('No data to write to CSV');\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n\n await fs.writeFile(filepath, csvString, 'utf-8');\n};\n\n/**\n * Write data to a JSONL file.\n */\nconst writeJsonlFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const lines = data.map((item) => JSON.stringify(item)).join('\\n');\n await fs.writeFile(filepath, lines + '\\n', 'utf-8');\n};\n\n/**\n * Write data to a file based on the file extension.\n */\nexport const writeToFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n format?: 'json' | 'csv' | 'jsonl',\n): Promise<void> => {\n // Create parent directories if they don't exist\n const dir = path.dirname(filepath);\n await fs.mkdir(dir, { recursive: true });\n\n // Determine the format\n const ext = format ?? path.extname(filepath).slice(1);\n\n if (format && format !== path.extname(filepath).slice(1)) {\n logger.warn(\n `Output format ${format} does not match file extension ${path.extname(filepath).slice(1)}`,\n );\n }\n\n if (ext === 'json') {\n await writeJsonFile(filepath, data);\n } else if (ext === 'csv') {\n await writeCsvFile(filepath, data);\n } else if (ext === 'jsonl') {\n await writeJsonlFile(filepath, data);\n } else {\n throw new Error(`Unsupported output format: ${ext}`);\n }\n};\n\n/**\n * Convert a value to a CSV-safe string.\n * - Strings and numbers pass through\n * - null/undefined become empty strings\n * - Objects and arrays are stringified to JSON\n */\nconst stringifyForCsv = (value: any): string => {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n // For objects and arrays, stringify to JSON\n return JSON.stringify(value);\n};\n\n/**\n * Print data to console in the specified format.\n */\nexport const printToConsole = <D, T>(\n data: Datapoint<D, T>[],\n format: 'json' | 'csv' | 'jsonl' = 'json',\n) => {\n if (format === 'json') {\n console.log(JSON.stringify(data, null, 2));\n } else if (format === 'csv') {\n if (data.length === 0) {\n logger.error('No data to print');\n return;\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n console.log(csvString);\n } else if (format === 'jsonl') {\n data.forEach((item) => console.log(JSON.stringify(item)));\n } else {\n throw new Error(\n `Unsupported output format: ${String(format)}. `\n + \"(supported formats: json, csv, jsonl)\",\n );\n }\n};\n\n","import { LaminarClient } from \"@lmnr-ai/client\";\nimport { type StringUUID } from \"@lmnr-ai/types\";\n\nimport { Datapoint } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport { loadFromPaths, printToConsole, writeToFile } from \"./file-utils\";\n\nconst logger = initializeLogger();\nconst DEFAULT_DATASET_PULL_BATCH_SIZE = 100;\nconst DEFAULT_DATASET_PUSH_BATCH_SIZE = 100;\n\ninterface DatasetCommandOptions {\n projectApiKey?: string;\n baseUrl?: string;\n port?: number;\n}\n\n/**\n * Pull all data from a dataset in batches.\n */\nconst pullAllData = async <D = any, T = any>(\n client: LaminarClient,\n identifier: { name?: string; id?: StringUUID },\n batchSize: number = DEFAULT_DATASET_PULL_BATCH_SIZE,\n offset: number = 0,\n limit?: number,\n): Promise<Datapoint<D, T>[]> => {\n let hasMore = true;\n let currentOffset = offset;\n const stopAt = limit !== undefined ? offset + limit : undefined;\n\n const result: Datapoint<D, T>[] = [];\n\n while (hasMore && (stopAt === undefined || currentOffset < stopAt)) {\n const data = await client.datasets.pull<D, T>({\n ...identifier,\n offset: currentOffset,\n limit: batchSize,\n });\n\n result.push(...data.items);\n\n // Stop if we received no items or fewer items than requested (end of data)\n if (data.items.length === 0 || data.items.length < batchSize) {\n hasMore = false;\n } else if (stopAt !== undefined && currentOffset + batchSize >= stopAt) {\n hasMore = false;\n } else if (data.totalCount !== undefined && currentOffset + batchSize >= data.totalCount) {\n hasMore = false;\n }\n\n currentOffset += batchSize;\n }\n\n if (limit !== undefined) {\n return result.slice(0, limit);\n }\n\n return result;\n};\n\n/**\n * Handle datasets list command.\n */\nexport const handleDatasetsList = async (\n options: DatasetCommandOptions,\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n try {\n const datasets = await client.datasets.listDatasets();\n\n if (datasets.length === 0) {\n console.log(\"No datasets found.\");\n return;\n }\n\n // Print table header\n const idWidth = 36; // UUID length\n const createdAtWidth = 19; // YYYY-MM-DD HH:MM:SS format\n\n console.log(`\\n${'ID'.padEnd(idWidth)} ${'Created At'.padEnd(createdAtWidth)} Name`);\n console.log(`${'-'.repeat(idWidth)} ${'-'.repeat(createdAtWidth)} ${'-'.repeat(20)}`);\n\n // Print each dataset row\n for (const dataset of datasets) {\n const createdAt = new Date(dataset.createdAt);\n const createdAtStr = createdAt.toISOString().replace('T', ' ').substring(0, 19);\n console.log(\n `${dataset.id.padEnd(idWidth)} ${createdAtStr.padEnd(createdAtWidth)} ${dataset.name}`,\n );\n }\n\n console.log(`\\nTotal: ${datasets.length} dataset(s)\\n`);\n } catch (error) {\n logger.error(\n `Failed to list datasets: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets push command.\n */\nexport const handleDatasetsPush = async (\n paths: string[],\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n await client.datasets.push({\n points: data,\n ...identifier,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n });\n logger.info(`Pushed ${data.length} data points to dataset ${options.name || options.id}`);\n } catch (error) {\n logger.error(\n `Failed to push dataset: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets pull command.\n */\nexport const handleDatasetsPull = async (\n outputPath: string | undefined,\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n batchSize?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n const result = await pullAllData(\n client,\n identifier,\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n options.offset ?? 0,\n options.limit,\n );\n\n if (outputPath) {\n await writeToFile(outputPath, result, options.outputFormat);\n logger.info(`Successfully pulled ${result.length} data points to ${outputPath}`);\n } else {\n printToConsole(result, options.outputFormat ?? 'json');\n }\n } catch (error) {\n logger.error(\n `Failed to pull dataset: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets create command.\n */\nexport const handleDatasetsCreate = async (\n name: string,\n paths: string[],\n options: DatasetCommandOptions & {\n outputFile: string;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n // Load data from input files\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n // Push data to create/populate the dataset\n logger.info(`Pushing ${data.length} data points to dataset '${name}'...`);\n\n try {\n await client.datasets.push({\n points: data,\n name,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n createDataset: true,\n });\n logger.info(`Successfully pushed ${data.length} data points to dataset '${name}'`);\n } catch (error) {\n logger.error(\n `Failed to create dataset: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n\n // Pull data back from the dataset\n logger.info(`Pulling data from dataset '${name}'...`);\n\n try {\n const result = await pullAllData(\n client,\n { name },\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n 0,\n undefined,\n );\n\n // Save to output file\n await writeToFile(options.outputFile, result, options.outputFormat);\n\n logger.info(\n `Successfully created dataset '${name}' `\n + `and saved ${result.length} datapoints to ${options.outputFile}`,\n );\n } catch (error) {\n logger.error(\n \"Failed to pull dataset after creation: \"\n + `${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n","import * as esbuild from \"esbuild\";\nimport * as fs from \"fs\";\nimport * as glob from \"glob\";\n\nimport { Evaluation } from \"../evaluations\";\nimport { getDirname, initializeLogger } from \"../utils\";\n\nconst logger = initializeLogger();\n\n// esbuild plugin to skip dynamic imports\nconst createSkipDynamicImportsPlugin = (skipModules: string[]): esbuild.Plugin => ({\n name: 'skip-dynamic-imports',\n setup(build) {\n if (!skipModules || skipModules.length === 0) return;\n\n build.onResolve({ filter: /.*/ }, (args) => {\n // Only handle dynamic imports\n if (args.kind === 'dynamic-import' && skipModules.includes(args.path)) {\n logger.warn(`Skipping dynamic import: ${args.path}`);\n // Return a virtual module that exports an empty object\n return {\n path: args.path,\n namespace: 'lmnr-skip-dynamic-import',\n };\n }\n });\n\n // Provide empty module content for skipped dynamic imports\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n build.onLoad({ filter: /.*/, namespace: 'lmnr-skip-dynamic-import' }, (args) => ({\n contents: 'export default {};',\n loader: 'js',\n }));\n },\n});\n\nfunction loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}): Evaluation<any, any, any>[] {\n globalThis._evaluations = [];\n globalThis._set_global_evaluation = true;\n\n const __filename = filename;\n const __dirname = getDirname();\n\n // add some arguments for proper cjs/esm interop\n\n /* eslint-disable @typescript-eslint/no-implied-eval */\n new Function(\n \"require\",\n \"module\",\n \"__filename\",\n \"__dirname\",\n moduleText,\n )(\n require,\n module,\n __filename,\n __dirname,\n );\n /* eslint-enable @typescript-eslint/no-implied-eval */\n\n // Return the modified _evals global variable\n return globalThis._evaluations;\n}\n\nexport interface EvalCommandOptions {\n failOnError?: boolean;\n outputFile?: string;\n externalPackages?: string[];\n dynamicImportsToSkip?: string[];\n frontendPort?: number;\n}\n\nexport async function runEvaluation(\n files: string[],\n options: EvalCommandOptions,\n): Promise<void> {\n let evalFiles: string[];\n if (files && files.length > 0) {\n evalFiles = files.flatMap((file: string) => glob.sync(file));\n } else {\n // No files provided, use default pattern\n evalFiles = glob.sync('evals/**/*.eval.{ts,js}');\n }\n\n evalFiles.sort();\n\n if (evalFiles.length === 0) {\n logger.error(\"No evaluation files found. Please provide a file or \" +\n \"ensure there are eval files that are named like `*.eval.{ts,js}` in \" +\n \"the `evals` directory or its subdirectories.\");\n process.exit(1);\n }\n\n if (files.length === 0) {\n logger.info(`Located ${evalFiles.length} evaluation files in evals/`);\n } else {\n logger.info(`Running ${evalFiles.length} evaluation files.`);\n }\n\n const scores: {\n file: string,\n scores: Record<string, number>,\n url: string,\n evaluationId: string,\n }[] = [];\n\n for (const file of evalFiles) {\n logger.info(`Loading ${file}...`);\n const buildOptions = {\n bundle: true,\n platform: \"node\" as esbuild.Platform,\n entryPoints: [file],\n outfile: `tmp_out_${file}.js`,\n write: false, // will be loaded in memory as a temp file\n external: [\n \"@lmnr-ai/lmnr\",\n \"@lmnr-ai/lmnr/*\",\n \"@lmnr-ai/client\",\n \"@lmnr-ai/types\",\n \"esbuild\",\n \"fsevents\",\n \"playwright\",\n \"puppeteer\",\n \"puppeteer-core\",\n \"playwright-core\",\n ...(options.externalPackages ? options.externalPackages : []),\n ],\n plugins: [\n createSkipDynamicImportsPlugin(options.dynamicImportsToSkip || []),\n ],\n treeShaking: true,\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n logger.error(\"Error when building: No output files found \" +\n \"it is likely that all eval files are not valid TypeScript or JavaScript files.\");\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluations = loadModule({\n filename: file,\n moduleText: outputFileText,\n });\n\n logger.info(`Loaded ${evaluations.length} evaluations from ${file}`);\n\n for (const evaluation of evaluations) {\n if (!evaluation?.run) {\n logger.error(`Evaluation ${file} does not properly call evaluate()`);\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n if (options.frontendPort) {\n evaluation.setFrontendPort(options.frontendPort);\n }\n const evalResult = await evaluation.run();\n scores.push({\n file,\n scores: evalResult?.averageScores ?? {},\n url: evalResult?.url ?? '',\n evaluationId: evalResult?.evaluationId ?? '',\n });\n }\n }\n\n if (options.outputFile) {\n fs.writeFileSync(options.outputFile, JSON.stringify(scores, null, 2));\n }\n}\n\n","#!/usr/bin/env node\n\nimport { Command } from \"commander\";\n\nimport { version } from \"../../package.json\";\nimport { Evaluation } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport {\n handleDatasetsCreate,\n handleDatasetsList,\n handleDatasetsPull,\n handleDatasetsPush,\n} from \"./datasets\";\nimport { runEvaluation } from \"./evals\";\n\nconst logger = initializeLogger();\n\ndeclare global {\n var _evaluations: Evaluation<any, any, any>[] | undefined;\n var _set_global_evaluation: boolean;\n}\n\nasync function cli() {\n const program = new Command();\n\n program\n .name(\"lmnr\")\n .description(\"CLI for Laminar. Use `lmnr <subcommand> --help` for more information.\")\n .version(version, \"-v, --version\", \"display version number\");\n\n // Eval command\n program\n .command(\"eval\")\n .description(\"Run an evaluation\")\n .argument(\n \"[files...]\",\n \"A file or files containing the evaluation to run. If no file is provided, \" +\n \"the evaluation will run all `*.eval.ts|js` files in the `evals` directory. \" +\n \"If multiple files are provided, the evaluation will run each file in order.\",\n )\n .option(\n \"--fail-on-error\",\n \"Fail on error. If specified, will fail if encounters a file that cannot be run\",\n )\n .option(\n \"--output-file <file>\",\n \"Output file to write the results to. Outputs are written in JSON format.\",\n )\n .option(\n \"--external-packages <packages...>\",\n \"[ADVANCED] List of packages to pass as external to esbuild. This will not link \" +\n \"the packages directly into the eval file, but will instead require them at runtime. \" +\n \"Read more: https://esbuild.github.io/api/#external\",\n )\n .option(\n \"--dynamic-imports-to-skip <modules...>\",\n \"[ADVANCED] List of module names to skip when encountered as dynamic imports. \" +\n \"These dynamic imports will resolve to an empty module to prevent build failures. \" +\n \"This is meant to skip the imports that are not used in the evaluation itself.\",\n )\n .option(\n \"--frontend-port <port>\",\n \"Port for the Laminar frontend. Defaults to 5667\",\n (val) => parseInt(val, 10),\n )\n .action(async (files: string[], options) => {\n await runEvaluation(files, options);\n });\n\n // Datasets command with global options\n const datasetsCmd = program\n .command(\"datasets\")\n .description(\"Manage datasets\")\n .option(\n \"--project-api-key <key>\",\n \"Project API key. If not provided, reads from LMNR_PROJECT_API_KEY env variable\",\n )\n .option(\n \"--base-url <url>\",\n \"Base URL for the Laminar API. Defaults to https://api.lmnr.ai or LMNR_BASE_URL env variable\",\n )\n .option(\n \"--port <port>\",\n \"Port for the Laminar API. Defaults to 443\",\n (val) => parseInt(val, 10),\n );\n\n // Datasets list command\n datasetsCmd\n .command(\"list\")\n .description(\"List all datasets\")\n .action(async (options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsList({ ...parentOpts, ...options });\n });\n\n // Datasets push command\n datasetsCmd\n .command(\"push\")\n .description(\"Push datapoints to an existing dataset\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (paths: string[], options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPush(paths, { ...parentOpts, ...options });\n });\n\n // Datasets pull command\n datasetsCmd\n .command(\"pull\")\n .description(\"Pull data from a dataset\")\n .argument(\"[output-path]\", \"Path to save the data. If not provided, prints to console\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\n \"--batch-size <size>\",\n \"Batch size for pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .option(\"--limit <limit>\", \"Limit number of datapoints to pull\", (val) => parseInt(val, 10))\n .option(\"--offset <offset>\", \"Offset for pagination\", (val) => parseInt(val, 10), 0)\n .action(async (outputPath: string | undefined, options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPull(outputPath, { ...parentOpts, ...options });\n });\n\n // Datasets create command\n datasetsCmd\n .command(\"create\")\n .description(\"Create a dataset from input files\")\n .argument(\"<name>\", \"Name of the dataset to create\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .requiredOption(\"-o, --output-file <file>\", \"Path to save the pulled data\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing/pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (name: string, paths: string[], options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsCreate(name, paths, { ...parentOpts, ...options });\n });\n\n // Serve command (deprecated)\n program\n .command(\"dev\")\n .description(\"Start a rollout debugging session\")\n .argument(\"[file]\", \"Path to file containing the agent function(s)\")\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .action(() => {\n console.error(\n \"\\x1b[33m%s\\x1b[0m\", // Yellow text\n \"\\nThe 'lmnr dev' command has been moved to a separate package.\\n\\n\" +\n \"Please use:\\n\" +\n \" npx @lmnr-ai/cli@latest dev [file] [options]\\n\\n\",\n );\n process.exit(1);\n });\n\n // If no command provided, show help\n if (!process.argv.slice(2).length) {\n program.help();\n return;\n }\n\n await program.parseAsync();\n}\n\ncli().catch((err) => {\n logger.error(err instanceof Error ? err.message : err);\n throw err;\n});\n\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;CAAA,MAAM,EAAE,cAAc,QAAQ,SAAS;CAEvC,MAAM,CAAC,MAAM,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,MAAM,OAAO,KAAK,KAAK;CAC9B,MAAM,WAAW;EACf,QAAQ;EACR,SAAS;EACT,aAAa,EAAE,aAAa;EAC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iB,SAAS,QAAQ;AAE7D,QAAM,qBAAqB,MAAM,OAAO;GAAE,GADvB,IAAI,QAAQ,MAAM,IAAI,EAAE;GACc,GAAG;GAAS,CAAC;GACtE;AAGJ,SACG,QAAQ,MAAM,CACd,YAAY,oCAAoC,CAChD,SAAS,UAAU,gDAAgD,CACnE,qBAAqB,KAAK,CAC1B,mBAAmB,KAAK,CACxB,aAAa;AACZ,UAAQ,MACN,qBACA,oIAGD;AACD,UAAQ,KAAK,EAAE;GACf;AAGJ,KAAI,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC,QAAQ;AACjC,UAAQ,MAAM;AACd;;AAGF,OAAM,QAAQ,YAAY;;AAG5B,KAAK,CAAC,OAAO,QAAQ;AACnB,QAAO,MAAM,eAAe,QAAQ,IAAI,UAAU,IAAI;AACtD,OAAM;EACN"}
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["y","logger","initializeLogger","collectedFiles: string[]","fs","parsed: any","results: any[]","result: Datapoint<D, T>[]","asString","generateCsv","mkConfig","logger","initializeLogger","result: Datapoint<D, T>[]","LaminarClient","logger","initializeLogger","__filename","__dirname","getDirname","evalFiles: string[]","scores: {\n file: string,\n scores: Record<string, number>,\n url: string,\n evaluationId: string,\n }[]","initializeLogger","Command","version"],"sources":["../../../node_modules/.pnpm/csv-parser@3.2.0/node_modules/csv-parser/index.js","../../../node_modules/.pnpm/export-to-csv@1.4.0/node_modules/export-to-csv/output/index.js","../src/cli/file-utils.ts","../src/cli/datasets.ts","../src/cli/evals.ts","../src/cli/index.ts"],"sourcesContent":["const { Transform } = require('stream')\n\nconst [cr] = Buffer.from('\\r')\nconst [nl] = Buffer.from('\\n')\nconst defaults = {\n escape: '\"',\n headers: null,\n mapHeaders: ({ header }) => header,\n mapValues: ({ value }) => value,\n newline: '\\n',\n quote: '\"',\n raw: false,\n separator: ',',\n skipComments: false,\n skipLines: null,\n maxRowBytes: Number.MAX_SAFE_INTEGER,\n strict: false,\n outputByteOffset: false\n}\n\nclass CsvParser extends Transform {\n constructor (opts = {}) {\n super({ objectMode: true, highWaterMark: 16 })\n\n if (Array.isArray(opts)) opts = { headers: opts }\n\n const options = Object.assign({}, defaults, opts)\n\n options.customNewline = options.newline !== defaults.newline\n\n for (const key of ['newline', 'quote', 'separator']) {\n if (typeof options[key] !== 'undefined') {\n ([options[key]] = Buffer.from(options[key]))\n }\n }\n\n // if escape is not defined on the passed options, use the end value of quote\n options.escape = (opts || {}).escape ? Buffer.from(options.escape)[0] : options.quote\n\n this.state = {\n empty: options.raw ? Buffer.alloc(0) : '',\n escaped: false,\n first: true,\n lineNumber: 0,\n previousEnd: 0,\n rowLength: 0,\n quoted: false\n }\n\n this._prev = null\n\n if (options.headers === false) {\n // enforce, as the column length check will fail if headers:false\n options.strict = false\n }\n\n if (options.headers || options.headers === false) {\n this.state.first = false\n }\n\n this.options = options\n this.headers = options.headers\n this.bytesRead = 0\n }\n\n parseCell (buffer, start, end) {\n const { escape, quote } = this.options\n // remove quotes from quoted cells\n if (buffer[start] === quote && buffer[end - 1] === quote) {\n start++\n end--\n }\n\n let y = start\n\n for (let i = start; i < end; i++) {\n // check for escape characters and skip them\n if (buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote) {\n i++\n }\n\n if (y !== i) {\n buffer[y] = buffer[i]\n }\n y++\n }\n\n return this.parseValue(buffer, start, y)\n }\n\n parseLine (buffer, start, end) {\n const { customNewline, escape, mapHeaders, mapValues, quote, separator, skipComments, skipLines } = this.options\n\n end-- // trim newline\n if (!customNewline && buffer.length && buffer[end - 1] === cr) {\n end--\n }\n\n const comma = separator\n const cells = []\n let isQuoted = false\n let offset = start\n\n if (skipComments) {\n const char = typeof skipComments === 'string' ? skipComments : '#'\n if (buffer[start] === Buffer.from(char)[0]) {\n return\n }\n }\n\n const mapValue = (value) => {\n if (this.state.first) {\n return value\n }\n\n const index = cells.length\n const header = this.headers[index]\n\n return mapValues({ header, index, value })\n }\n\n for (let i = start; i < end; i++) {\n const isStartingQuote = !isQuoted && buffer[i] === quote\n const isEndingQuote = isQuoted && buffer[i] === quote && i + 1 <= end && buffer[i + 1] === comma\n const isEscape = isQuoted && buffer[i] === escape && i + 1 < end && buffer[i + 1] === quote\n\n if (isStartingQuote || isEndingQuote) {\n isQuoted = !isQuoted\n continue\n } else if (isEscape) {\n i++\n continue\n }\n\n if (buffer[i] === comma && !isQuoted) {\n let value = this.parseCell(buffer, offset, i)\n value = mapValue(value)\n cells.push(value)\n offset = i + 1\n }\n }\n\n if (offset < end) {\n let value = this.parseCell(buffer, offset, end)\n value = mapValue(value)\n cells.push(value)\n }\n\n if (buffer[end - 1] === comma) {\n cells.push(mapValue(this.state.empty))\n }\n\n const skip = skipLines && skipLines > this.state.lineNumber\n this.state.lineNumber++\n\n if (this.state.first && !skip) {\n this.state.first = false\n this.headers = cells.map((header, index) => mapHeaders({ header, index }))\n\n this.emit('headers', this.headers)\n return\n }\n\n if (!skip && this.options.strict && cells.length !== this.headers.length) {\n const e = new RangeError('Row length does not match headers')\n this.emit('error', e)\n } else {\n if (!skip) {\n const byteOffset = this.bytesRead - buffer.length + start\n this.writeRow(cells, byteOffset)\n }\n }\n }\n\n parseValue (buffer, start, end) {\n if (this.options.raw) {\n return buffer.slice(start, end)\n }\n\n return buffer.toString('utf-8', start, end)\n }\n\n writeRow (cells, byteOffset) {\n const headers = (this.headers === false) ? cells.map((value, index) => index) : this.headers\n\n const row = cells.reduce((o, cell, index) => {\n const header = headers[index]\n if (header === null) return o // skip columns\n if (header !== undefined) {\n o[header] = cell\n } else {\n o[`_${index}`] = cell\n }\n return o\n }, {})\n\n if (this.options.outputByteOffset) {\n this.push({ row, byteOffset })\n } else {\n this.push(row)\n }\n }\n\n _flush (cb) {\n if (this.state.escaped || !this._prev) return cb()\n this.parseLine(this._prev, this.state.previousEnd, this._prev.length + 1) // plus since online -1s\n cb()\n }\n\n _transform (data, enc, cb) {\n if (typeof data === 'string') {\n data = Buffer.from(data)\n }\n\n const { escape, quote } = this.options\n let start = 0\n let buffer = data\n this.bytesRead += data.byteLength\n\n if (this._prev) {\n start = this._prev.length\n buffer = Buffer.concat([this._prev, data])\n this._prev = null\n }\n\n const bufferLength = buffer.length\n\n for (let i = start; i < bufferLength; i++) {\n const chr = buffer[i]\n const nextChr = i + 1 < bufferLength ? buffer[i + 1] : null\n\n this.state.rowLength++\n if (this.state.rowLength > this.options.maxRowBytes) {\n return cb(new Error('Row exceeds the maximum size'))\n }\n\n if (!this.state.escaped && chr === escape && nextChr === quote && i !== start) {\n this.state.escaped = true\n continue\n } else if (chr === quote) {\n if (this.state.escaped) {\n this.state.escaped = false\n // non-escaped quote (quoting the cell)\n } else {\n this.state.quoted = !this.state.quoted\n }\n continue\n }\n\n if (!this.state.quoted) {\n if (this.state.first && !this.options.customNewline) {\n if (chr === nl) {\n this.options.newline = nl\n } else if (chr === cr) {\n if (nextChr !== nl) {\n this.options.newline = cr\n }\n }\n }\n\n if (chr === this.options.newline) {\n this.parseLine(buffer, this.state.previousEnd, i + 1)\n this.state.previousEnd = i + 1\n this.state.rowLength = 0\n }\n }\n }\n\n if (this.state.previousEnd === bufferLength) {\n this.state.previousEnd = 0\n return cb()\n }\n\n if (bufferLength - this.state.previousEnd < data.length) {\n this._prev = data\n this.state.previousEnd -= (bufferLength - data.length)\n return cb()\n }\n\n this._prev = buffer\n cb()\n }\n}\n\nmodule.exports = (opts) => new CsvParser(opts)\n","var q;(function(x){x[\"csv\"]=\"text/csv\";x[\"tsv\"]=\"text/tab-separated-values\";x[\"plain\"]=\"text/plain\"})(q||(q={}));var X=(W)=>W,z=(W)=>W,Z=X,_=X,Y=X,N=X,V=X;var h={fieldSeparator:\",\",decimalSeparator:\".\",quoteStrings:!0,quoteCharacter:'\"',showTitle:!1,title:\"My Generated Report\",filename:\"generated\",showColumnHeaders:!0,useTextFile:!1,fileExtension:\"csv\",mediaType:q.csv,useBom:!0,columnHeaders:[],useKeysAsHeaders:!1,boolDisplay:{true:\"TRUE\",false:\"FALSE\"},replaceUndefinedWith:\"\"},F=\"\\r\\n\",R=\"\\uFEFF\",G=(W)=>Object.assign({},h,W);class K extends Error{constructor(W){super(W);this.name=\"CsvGenerationError\"}}class B extends Error{constructor(W){super(W);this.name=\"EmptyHeadersError\"}}class L extends Error{constructor(W){super(W);this.name=\"CsvDownloadEnvironmentError\"}}class P extends Error{constructor(W){super(W);this.name=\"UnsupportedDataFormatError\"}}var s=function(W,$){if($=='\"'&&W.indexOf('\"')>-1)return W.replace(/\"/g,'\"\"');return W},w=(W)=>typeof W===\"object\"?N(W.key):N(W),y=(W)=>typeof W===\"object\"?V(W.displayLabel):V(W),T=(W,...$)=>$.reduce((j,x)=>x(j),W),E=(W)=>($)=>W.useBom?_(z($)+R):$,M=(W)=>($)=>W.showTitle?S(_(z($)+W.title))(Y(\"\")):$,S=(W)=>($)=>_(z(W)+z($)+F),O=(W)=>($,j)=>l(W)(Y(z($)+z(j))),l=(W)=>($)=>X(z($)+W.fieldSeparator),b=(W,$)=>(j)=>{if(!W.showColumnHeaders)return j;if($.length<1)throw new B(\"Option to show headers but none supplied. Make sure there are keys in your collection or that you've supplied headers through the config options.\");let x=Y(\"\");for(let A=0;A<$.length;A++){const J=y($[A]);x=O(W)(x,v(W,z(J)))}return x=Y(z(x).slice(0,-1)),S(j)(x)},C=(W,$,j)=>(x)=>{let A=x;for(var J=0;J<j.length;J++){let I=Y(\"\");for(let U=0;U<$.length;U++){const H=w($[U]),D=j[J][z(H)];I=O(W)(I,v(W,D))}I=Y(z(I).slice(0,-1)),A=S(A)(I)}return A},k=z,m=(W)=>+W===W&&(!isFinite(W)||Boolean(W%1)),p=(W,$)=>{if(m($)){if(W.decimalSeparator===\"locale\")return Z($.toLocaleString());if(W.decimalSeparator)return Z($.toString().replace(\".\",W.decimalSeparator))}return Z($.toString())},Q=(W,$)=>{let j=$;if(W.quoteStrings||W.fieldSeparator&&$.indexOf(W.fieldSeparator)>-1||W.quoteCharacter&&$.indexOf(W.quoteCharacter)>-1||$.indexOf(\"\\n\")>-1||$.indexOf(\"\\r\")>-1)j=W.quoteCharacter+s($,W.quoteCharacter)+W.quoteCharacter;return Z(j)},g=(W,$)=>{const j=$?\"true\":\"false\";return Z(W.boolDisplay[j])},r=(W,$)=>{if(typeof $===\"undefined\"&&W.replaceUndefinedWith!==void 0)return Q(W,W.replaceUndefinedWith+\"\");if($===null)return Q(W,\"null\");return Q(W,\"\")},v=(W,$)=>{if(typeof $===\"number\")return p(W,$);if(typeof $===\"string\")return Q(W,$);if(typeof $===\"boolean\"&&W.boolDisplay)return g(W,$);if($===null||typeof $===\"undefined\")return r(W,$);throw new P(`\n typeof ${typeof $} isn't supported. Only number, string, boolean, null and undefined are supported.\n Please convert the data in your object to one of those before generating the CSV.\n `)};var BW=(W)=>($)=>{const j=G(W),x=j.useKeysAsHeaders?Object.keys($[0]):j.columnHeaders;let A=T(_(\"\"),E(j),M(j),b(j,x),C(j,x,$));if(z(A).length<1)throw new K(\"Output is empty. Is your data formatted correctly?\");return A},f=(W)=>($)=>{const j=G(W),x=z($),A=j.useTextFile?\"text/plain\":j.mediaType;return new Blob([x],{type:`${A};charset=utf8;`})},LW=(W)=>($)=>{if(!window)throw new L(\"Downloading only supported in a browser environment.\");const j=f(W)($),x=G(W),A=x.useTextFile?\"txt\":x.fileExtension,J=`${x.filename}.${A}`,I=document.createElement(\"a\");I.download=J,I.href=URL.createObjectURL(j),I.setAttribute(\"visibility\",\"hidden\"),document.body.appendChild(I),I.click(),document.body.removeChild(I)};export{G as mkConfig,BW as generateCsv,LW as download,k as asString,f as asBlob,q as MediaType};\n","import csv from 'csv-parser';\nimport { asString, generateCsv, mkConfig } from 'export-to-csv';\nimport { createReadStream } from 'fs';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\n\nimport { Datapoint } from '../evaluations';\nimport { initializeLogger } from '../utils';\n\nconst logger = initializeLogger();\n\n/**\n * Check if a file has a supported extension.\n */\nconst isSupportedFile = (file: string): boolean => {\n const ext = path.extname(file).toLowerCase();\n return ['.json', '.csv', '.jsonl'].includes(ext);\n};\n\n/**\n * Collect all supported files from the given paths.\n * Handles both files and directories.\n */\nexport const collectFiles = async (\n paths: string[],\n recursive: boolean = false,\n): Promise<string[]> => {\n const collectedFiles: string[] = [];\n\n for (const filepath of paths) {\n try {\n const stats = await fs.stat(filepath);\n\n if (stats.isFile()) {\n if (isSupportedFile(filepath)) {\n collectedFiles.push(filepath);\n } else {\n logger.warn(`Skipping unsupported file type: ${filepath}`);\n }\n } else if (stats.isDirectory()) {\n const entries = await fs.readdir(filepath);\n\n for (const entry of entries) {\n const fullPath = path.join(filepath, entry);\n const entryStats = await fs.stat(fullPath);\n\n if (entryStats.isFile() && isSupportedFile(fullPath)) {\n collectedFiles.push(fullPath);\n } else if (recursive && entryStats.isDirectory()) {\n const subFiles = await collectFiles([fullPath], true);\n collectedFiles.push(...subFiles);\n }\n }\n }\n } catch (error) {\n logger.warn(\n `Path does not exist or is not accessible: ${filepath}. `\n + `Error: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n return collectedFiles;\n};\n\n/**\n * Read a JSON file and return its contents.\n */\nconst readJsonFile = async (filepath: string): Promise<any[]> => {\n const content = await fs.readFile(filepath, 'utf-8');\n const parsed = JSON.parse(content);\n return Array.isArray(parsed) ? parsed : [parsed];\n};\n\n/**\n * Try to parse a string as JSON. If it fails, return the original string.\n */\nconst tryParseJson = (content: string): any => {\n // Don't try to parse if it's not a string or doesn't look like JSON\n if (typeof content !== 'string') {\n return content;\n }\n\n // If it doesn't start with { or [, it's probably not JSON\n const trimmed = content.trim();\n if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {\n return content;\n }\n\n try {\n return JSON.parse(content);\n } catch (error) {\n logger.debug(\n `Error parsing JSON: ${error instanceof Error ? error.message : String(error)}`,\n );\n return content;\n }\n};\n\n/**\n * Parse each field in a CSV row, attempting to convert JSON strings back to objects.\n */\nconst parseCsvRow = (row: Record<string, string>): any => {\n const parsed: any = {};\n for (const [key, value] of Object.entries(row)) {\n parsed[key] = tryParseJson(value);\n }\n return parsed;\n};\n\n/**\n * Read a CSV file and return its contents as an array of objects.\n */\nconst readCsvFile = async (filepath: string): Promise<any[]> => new Promise((resolve, reject) => {\n const results: any[] = [];\n createReadStream(filepath)\n .pipe(csv())\n .on('data', (data) => results.push(parseCsvRow(data)))\n .on('end', () => resolve(results))\n .on('error', reject);\n});\n\n/**\n * Read a JSONL file and return its contents as an array of objects.\n */\nasync function readJsonlFile(filepath: string): Promise<any[]> {\n const content = await fs.readFile(filepath, 'utf-8');\n const lines = content.split('\\n').filter((line) => line.trim());\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return lines.map((line) => JSON.parse(line));\n}\n\n/**\n * Read a single file and return its contents.\n */\nasync function readFile(filepath: string): Promise<any[]> {\n const ext = path.extname(filepath).toLowerCase();\n\n if (ext === '.json') {\n return readJsonFile(filepath);\n } else if (ext === '.csv') {\n return readCsvFile(filepath);\n } else if (ext === '.jsonl') {\n return readJsonlFile(filepath);\n } else {\n throw new Error(`Unsupported file type: ${ext}`);\n }\n}\n\n/**\n * Load data from all files in the specified paths.\n */\nexport const loadFromPaths = async <D = any, T = any>(\n paths: string[],\n recursive: boolean = false,\n): Promise<Datapoint<D, T>[]> => {\n const files = await collectFiles(paths, recursive);\n\n if (files.length === 0) {\n logger.warn('No supported files found in the specified paths');\n return [];\n }\n\n logger.info(`Found ${files.length} file(s) to read`);\n\n const result: Datapoint<D, T>[] = [];\n\n for (const file of files) {\n try {\n const data = await readFile(file);\n result.push(...data);\n logger.info(`Read ${data.length} record(s) from ${file}`);\n } catch (error) {\n logger.error(\n `Error reading file ${file}: ${error instanceof Error ? error.message : String(error)}`,\n );\n throw error;\n }\n }\n\n return result;\n};\n\n/**\n * Write data to a JSON file.\n */\nconst writeJsonFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const content = JSON.stringify(data, null, 2);\n await fs.writeFile(filepath, content, 'utf-8');\n};\n\n/**\n * Write data to a CSV file.\n */\nconst writeCsvFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n if (data.length === 0) {\n throw new Error('No data to write to CSV');\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n\n await fs.writeFile(filepath, csvString, 'utf-8');\n};\n\n/**\n * Write data to a JSONL file.\n */\nconst writeJsonlFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n): Promise<void> => {\n const lines = data.map((item) => JSON.stringify(item)).join('\\n');\n await fs.writeFile(filepath, lines + '\\n', 'utf-8');\n};\n\n/**\n * Write data to a file based on the file extension.\n */\nexport const writeToFile = async <D, T>(\n filepath: string,\n data: Datapoint<D, T>[],\n format?: 'json' | 'csv' | 'jsonl',\n): Promise<void> => {\n // Create parent directories if they don't exist\n const dir = path.dirname(filepath);\n await fs.mkdir(dir, { recursive: true });\n\n // Determine the format\n const ext = format ?? path.extname(filepath).slice(1);\n\n if (format && format !== path.extname(filepath).slice(1)) {\n logger.warn(\n `Output format ${format} does not match file extension ${path.extname(filepath).slice(1)}`,\n );\n }\n\n if (ext === 'json') {\n await writeJsonFile(filepath, data);\n } else if (ext === 'csv') {\n await writeCsvFile(filepath, data);\n } else if (ext === 'jsonl') {\n await writeJsonlFile(filepath, data);\n } else {\n throw new Error(`Unsupported output format: ${ext}`);\n }\n};\n\n/**\n * Convert a value to a CSV-safe string.\n * - Strings and numbers pass through\n * - null/undefined become empty strings\n * - Objects and arrays are stringified to JSON\n */\nconst stringifyForCsv = (value: any): string => {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n // For objects and arrays, stringify to JSON\n return JSON.stringify(value);\n};\n\n/**\n * Print data to console in the specified format.\n */\nexport const printToConsole = <D, T>(\n data: Datapoint<D, T>[],\n format: 'json' | 'csv' | 'jsonl' = 'json',\n) => {\n if (format === 'json') {\n console.log(JSON.stringify(data, null, 2));\n } else if (format === 'csv') {\n if (data.length === 0) {\n logger.error('No data to print');\n return;\n }\n\n const formattedData = data.map(item =>\n Object.fromEntries(Object.entries(item).map(([key, value]) => [key, stringifyForCsv(value)]),\n ));\n\n const csvConfig = mkConfig({ useKeysAsHeaders: true });\n\n const csvOutput = generateCsv(csvConfig)(formattedData);\n const csvString = asString(csvOutput);\n console.log(csvString);\n } else if (format === 'jsonl') {\n data.forEach((item) => console.log(JSON.stringify(item)));\n } else {\n throw new Error(\n `Unsupported output format: ${String(format)}. `\n + \"(supported formats: json, csv, jsonl)\",\n );\n }\n};\n\n","import { LaminarClient } from \"@lmnr-ai/client\";\nimport { type StringUUID } from \"@lmnr-ai/types\";\n\nimport { Datapoint } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport { loadFromPaths, printToConsole, writeToFile } from \"./file-utils\";\n\nconst logger = initializeLogger();\nconst DEFAULT_DATASET_PULL_BATCH_SIZE = 100;\nconst DEFAULT_DATASET_PUSH_BATCH_SIZE = 100;\n\ninterface DatasetCommandOptions {\n projectApiKey?: string;\n baseUrl?: string;\n port?: number;\n}\n\n/**\n * Pull all data from a dataset in batches.\n */\nconst pullAllData = async <D = any, T = any>(\n client: LaminarClient,\n identifier: { name?: string; id?: StringUUID },\n batchSize: number = DEFAULT_DATASET_PULL_BATCH_SIZE,\n offset: number = 0,\n limit?: number,\n): Promise<Datapoint<D, T>[]> => {\n let hasMore = true;\n let currentOffset = offset;\n const stopAt = limit !== undefined ? offset + limit : undefined;\n\n const result: Datapoint<D, T>[] = [];\n\n while (hasMore && (stopAt === undefined || currentOffset < stopAt)) {\n const data = await client.datasets.pull<D, T>({\n ...identifier,\n offset: currentOffset,\n limit: batchSize,\n });\n\n result.push(...data.items);\n\n // Stop if we received no items or fewer items than requested (end of data)\n if (data.items.length === 0 || data.items.length < batchSize) {\n hasMore = false;\n } else if (stopAt !== undefined && currentOffset + batchSize >= stopAt) {\n hasMore = false;\n } else if (data.totalCount !== undefined && currentOffset + batchSize >= data.totalCount) {\n hasMore = false;\n }\n\n currentOffset += batchSize;\n }\n\n if (limit !== undefined) {\n return result.slice(0, limit);\n }\n\n return result;\n};\n\n/**\n * Handle datasets list command.\n */\nexport const handleDatasetsList = async (\n options: DatasetCommandOptions,\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n try {\n const datasets = await client.datasets.listDatasets();\n\n if (datasets.length === 0) {\n console.log(\"No datasets found.\");\n return;\n }\n\n // Print table header\n const idWidth = 36; // UUID length\n const createdAtWidth = 19; // YYYY-MM-DD HH:MM:SS format\n\n console.log(`\\n${'ID'.padEnd(idWidth)} ${'Created At'.padEnd(createdAtWidth)} Name`);\n console.log(`${'-'.repeat(idWidth)} ${'-'.repeat(createdAtWidth)} ${'-'.repeat(20)}`);\n\n // Print each dataset row\n for (const dataset of datasets) {\n const createdAt = new Date(dataset.createdAt);\n const createdAtStr = createdAt.toISOString().replace('T', ' ').substring(0, 19);\n console.log(\n `${dataset.id.padEnd(idWidth)} ${createdAtStr.padEnd(createdAtWidth)} ${dataset.name}`,\n );\n }\n\n console.log(`\\nTotal: ${datasets.length} dataset(s)\\n`);\n } catch (error) {\n logger.error(\n `Failed to list datasets: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets push command.\n */\nexport const handleDatasetsPush = async (\n paths: string[],\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n await client.datasets.push({\n points: data,\n ...identifier,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n });\n logger.info(`Pushed ${data.length} data points to dataset ${options.name || options.id}`);\n } catch (error) {\n logger.error(\n `Failed to push dataset: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets pull command.\n */\nexport const handleDatasetsPull = async (\n outputPath: string | undefined,\n options: DatasetCommandOptions & {\n name?: string;\n id?: StringUUID;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n batchSize?: number;\n limit?: number;\n offset?: number;\n },\n): Promise<void> => {\n if (!options.name && !options.id) {\n logger.error(\"Either name or id must be provided\");\n return;\n }\n\n if (options.name && options.id) {\n logger.error(\"Only one of name or id must be provided\");\n return;\n }\n\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n const identifier = options.name ? { name: options.name } : { id: options.id };\n\n try {\n const result = await pullAllData(\n client,\n identifier,\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n options.offset ?? 0,\n options.limit,\n );\n\n if (outputPath) {\n await writeToFile(outputPath, result, options.outputFormat);\n logger.info(`Successfully pulled ${result.length} data points to ${outputPath}`);\n } else {\n printToConsole(result, options.outputFormat ?? 'json');\n }\n } catch (error) {\n logger.error(\n `Failed to pull dataset: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n/**\n * Handle datasets create command.\n */\nexport const handleDatasetsCreate = async (\n name: string,\n paths: string[],\n options: DatasetCommandOptions & {\n outputFile: string;\n outputFormat?: 'json' | 'csv' | 'jsonl';\n recursive?: boolean;\n batchSize?: number;\n },\n): Promise<void> => {\n const client = new LaminarClient({\n projectApiKey: options.projectApiKey,\n baseUrl: options.baseUrl,\n port: options.port,\n });\n\n // Load data from input files\n const data = await loadFromPaths(paths, options.recursive);\n\n if (data.length === 0) {\n logger.warn(\"No data to push. Skipping\");\n return;\n }\n\n // Push data to create/populate the dataset\n logger.info(`Pushing ${data.length} data points to dataset '${name}'...`);\n\n try {\n await client.datasets.push({\n points: data,\n name,\n batchSize: options.batchSize ?? DEFAULT_DATASET_PUSH_BATCH_SIZE,\n createDataset: true,\n });\n logger.info(`Successfully pushed ${data.length} data points to dataset '${name}'`);\n } catch (error) {\n logger.error(\n `Failed to create dataset: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n\n // Pull data back from the dataset\n logger.info(`Pulling data from dataset '${name}'...`);\n\n try {\n const result = await pullAllData(\n client,\n { name },\n options.batchSize ?? DEFAULT_DATASET_PULL_BATCH_SIZE,\n 0,\n undefined,\n );\n\n // Save to output file\n await writeToFile(options.outputFile, result, options.outputFormat);\n\n logger.info(\n `Successfully created dataset '${name}' `\n + `and saved ${result.length} datapoints to ${options.outputFile}`,\n );\n } catch (error) {\n logger.error(\n \"Failed to pull dataset after creation: \"\n + `${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n\n","import * as esbuild from \"esbuild\";\nimport * as fs from \"fs\";\nimport * as glob from \"glob\";\n\nimport { Evaluation } from \"../evaluations\";\nimport { getDirname, initializeLogger } from \"../utils\";\n\nconst logger = initializeLogger();\n\n// esbuild plugin to skip dynamic imports\nconst createSkipDynamicImportsPlugin = (skipModules: string[]): esbuild.Plugin => ({\n name: 'skip-dynamic-imports',\n setup(build) {\n if (!skipModules || skipModules.length === 0) return;\n\n build.onResolve({ filter: /.*/ }, (args) => {\n // Only handle dynamic imports\n if (args.kind === 'dynamic-import' && skipModules.includes(args.path)) {\n logger.warn(`Skipping dynamic import: ${args.path}`);\n // Return a virtual module that exports an empty object\n return {\n path: args.path,\n namespace: 'lmnr-skip-dynamic-import',\n };\n }\n });\n\n // Provide empty module content for skipped dynamic imports\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n build.onLoad({ filter: /.*/, namespace: 'lmnr-skip-dynamic-import' }, (args) => ({\n contents: 'export default {};',\n loader: 'js',\n }));\n },\n});\n\nfunction loadModule({\n filename,\n moduleText,\n}: {\n filename: string;\n moduleText: string;\n}): Evaluation<any, any, any>[] {\n globalThis._evaluations = [];\n globalThis._set_global_evaluation = true;\n\n const __filename = filename;\n const __dirname = getDirname();\n\n // add some arguments for proper cjs/esm interop\n\n /* eslint-disable @typescript-eslint/no-implied-eval */\n new Function(\n \"require\",\n \"module\",\n \"__filename\",\n \"__dirname\",\n moduleText,\n )(\n require,\n module,\n __filename,\n __dirname,\n );\n /* eslint-enable @typescript-eslint/no-implied-eval */\n\n // Return the modified _evals global variable\n return globalThis._evaluations;\n}\n\nexport interface EvalCommandOptions {\n failOnError?: boolean;\n outputFile?: string;\n externalPackages?: string[];\n dynamicImportsToSkip?: string[];\n frontendPort?: number;\n}\n\nexport async function runEvaluation(\n files: string[],\n options: EvalCommandOptions,\n): Promise<void> {\n let evalFiles: string[];\n if (files && files.length > 0) {\n evalFiles = files.flatMap((file: string) => glob.sync(file));\n } else {\n // No files provided, use default pattern\n evalFiles = glob.sync('evals/**/*.eval.{ts,js}');\n }\n\n evalFiles.sort();\n\n if (evalFiles.length === 0) {\n logger.error(\"No evaluation files found. Please provide a file or \" +\n \"ensure there are eval files that are named like `*.eval.{ts,js}` in \" +\n \"the `evals` directory or its subdirectories.\");\n process.exit(1);\n }\n\n if (files.length === 0) {\n logger.info(`Located ${evalFiles.length} evaluation files in evals/`);\n } else {\n logger.info(`Running ${evalFiles.length} evaluation files.`);\n }\n\n const scores: {\n file: string,\n scores: Record<string, number>,\n url: string,\n evaluationId: string,\n }[] = [];\n\n for (const file of evalFiles) {\n logger.info(`Loading ${file}...`);\n const buildOptions = {\n bundle: true,\n platform: \"node\" as esbuild.Platform,\n entryPoints: [file],\n outfile: `tmp_out_${file}.js`,\n write: false, // will be loaded in memory as a temp file\n external: [\n \"@lmnr-ai/lmnr\",\n \"@lmnr-ai/lmnr/*\",\n \"@lmnr-ai/client\",\n \"@lmnr-ai/types\",\n \"esbuild\",\n \"fsevents\",\n \"playwright\",\n \"puppeteer\",\n \"puppeteer-core\",\n \"playwright-core\",\n ...(options.externalPackages ? options.externalPackages : []),\n ],\n plugins: [\n createSkipDynamicImportsPlugin(options.dynamicImportsToSkip || []),\n ],\n treeShaking: true,\n };\n\n const result = await esbuild.build(buildOptions);\n\n if (!result.outputFiles) {\n logger.error(\"Error when building: No output files found \" +\n \"it is likely that all eval files are not valid TypeScript or JavaScript files.\");\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n const outputFileText = result.outputFiles[0].text;\n\n const evaluations = loadModule({\n filename: file,\n moduleText: outputFileText,\n });\n\n logger.info(`Loaded ${evaluations.length} evaluations from ${file}`);\n\n for (const evaluation of evaluations) {\n if (!evaluation?.run) {\n logger.error(`Evaluation ${file} does not properly call evaluate()`);\n if (options.failOnError) {\n process.exit(1);\n }\n continue;\n }\n\n if (options.frontendPort) {\n evaluation.setFrontendPort(options.frontendPort);\n }\n const evalResult = await evaluation.run();\n scores.push({\n file,\n scores: evalResult?.averageScores ?? {},\n url: evalResult?.url ?? '',\n evaluationId: evalResult?.evaluationId ?? '',\n });\n }\n }\n\n if (options.outputFile) {\n fs.writeFileSync(options.outputFile, JSON.stringify(scores, null, 2));\n }\n}\n\n","#!/usr/bin/env node\n\nimport { Command } from \"commander\";\n\nimport { version } from \"../../package.json\";\nimport { Evaluation } from \"../evaluations\";\nimport { initializeLogger } from \"../utils\";\nimport {\n handleDatasetsCreate,\n handleDatasetsList,\n handleDatasetsPull,\n handleDatasetsPush,\n} from \"./datasets\";\nimport { runEvaluation } from \"./evals\";\n\nconst logger = initializeLogger();\n\ndeclare global {\n var _evaluations: Evaluation<any, any, any>[] | undefined;\n var _set_global_evaluation: boolean;\n}\n\nasync function cli() {\n const program = new Command();\n\n program\n .name(\"lmnr\")\n .description(\"CLI for Laminar. Use `lmnr <subcommand> --help` for more information.\")\n .version(version, \"-v, --version\", \"display version number\");\n\n // Eval command\n program\n .command(\"eval\")\n .description(\"Run an evaluation\")\n .argument(\n \"[files...]\",\n \"A file or files containing the evaluation to run. If no file is provided, \" +\n \"the evaluation will run all `*.eval.ts|js` files in the `evals` directory. \" +\n \"If multiple files are provided, the evaluation will run each file in order.\",\n )\n .option(\n \"--fail-on-error\",\n \"Fail on error. If specified, will fail if encounters a file that cannot be run\",\n )\n .option(\n \"--output-file <file>\",\n \"Output file to write the results to. Outputs are written in JSON format.\",\n )\n .option(\n \"--external-packages <packages...>\",\n \"[ADVANCED] List of packages to pass as external to esbuild. This will not link \" +\n \"the packages directly into the eval file, but will instead require them at runtime. \" +\n \"Read more: https://esbuild.github.io/api/#external\",\n )\n .option(\n \"--dynamic-imports-to-skip <modules...>\",\n \"[ADVANCED] List of module names to skip when encountered as dynamic imports. \" +\n \"These dynamic imports will resolve to an empty module to prevent build failures. \" +\n \"This is meant to skip the imports that are not used in the evaluation itself.\",\n )\n .option(\n \"--frontend-port <port>\",\n \"Port for the Laminar frontend. Defaults to 5667\",\n (val) => parseInt(val, 10),\n )\n .action(async (files: string[], options) => {\n await runEvaluation(files, options);\n });\n\n // Datasets command with global options\n const datasetsCmd = program\n .command(\"datasets\")\n .description(\"Manage datasets\")\n .option(\n \"--project-api-key <key>\",\n \"Project API key. If not provided, reads from LMNR_PROJECT_API_KEY env variable\",\n )\n .option(\n \"--base-url <url>\",\n \"Base URL for the Laminar API. Defaults to https://api.lmnr.ai or LMNR_BASE_URL env variable\",\n )\n .option(\n \"--port <port>\",\n \"Port for the Laminar API. Defaults to 443\",\n (val) => parseInt(val, 10),\n );\n\n // Datasets list command\n datasetsCmd\n .command(\"list\")\n .description(\"List all datasets\")\n .action(async (options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsList({ ...parentOpts, ...options });\n });\n\n // Datasets push command\n datasetsCmd\n .command(\"push\")\n .description(\"Push datapoints to an existing dataset\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (paths: string[], options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPush(paths, { ...parentOpts, ...options });\n });\n\n // Datasets pull command\n datasetsCmd\n .command(\"pull\")\n .description(\"Pull data from a dataset\")\n .argument(\"[output-path]\", \"Path to save the data. If not provided, prints to console\")\n .option(\"-n, --name <name>\", \"Name of the dataset (either name or id must be provided)\")\n .option(\"--id <id>\", \"ID of the dataset (either name or id must be provided)\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\n \"--batch-size <size>\",\n \"Batch size for pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .option(\"--limit <limit>\", \"Limit number of datapoints to pull\", (val) => parseInt(val, 10))\n .option(\"--offset <offset>\", \"Offset for pagination\", (val) => parseInt(val, 10), 0)\n .action(async (outputPath: string | undefined, options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsPull(outputPath, { ...parentOpts, ...options });\n });\n\n // Datasets create command\n datasetsCmd\n .command(\"create\")\n .description(\"Create a dataset from input files\")\n .argument(\"<name>\", \"Name of the dataset to create\")\n .argument(\"<paths...>\", \"Paths to files or directories containing data to push\")\n .requiredOption(\"-o, --output-file <file>\", \"Path to save the pulled data\")\n .option(\n \"--output-format <format>\",\n \"Output format (json, csv, jsonl). Inferred from file extension if not provided\",\n )\n .option(\"-r, --recursive\", \"Recursively read files in directories\", false)\n .option(\n \"--batch-size <size>\",\n \"Batch size for pushing/pulling data\",\n (val) => parseInt(val, 10),\n 100,\n )\n .action(async (name: string, paths: string[], options, cmd) => {\n const parentOpts = cmd.parent?.opts() || {};\n await handleDatasetsCreate(name, paths, { ...parentOpts, ...options });\n });\n\n // Serve command (deprecated)\n program\n .command(\"dev\")\n .description(\"Start a rollout debugging session\")\n .argument(\"[file]\", \"Path to file containing the agent function(s)\")\n .allowExcessArguments(true)\n .allowUnknownOption(true)\n .action(() => {\n console.error(\n \"\\x1b[33m%s\\x1b[0m\", // Yellow text\n \"\\nThe 'lmnr dev' command has been moved to a separate package.\\n\\n\" +\n \"Please use:\\n\" +\n \" npx lmnr-cli@latest dev [file] [options]\\n\\n\",\n );\n process.exit(1);\n });\n\n // If no command provided, show help\n if (!process.argv.slice(2).length) {\n program.help();\n return;\n }\n\n await program.parseAsync();\n}\n\ncli().catch((err) => {\n logger.error(err instanceof Error ? err.message : err);\n throw err;\n});\n\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;;CAAA,MAAM,EAAE,cAAc,QAAQ,SAAS;CAEvC,MAAM,CAAC,MAAM,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,MAAM,OAAO,KAAK,KAAK;CAC9B,MAAM,WAAW;EACf,QAAQ;EACR,SAAS;EACT,aAAa,EAAE,aAAa;EAC5B,YAAY,EAAE,YAAY;EAC1B,SAAS;EACT,OAAO;EACP,KAAK;EACL,WAAW;EACX,cAAc;EACd,WAAW;EACX,aAAa,OAAO;EACpB,QAAQ;EACR,kBAAkB;EACnB;CAED,IAAM,YAAN,cAAwB,UAAU;EAChC,YAAa,OAAO,EAAE,EAAE;AACtB,SAAM;IAAE,YAAY;IAAM,eAAe;IAAI,CAAC;AAE9C,OAAI,MAAM,QAAQ,KAAK,CAAE,QAAO,EAAE,SAAS,MAAM;GAEjD,MAAM,UAAU,OAAO,OAAO,EAAE,EAAE,UAAU,KAAK;AAEjD,WAAQ,gBAAgB,QAAQ,YAAY,SAAS;AAErD,QAAK,MAAM,OAAO;IAAC;IAAW;IAAS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;AACnB,QAAO,MAAM,eAAe,QAAQ,IAAI,UAAU,IAAI;AACtD,OAAM;EACN"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-D9JhAFjk.mjs";
|
|
3
|
-
import { n as version, t as LaminarClient } from "./dist-
|
|
3
|
+
import { n as version, t as LaminarClient } from "./dist-ghfEJ89k.mjs";
|
|
4
4
|
import { i as getDirname, s as initializeLogger } from "./utils-nkOGZxcV.mjs";
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import { Command } from "commander";
|
|
@@ -808,7 +808,7 @@ async function cli() {
|
|
|
808
808
|
});
|
|
809
809
|
});
|
|
810
810
|
program.command("dev").description("Start a rollout debugging session").argument("[file]", "Path to file containing the agent function(s)").allowExcessArguments(true).allowUnknownOption(true).action(() => {
|
|
811
|
-
console.error("\x1B[33m%s\x1B[0m", "\nThe 'lmnr dev' command has been moved to a separate package.\n\nPlease use:\n npx
|
|
811
|
+
console.error("\x1B[33m%s\x1B[0m", "\nThe 'lmnr dev' command has been moved to a separate package.\n\nPlease use:\n npx lmnr-cli@latest dev [file] [options]\n\n");
|
|
812
812
|
process.exit(1);
|
|
813
813
|
});
|
|
814
814
|
if (!process.argv.slice(2).length) {
|