evals 2.2.7 → 2.2.8

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.
Files changed (4) hide show
  1. package/README.md +53 -53
  2. package/cli.js +246 -246
  3. package/package.json +27 -27
  4. package/spawn-interactive.js +50 -50
package/README.md CHANGED
@@ -1,53 +1,53 @@
1
- # evals
2
-
3
- An npm package for Arize evals functionality.
4
-
5
- ## About Arize AI
6
-
7
- Arize AI is a leading company in AI observability and evaluation, dedicated to ensuring that artificial intelligence systems operate reliably in real-world applications. Founded in 2019, Arize provides tools that help machine learning teams monitor, troubleshoot, and improve model performance across various domains, including structured data, computer vision, and large language models (LLMs).
8
-
9
- ## Arize Phoenix
10
-
11
- **Arize Phoenix** is an open-source library designed for LLM tracing and evaluation. It enables developers to evaluate, experiment, and optimize AI products in real time. Key features include:
12
-
13
- - **Application Tracing**: Collects LLM application data with automatic instrumentation, providing comprehensive visibility into model operations
14
- - **Interactive Prompt Playground**: Offers a flexible environment for prompt and model iteration, allowing users to compare prompts, visualize outputs, and debug failures within their workflow
15
- - **Streamlined Evaluations and Annotations**: Facilitates efficient assessment and documentation of model performance
16
-
17
- Phoenix is built on OpenTelemetry, ensuring seamless setup, full transparency, and no vendor lock-in. It's perfect for teams who want to get started with LLM observability and evaluation in a fully local, open-source environment.
18
-
19
- ## Arize AX
20
-
21
- **Arize AX** is the enterprise AI engineering platform that extends the capabilities of Phoenix, offering a comprehensive suite for development, evaluation, and observability. Key features include:
22
-
23
- - **Prompts**: Tools for prompt engineering, including a prompt playground, prompt hub for management and versioning, and a prompt builder powered by AI
24
- - **Experiments**: Systematic A/B testing of prompts against large datasets to optimize model performance
25
- - **Tracing**: Detailed tracing capabilities to monitor and debug AI applications effectively
26
- - **Evaluation**: Comprehensive evaluation metrics and tools to assess model outputs and performance
27
- - **Alyx**: An AI engineering agent embedded within the platform to assist with various tasks
28
-
29
- Arize AX is designed to support teams and organizations with larger data needs, providing robust support, collaboration features, and multiple deployment options including SaaS, Virtual Private Cloud (VPC), and Arize Private Connect.
30
-
31
-
32
- ## Installation
33
-
34
- ```bash
35
- npm install evals
36
- ```
37
-
38
- The post-install script will automatically launch the CLI interface.
39
-
40
- ## Usage
41
-
42
- Run the CLI manually:
43
-
44
- ```bash
45
- npm start
46
- ```
47
-
48
- Or use the binary:
49
-
50
- ```bash
51
- npx evals
52
- ```
53
-
1
+ # evals
2
+
3
+ An npm package for Arize evals functionality.
4
+
5
+ ## About Arize AI
6
+
7
+ Arize AI is a leading company in AI observability and evaluation, dedicated to ensuring that artificial intelligence systems operate reliably in real-world applications. Founded in 2019, Arize provides tools that help machine learning teams monitor, troubleshoot, and improve model performance across various domains, including structured data, computer vision, and large language models (LLMs).
8
+
9
+ ## Arize Phoenix
10
+
11
+ **Arize Phoenix** is an open-source library designed for LLM tracing and evaluation. It enables developers to evaluate, experiment, and optimize AI products in real time. Key features include:
12
+
13
+ - **Application Tracing**: Collects LLM application data with automatic instrumentation, providing comprehensive visibility into model operations
14
+ - **Interactive Prompt Playground**: Offers a flexible environment for prompt and model iteration, allowing users to compare prompts, visualize outputs, and debug failures within their workflow
15
+ - **Streamlined Evaluations and Annotations**: Facilitates efficient assessment and documentation of model performance
16
+
17
+ Phoenix is built on OpenTelemetry, ensuring seamless setup, full transparency, and no vendor lock-in. It's perfect for teams who want to get started with LLM observability and evaluation in a fully local, open-source environment.
18
+
19
+ ## Arize AX
20
+
21
+ **Arize AX** is the enterprise AI engineering platform that extends the capabilities of Phoenix, offering a comprehensive suite for development, evaluation, and observability. Key features include:
22
+
23
+ - **Prompts**: Tools for prompt engineering, including a prompt playground, prompt hub for management and versioning, and a prompt builder powered by AI
24
+ - **Experiments**: Systematic A/B testing of prompts against large datasets to optimize model performance
25
+ - **Tracing**: Detailed tracing capabilities to monitor and debug AI applications effectively
26
+ - **Evaluation**: Comprehensive evaluation metrics and tools to assess model outputs and performance
27
+ - **Alyx**: An AI engineering agent embedded within the platform to assist with various tasks
28
+
29
+ Arize AX is designed to support teams and organizations with larger data needs, providing robust support, collaboration features, and multiple deployment options including SaaS, Virtual Private Cloud (VPC), and Arize Private Connect.
30
+
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ npm install evals
36
+ ```
37
+
38
+ The post-install script will automatically launch the CLI interface.
39
+
40
+ ## Usage
41
+
42
+ Run the CLI manually:
43
+
44
+ ```bash
45
+ npm start
46
+ ```
47
+
48
+ Or use the binary:
49
+
50
+ ```bash
51
+ npx evals
52
+ ```
53
+
package/cli.js CHANGED
@@ -1,246 +1,246 @@
1
- #!/usr/bin/env node
2
-
3
- import React, { useState, useEffect } from 'react';
4
- import { render, Box, Text, useInput, useApp, Static } from 'ink';
5
- import Gradient from 'ink-gradient';
6
- import { exec } from 'child_process';
7
-
8
- const e = React.createElement;
9
-
10
- // Diagnostic: Uncomment to verify script is running
11
- console.error('CLI script started, platform:', process.platform, 'isTTY:', process.stdin.isTTY);
12
-
13
- // "ARIZE EVALS" - EXACTLY matched width (both 44 chars)
14
- const largeLogo = `
15
- █████╗ ██████╗ ██╗ ███████╗ ███████╗
16
- ██╔══██╗ ██╔══██╗ ██║ ╚══███╔╝ ██╔════╝
17
- ███████║ ██████╔╝ ██║ ███╔╝ █████╗
18
- ██╔══██║ ██╔══██╗ ██║ ███╔╝ ██╔══╝
19
- ██║ ██║ ██║ ██║ ██║ ███████╗ ███████╗
20
- ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝
21
- ███████╗ ██╗ ██╗ █████╗ ██╗ ███████╗
22
- ██╔════╝ ██║ ██║ ██╔══██╗ ██║ ██╔════╝
23
- █████╗ ██║ ██║ ███████║ ██║ ███████╗
24
- ██╔══╝ ╚██╗ ██╔╝ ██╔══██║ ██║ ╚════██║
25
- ███████╗ ╚████╔╝ ██║ ██║ ███████╗███████║
26
- ╚══════╝ ╚═══╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝`;
27
-
28
- const mediumLogo = `
29
- █████╗ ██████╗ ██╗ ███████╗ ███████╗
30
- ██╔══██╗ ██╔══██╗ ██║ ╚══███╔╝ ██╔════╝
31
- ███████║ ██████╔╝ ██║ ███╔╝ █████╗
32
- ██╔══██║ ██╔══██╗ ██║ ███╔╝ ██╔══╝
33
- ██║ ██║ ██║ ██║ ██║ ███████╗ ███████╗
34
- ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝
35
- █▀▀ █ █ ▄▀█ █ █▀
36
- ██▄ ▀▄▀ █▀█ █▄▄ ▄█`;
37
-
38
- const smallLogo = `ARIZE
39
- EVALS`;
40
-
41
- const OPTIONS = [
42
- {
43
- name: 'Evals Primer',
44
- subtext: 'Learn the Craft',
45
- url: 'https://arize.com/llm-evaluation/?utm_source=npmevals'
46
- },
47
- {
48
- name: 'Arize AX SaaS',
49
- subtext: 'Enterprise Agent Evaluation, Best in Class',
50
- url: 'https://arize.com/docs/ax?utm_source=npmevals'
51
- },
52
- {
53
- name: 'Arize Phoenix',
54
- subtext: 'OSS Agent Evals & Traces, Fully Local',
55
- url: 'https://arize.com/docs/phoenix?utm_source=npmevals'
56
- },
57
- {
58
- name: 'Book an Eval Assessment',
59
- subtext: 'Improve Your Agent Today',
60
- url: 'https://arize.com/get-an-eval-assessment?utm_source=npmevals'
61
- }
62
- ];
63
-
64
- function openUrlInBrowser(url) {
65
- const command = process.platform === 'win32'
66
- ? `start ${url}`
67
- : process.platform === 'darwin'
68
- ? `open "${url}"`
69
- : `xdg-open "${url}"`;
70
-
71
- exec(command, (error) => {
72
- if (error) {
73
- console.error(`Failed to open browser: ${error.message}`);
74
- }
75
- process.exit(0);
76
- });
77
- }
78
-
79
- // Header with hot pink to dark blue gradient
80
- function Header() {
81
- const terminalWidth = process.stdout.columns || 80;
82
-
83
- let logo;
84
- if (terminalWidth >= 45) {
85
- logo = largeLogo;
86
- } else if (terminalWidth >= 35) {
87
- logo = mediumLogo;
88
- } else {
89
- logo = smallLogo;
90
- }
91
-
92
- return e(Box, { flexDirection: 'column', marginBottom: 1 },
93
- e(Gradient, { colors: ['#FF008C', '#FF1493', '#8B5CF6', '#1E3A8A'] },
94
- e(Text, null, logo)
95
- ),
96
- e(Text, { color: 'gray', italic: true }, 'Evals and Observability for Agentic AI')
97
- );
98
- }
99
-
100
- // Character-by-character shimmer component
101
- function ShimmerText({ text, shimmerPos }) {
102
- const baseColor = '#FF1493';
103
- const shimmerColors = ['#FF5AA7', '#FF85C0', '#FFB8D9', '#FFE0EE', '#FFB8D9', '#FF85C0', '#FF5AA7'];
104
- const shimmerWidth = shimmerColors.length;
105
-
106
- const chars = text.split('').map((char, i) => {
107
- const distanceFromShimmer = i - shimmerPos;
108
-
109
- let color = baseColor;
110
- if (distanceFromShimmer >= 0 && distanceFromShimmer < shimmerWidth) {
111
- color = shimmerColors[distanceFromShimmer];
112
- }
113
-
114
- return e(Text, { key: i, color, bold: true }, char);
115
- });
116
-
117
- return e(Box, null, ...chars);
118
- }
119
-
120
- // Menu item component - single line, hot pink selected with character shimmer
121
- function MenuItem({ name, subtext, isSelected, shimmerPos }) {
122
- if (isSelected) {
123
- return e(Box, null,
124
- e(Text, { bold: true, color: '#FF1493' }, '❯ '),
125
- e(ShimmerText, { text: name, shimmerPos }),
126
- e(Text, { color: 'gray' }, ' — ' + subtext)
127
- );
128
- }
129
-
130
- return e(Box, null,
131
- e(Text, { color: 'white' }, ' ' + name),
132
- e(Text, { color: 'gray' }, ' — ' + subtext)
133
- );
134
- }
135
-
136
- // Main App component
137
- function App() {
138
- const [selectedIndex, setSelectedIndex] = useState(0);
139
- const [shimmerPos, setShimmerPos] = useState(-7); // Start off-screen
140
- const { exit } = useApp();
141
-
142
- const selectedName = OPTIONS[selectedIndex].name;
143
-
144
- // Character-by-character shimmer animation
145
- useEffect(() => {
146
- const textLength = selectedName.length;
147
- const shimmerWidth = 7;
148
- const totalPositions = textLength + shimmerWidth + 5; // Extra padding for smooth loop
149
-
150
- const timer = setInterval(() => {
151
- setShimmerPos(prev => {
152
- const next = prev + 1;
153
- return next > totalPositions ? -shimmerWidth : next;
154
- });
155
- }, 120); // Speed of shimmer movement
156
-
157
- return () => clearInterval(timer);
158
- }, [selectedName]);
159
-
160
- // Reset shimmer position when selection changes
161
- useEffect(() => {
162
- setShimmerPos(-7);
163
- }, [selectedIndex]);
164
-
165
- useInput((input, key) => {
166
- if (input === 'q' || key.escape) {
167
- exit();
168
- return;
169
- }
170
-
171
- if (key.upArrow || input === 'k') {
172
- setSelectedIndex(prev => (prev > 0 ? prev - 1 : OPTIONS.length - 1));
173
- }
174
-
175
- if (key.downArrow || input === 'j') {
176
- setSelectedIndex(prev => (prev < OPTIONS.length - 1 ? prev + 1 : 0));
177
- }
178
-
179
- if (key.return) {
180
- const selected = OPTIONS[selectedIndex];
181
- exit();
182
- setTimeout(() => {
183
- console.log(`\nOpening ${selected.url} in your browser...\n`);
184
- openUrlInBrowser(selected.url);
185
- }, 100);
186
- }
187
- });
188
-
189
- return e(Box, { flexDirection: 'column', padding: 1 },
190
- e(Static, { items: ['header'] }, () => e(Header)),
191
- e(Box, { marginBottom: 1 },
192
- e(Text, { bold: true, color: 'white' }, 'Select an option:')
193
- ),
194
- e(Box, { flexDirection: 'column', paddingX: 1 },
195
- ...OPTIONS.map((option, index) =>
196
- e(MenuItem, {
197
- key: index.toString(),
198
- name: option.name,
199
- subtext: option.subtext,
200
- isSelected: index === selectedIndex,
201
- shimmerPos: shimmerPos
202
- })
203
- )
204
- ),
205
- e(Box, { marginTop: 1 },
206
- e(Text, { dimColor: true }, 'Enter to select · ↑↓ to navigate · Esc to cancel')
207
- )
208
- );
209
- }
210
-
211
- // Run the app
212
- // Check if we have an interactive terminal (required for Ink)
213
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
214
- console.error('Error: This command requires an interactive terminal.');
215
- console.error('Please run `npx evals` from your terminal (not from a script or non-interactive environment).');
216
- process.exit(1);
217
- }
218
-
219
- // Handle uncaught errors
220
- process.on('uncaughtException', (error) => {
221
- console.error('Uncaught exception:', error.message);
222
- console.error(error.stack);
223
- process.exit(1);
224
- });
225
-
226
- process.on('unhandledRejection', (reason, promise) => {
227
- console.error('Unhandled rejection at:', promise);
228
- console.error('Reason:', reason);
229
- process.exit(1);
230
- });
231
-
232
- // Ensure stdout is not buffered (important for Windows)
233
- if (process.stdout.isTTY) {
234
- process.stdout.setEncoding('utf8');
235
- }
236
-
237
- try {
238
- render(e(App), { patchConsole: false });
239
- } catch (error) {
240
- console.error('Failed to render interactive CLI:', error.message);
241
- console.error(error.stack);
242
- if (process.platform === 'win32') {
243
- console.error('\nNote: If you\'re using cmd.exe, try running in PowerShell or Git Bash instead.');
244
- }
245
- process.exit(1);
246
- }
1
+ #!/usr/bin/env node
2
+
3
+ import React, { useState, useEffect } from 'react';
4
+ import { render, Box, Text, useInput, useApp, Static } from 'ink';
5
+ import Gradient from 'ink-gradient';
6
+ import { exec } from 'child_process';
7
+
8
+ const e = React.createElement;
9
+
10
+ // Diagnostic: Uncomment to verify script is running
11
+ console.error('CLI script started, platform:', process.platform, 'isTTY:', process.stdin.isTTY);
12
+
13
+ // "ARIZE EVALS" - EXACTLY matched width (both 44 chars)
14
+ const largeLogo = `
15
+ █████╗ ██████╗ ██╗ ███████╗ ███████╗
16
+ ██╔══██╗ ██╔══██╗ ██║ ╚══███╔╝ ██╔════╝
17
+ ███████║ ██████╔╝ ██║ ███╔╝ █████╗
18
+ ██╔══██║ ██╔══██╗ ██║ ███╔╝ ██╔══╝
19
+ ██║ ██║ ██║ ██║ ██║ ███████╗ ███████╗
20
+ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝
21
+ ███████╗ ██╗ ██╗ █████╗ ██╗ ███████╗
22
+ ██╔════╝ ██║ ██║ ██╔══██╗ ██║ ██╔════╝
23
+ █████╗ ██║ ██║ ███████║ ██║ ███████╗
24
+ ██╔══╝ ╚██╗ ██╔╝ ██╔══██║ ██║ ╚════██║
25
+ ███████╗ ╚████╔╝ ██║ ██║ ███████╗███████║
26
+ ╚══════╝ ╚═══╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝`;
27
+
28
+ const mediumLogo = `
29
+ █████╗ ██████╗ ██╗ ███████╗ ███████╗
30
+ ██╔══██╗ ██╔══██╗ ██║ ╚══███╔╝ ██╔════╝
31
+ ███████║ ██████╔╝ ██║ ███╔╝ █████╗
32
+ ██╔══██║ ██╔══██╗ ██║ ███╔╝ ██╔══╝
33
+ ██║ ██║ ██║ ██║ ██║ ███████╗ ███████╗
34
+ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝
35
+ █▀▀ █ █ ▄▀█ █ █▀
36
+ ██▄ ▀▄▀ █▀█ █▄▄ ▄█`;
37
+
38
+ const smallLogo = `ARIZE
39
+ EVALS`;
40
+
41
+ const OPTIONS = [
42
+ {
43
+ name: 'Evals Primer',
44
+ subtext: 'Learn the Craft',
45
+ url: 'https://arize.com/llm-evaluation/?utm_source=npmevals'
46
+ },
47
+ {
48
+ name: 'Arize AX SaaS',
49
+ subtext: 'Enterprise Agent Evaluation, Best in Class',
50
+ url: 'https://arize.com/docs/ax?utm_source=npmevals'
51
+ },
52
+ {
53
+ name: 'Arize Phoenix',
54
+ subtext: 'OSS Agent Evals & Traces, Fully Local',
55
+ url: 'https://arize.com/docs/phoenix?utm_source=npmevals'
56
+ },
57
+ {
58
+ name: 'Book an Eval Assessment',
59
+ subtext: 'Improve Your Agent Today',
60
+ url: 'https://arize.com/get-an-eval-assessment?utm_source=npmevals'
61
+ }
62
+ ];
63
+
64
+ function openUrlInBrowser(url) {
65
+ const command = process.platform === 'win32'
66
+ ? `start ${url}`
67
+ : process.platform === 'darwin'
68
+ ? `open "${url}"`
69
+ : `xdg-open "${url}"`;
70
+
71
+ exec(command, (error) => {
72
+ if (error) {
73
+ console.error(`Failed to open browser: ${error.message}`);
74
+ }
75
+ process.exit(0);
76
+ });
77
+ }
78
+
79
+ // Header with hot pink to dark blue gradient
80
+ function Header() {
81
+ const terminalWidth = process.stdout.columns || 80;
82
+
83
+ let logo;
84
+ if (terminalWidth >= 45) {
85
+ logo = largeLogo;
86
+ } else if (terminalWidth >= 35) {
87
+ logo = mediumLogo;
88
+ } else {
89
+ logo = smallLogo;
90
+ }
91
+
92
+ return e(Box, { flexDirection: 'column', marginBottom: 1 },
93
+ e(Gradient, { colors: ['#FF008C', '#FF1493', '#8B5CF6', '#1E3A8A'] },
94
+ e(Text, null, logo)
95
+ ),
96
+ e(Text, { color: 'gray', italic: true }, 'Evals and Observability for Agentic AI')
97
+ );
98
+ }
99
+
100
+ // Character-by-character shimmer component
101
+ function ShimmerText({ text, shimmerPos }) {
102
+ const baseColor = '#FF1493';
103
+ const shimmerColors = ['#FF5AA7', '#FF85C0', '#FFB8D9', '#FFE0EE', '#FFB8D9', '#FF85C0', '#FF5AA7'];
104
+ const shimmerWidth = shimmerColors.length;
105
+
106
+ const chars = text.split('').map((char, i) => {
107
+ const distanceFromShimmer = i - shimmerPos;
108
+
109
+ let color = baseColor;
110
+ if (distanceFromShimmer >= 0 && distanceFromShimmer < shimmerWidth) {
111
+ color = shimmerColors[distanceFromShimmer];
112
+ }
113
+
114
+ return e(Text, { key: i, color, bold: true }, char);
115
+ });
116
+
117
+ return e(Box, null, ...chars);
118
+ }
119
+
120
+ // Menu item component - single line, hot pink selected with character shimmer
121
+ function MenuItem({ name, subtext, isSelected, shimmerPos }) {
122
+ if (isSelected) {
123
+ return e(Box, null,
124
+ e(Text, { bold: true, color: '#FF1493' }, '❯ '),
125
+ e(ShimmerText, { text: name, shimmerPos }),
126
+ e(Text, { color: 'gray' }, ' — ' + subtext)
127
+ );
128
+ }
129
+
130
+ return e(Box, null,
131
+ e(Text, { color: 'white' }, ' ' + name),
132
+ e(Text, { color: 'gray' }, ' — ' + subtext)
133
+ );
134
+ }
135
+
136
+ // Main App component
137
+ function App() {
138
+ const [selectedIndex, setSelectedIndex] = useState(0);
139
+ const [shimmerPos, setShimmerPos] = useState(-7); // Start off-screen
140
+ const { exit } = useApp();
141
+
142
+ const selectedName = OPTIONS[selectedIndex].name;
143
+
144
+ // Character-by-character shimmer animation
145
+ useEffect(() => {
146
+ const textLength = selectedName.length;
147
+ const shimmerWidth = 7;
148
+ const totalPositions = textLength + shimmerWidth + 5; // Extra padding for smooth loop
149
+
150
+ const timer = setInterval(() => {
151
+ setShimmerPos(prev => {
152
+ const next = prev + 1;
153
+ return next > totalPositions ? -shimmerWidth : next;
154
+ });
155
+ }, 120); // Speed of shimmer movement
156
+
157
+ return () => clearInterval(timer);
158
+ }, [selectedName]);
159
+
160
+ // Reset shimmer position when selection changes
161
+ useEffect(() => {
162
+ setShimmerPos(-7);
163
+ }, [selectedIndex]);
164
+
165
+ useInput((input, key) => {
166
+ if (input === 'q' || key.escape) {
167
+ exit();
168
+ return;
169
+ }
170
+
171
+ if (key.upArrow || input === 'k') {
172
+ setSelectedIndex(prev => (prev > 0 ? prev - 1 : OPTIONS.length - 1));
173
+ }
174
+
175
+ if (key.downArrow || input === 'j') {
176
+ setSelectedIndex(prev => (prev < OPTIONS.length - 1 ? prev + 1 : 0));
177
+ }
178
+
179
+ if (key.return) {
180
+ const selected = OPTIONS[selectedIndex];
181
+ exit();
182
+ setTimeout(() => {
183
+ console.log(`\nOpening ${selected.url} in your browser...\n`);
184
+ openUrlInBrowser(selected.url);
185
+ }, 100);
186
+ }
187
+ });
188
+
189
+ return e(Box, { flexDirection: 'column', padding: 1 },
190
+ e(Static, { items: ['header'] }, () => e(Header)),
191
+ e(Box, { marginBottom: 1 },
192
+ e(Text, { bold: true, color: 'white' }, 'Select an option:')
193
+ ),
194
+ e(Box, { flexDirection: 'column', paddingX: 1 },
195
+ ...OPTIONS.map((option, index) =>
196
+ e(MenuItem, {
197
+ key: index.toString(),
198
+ name: option.name,
199
+ subtext: option.subtext,
200
+ isSelected: index === selectedIndex,
201
+ shimmerPos: shimmerPos
202
+ })
203
+ )
204
+ ),
205
+ e(Box, { marginTop: 1 },
206
+ e(Text, { dimColor: true }, 'Enter to select · ↑↓ to navigate · Esc to cancel')
207
+ )
208
+ );
209
+ }
210
+
211
+ // Run the app
212
+ // Check if we have an interactive terminal (required for Ink)
213
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
214
+ console.error('Error: This command requires an interactive terminal.');
215
+ console.error('Please run `npx evals` from your terminal (not from a script or non-interactive environment).');
216
+ process.exit(1);
217
+ }
218
+
219
+ // Handle uncaught errors
220
+ process.on('uncaughtException', (error) => {
221
+ console.error('Uncaught exception:', error.message);
222
+ console.error(error.stack);
223
+ process.exit(1);
224
+ });
225
+
226
+ process.on('unhandledRejection', (reason, promise) => {
227
+ console.error('Unhandled rejection at:', promise);
228
+ console.error('Reason:', reason);
229
+ process.exit(1);
230
+ });
231
+
232
+ // Ensure stdout is not buffered (important for Windows)
233
+ if (process.stdout.isTTY) {
234
+ process.stdout.setEncoding('utf8');
235
+ }
236
+
237
+ try {
238
+ render(e(App), { patchConsole: false });
239
+ } catch (error) {
240
+ console.error('Failed to render interactive CLI:', error.message);
241
+ console.error(error.stack);
242
+ if (process.platform === 'win32') {
243
+ console.error('\nNote: If you\'re using cmd.exe, try running in PowerShell or Git Bash instead.');
244
+ }
245
+ process.exit(1);
246
+ }
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
- {
2
- "name": "evals",
3
- "version": "2.2.7",
4
- "description": "Arize evals package",
5
- "type": "module",
6
- "main": "cli.js",
7
- "scripts": {
8
- "postinstall": "echo \"run npx evals to complete setup\" && node spawn-interactive.js",
9
- "start": "node cli.js"
10
- },
11
- "dependencies": {
12
- "@arizeai/phoenix-evals": "^0.6.5",
13
- "@arizeai/phoenix-otel": "*",
14
- "ink": "^6.0.0",
15
- "ink-gradient": "^3.0.0",
16
- "react": "^19.0.0"
17
- },
18
- "bin": {
19
- "evals": "./cli.js"
20
- },
21
- "keywords": [
22
- "arize",
23
- "evals"
24
- ],
25
- "author": "",
26
- "license": "ISC"
27
- }
1
+ {
2
+ "name": "evals",
3
+ "version": "2.2.8",
4
+ "description": "Arize evals package",
5
+ "type": "module",
6
+ "main": "cli.js",
7
+ "scripts": {
8
+ "postinstall": "echo \"run npx evals to complete setup\" && node spawn-interactive.js",
9
+ "start": "node cli.js"
10
+ },
11
+ "dependencies": {
12
+ "@arizeai/phoenix-evals": "^0.6.5",
13
+ "@arizeai/phoenix-otel": "*",
14
+ "ink": "^6.0.0",
15
+ "ink-gradient": "^3.0.0",
16
+ "react": "^19.0.0"
17
+ },
18
+ "bin": {
19
+ "evals": "./cli.js"
20
+ },
21
+ "keywords": [
22
+ "arize",
23
+ "evals"
24
+ ],
25
+ "author": "",
26
+ "license": "ISC"
27
+ }
@@ -1,51 +1,51 @@
1
- import { spawn } from 'child_process';
2
- import { openSync } from 'fs';
3
-
4
- function tryOpenTTY() {
5
- if (process.platform === 'win32') {
6
- // On Windows, avoid CON device (issues in Node.js 22)
7
- // Use isTTY check instead, and stdio: 'inherit' for spawning
8
- if (process.stdin.isTTY && process.stdout.isTTY && process.stderr.isTTY) {
9
- return { available: true, useInherit: true };
10
- }
11
- return { available: false };
12
- } else {
13
- // On macOS/Linux, use direct /dev/tty access
14
- try {
15
- const device = '/dev/tty';
16
- openSync(device, 'r');
17
- return { device, available: true, useInherit: false };
18
- } catch (err) {
19
- return { available: false };
20
- }
21
- }
22
- }
23
-
24
- const tty = tryOpenTTY();
25
-
26
- if (tty.available) {
27
- const spawnOptions = tty.useInherit
28
- ? { stdio: 'inherit', shell: true }
29
- : {
30
- stdio: [
31
- openSync(tty.device, 'r'),
32
- openSync(tty.device, 'w'),
33
- openSync(tty.device, 'w')
34
- ]
35
- };
36
-
37
- const child = spawn('node', ['./cli.js'], spawnOptions);
38
-
39
- child.on('close', (code) => {
40
- process.exit(code || 0);
41
- });
42
-
43
- child.on('error', (err) => {
44
- console.error('Failed to start interactive CLI:', err.message);
45
- console.log('Run `npx evals` to complete setup.');
46
- process.exit(1);
47
- });
48
- } else {
49
- console.log('Run `npx evals` to complete setup.');
50
- process.exit(1);
1
+ import { spawn } from 'child_process';
2
+ import { openSync } from 'fs';
3
+
4
+ function tryOpenTTY() {
5
+ if (process.platform === 'win32') {
6
+ // On Windows, avoid CON device (issues in Node.js 22)
7
+ // Use isTTY check instead, and stdio: 'inherit' for spawning
8
+ if (process.stdin.isTTY && process.stdout.isTTY && process.stderr.isTTY) {
9
+ return { available: true, useInherit: true };
10
+ }
11
+ return { available: false };
12
+ } else {
13
+ // On macOS/Linux, use direct /dev/tty access
14
+ try {
15
+ const device = '/dev/tty';
16
+ openSync(device, 'r');
17
+ return { device, available: true, useInherit: false };
18
+ } catch (err) {
19
+ return { available: false };
20
+ }
21
+ }
22
+ }
23
+
24
+ const tty = tryOpenTTY();
25
+
26
+ if (tty.available) {
27
+ const spawnOptions = tty.useInherit
28
+ ? { stdio: 'inherit', shell: true }
29
+ : {
30
+ stdio: [
31
+ openSync(tty.device, 'r'),
32
+ openSync(tty.device, 'w'),
33
+ openSync(tty.device, 'w')
34
+ ]
35
+ };
36
+
37
+ const child = spawn('node', ['./cli.js'], spawnOptions);
38
+
39
+ child.on('close', (code) => {
40
+ process.exit(code || 0);
41
+ });
42
+
43
+ child.on('error', (err) => {
44
+ console.error('Failed to start interactive CLI:', err.message);
45
+ console.log('Run `npx evals` to complete setup.');
46
+ // process.exit(1);
47
+ });
48
+ } else {
49
+ console.log('Run `npx evals` to complete setup.');
50
+ // process.exit(1);
51
51
  }