evals 2.0.0 → 2.1.0

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 (3) hide show
  1. package/README.md +28 -1
  2. package/cli.js +176 -199
  3. package/package.json +6 -4
package/README.md CHANGED
@@ -2,10 +2,37 @@
2
2
 
3
3
  An npm package for Arize evals functionality.
4
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
+
5
32
  ## Installation
6
33
 
7
34
  ```bash
8
- npm install
35
+ npm install evals
9
36
  ```
10
37
 
11
38
  The post-install script will automatically launch the CLI interface.
package/cli.js CHANGED
@@ -1,88 +1,70 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const blessed = require('blessed');
4
- const { exec } = require('child_process');
5
-
6
- const LOGO_105 = `
7
- {#FF008C-fg} {black-fg} @@@@{/black-fg} {/#FF008C-fg}
8
- {#FF008C-fg} ** {black-fg} @@@@{/black-fg} {/#FF008C-fg}
9
- {#FF008C-fg} ****** {black-fg} {/black-fg} {/#FF008C-fg}
10
- {#FF008C-fg} ******** {black-fg}@@@@@@ @@@@ @@@ @@@ @@@@ @@@@@@@@@@@@@ @@@@@@{/black-fg} {/#FF008C-fg}
11
- {#FF008C-fg} *********** {black-fg}@@@@@@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@{/black-fg} {/#FF008C-fg}
12
- {#FF008C-fg} ****** ****** {black-fg}@@@@@ @@@@@@ @@@@@@@ @@@@ @@@@@@ @@@@@@ @@@@@{/black-fg} {/#FF008C-fg}
13
- {#FF008C-fg} ****** ****** {black-fg}@@@@@ @@@@@ @@@@@ @@@@ @@@@@ @@@@ @@@@{/black-fg}{/#FF008C-fg}
14
- {#FF008C-fg} ****** ****** {black-fg}@@@@ @@@@ @@@@ @@@@ @@@@@@ @@@@@@@@@@@@@@@@{/black-fg}{/#FF008C-fg}
15
- {#FF008C-fg} ****** ****** {black-fg}@@@@ @@@@@ @@@@ @@@@ @@@@@ @@@@@@@@@@@@@@@@{/black-fg}{/#FF008C-fg}
16
- {#FF008C-fg} ****** ****** {black-fg}@@@@@ @@@@@@ @@@@ @@@@ @@@@@ @@@@@ {/black-fg}{/#FF008C-fg}
17
- {#FF008C-fg} ***** ***** {black-fg}@@@@@@@@@@@@@@@@ @@@@ @@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@@@@{/black-fg} {/#FF008C-fg}
18
- {#FF008C-fg} * **** * {black-fg}@@@@@@@@@ @@@@ @@@@ @@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@{/black-fg} {/#FF008C-fg}
19
- {#FF008C-fg} ****** {/#FF008C-fg}
20
- {#FF008C-fg} ***** {/#FF008C-fg}
21
- `;
22
-
23
- const LOGO_75 = `
24
- {#FF008C-fg} {black-fg}@@@@{/black-fg} {/#FF008C-fg}
25
- {#FF008C-fg} ***** {black-fg}@@@@{/black-fg} {/#FF008C-fg}
26
- {#FF008C-fg} ******* {black-fg}@@@@@@@@@@ @@@@@@@ @@@@ @@@@@@@@@@ @@@@@@@@@{/black-fg} {/#FF008C-fg}
27
- {#FF008C-fg} ***** ***** {black-fg}@@@@@ @@@@@ @@@@@@@ @@@@ @@@@@@@@@ @@@@@ @@@@{/black-fg}{/#FF008C-fg}
28
- {#FF008C-fg} ***** ***** {black-fg}@@@ @@@ @@@@ @@@@ @@@@ @@@@@@@@@@@@{/black-fg}{/#FF008C-fg}
29
- {#FF008C-fg} ***** ***** {black-fg}@@@ @@@ @@@ @@@@ @@@@@ @@@@@@ {/black-fg}{/#FF008C-fg}
30
- {#FF008C-fg} **** ***** {black-fg}@@@@@@@@@@@@ @@@ @@@@ @@@@@@@@@@ @@@@@@@@@@@{/black-fg}{/#FF008C-fg}
31
- {#FF008C-fg} * *** * {black-fg}@@@@@@@@@@ @@@ @@@@ @@@@@@@@@@ @@@@@@@@{/black-fg} {/#FF008C-fg}
32
- {#FF008C-fg} ***** {/#FF008C-fg}
33
- `
34
-
35
- const LOGO_51 = `
36
- {#FF008C-fg} * {black-fg}@@@{/black-fg} {/#FF008C-fg}
37
- {#FF008C-fg} **** {/#FF008C-fg}
38
- {#FF008C-fg} ****** {black-fg} @@@@@@@@ @@@@@ @@ @@@@@@@ @@@@@@ {/black-fg}{/#FF008C-fg}
39
- {#FF008C-fg} **** **** {black-fg}@@ @@@ @@ @@ @@@ @@@@ @@@{/black-fg}{/#FF008C-fg}
40
- {#FF008C-fg}**** *** {black-fg}@@ @@@ @@ @@ @@@ @@ {/black-fg}{/#FF008C-fg}
41
- {#FF008C-fg}** * *** {black-fg}@@@@@@@@ @@ @@ @@@@@@@ @@@@@@@{/black-fg}{/#FF008C-fg}
42
- {#FF008C-fg} *** {/#FF008C-fg}
43
- `
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
+ // "ARIZE EVALS" - EXACTLY matched width (both 44 chars)
11
+ const largeLogo = `
12
+ █████╗ ██████╗ ██╗ ███████╗ ███████╗
13
+ ██╔══██╗ ██╔══██╗ ██║ ╚══███╔╝ ██╔════╝
14
+ ███████║ ██████╔╝ ██║ ███╔╝ █████╗
15
+ ██╔══██║ ██╔══██╗ ██║ ███╔╝ ██╔══╝
16
+ ██║ ██║ ██║ ██║ ██║ ███████╗ ███████╗
17
+ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝
18
+ ███████╗ ██╗ ██╗ █████╗ ██╗ ███████╗
19
+ ██╔════╝ ██║ ██║ ██╔══██╗ ██║ ██╔════╝
20
+ █████╗ ██║ ██║ ███████║ ██║ ███████╗
21
+ ██╔══╝ ╚██╗ ██╔╝ ██╔══██║ ██║ ╚════██║
22
+ ███████╗ ╚████╔╝ ██║ ██║ ███████╗███████║
23
+ ╚══════╝ ╚═══╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝`;
24
+
25
+ const mediumLogo = `
26
+ █████╗ ██████╗ ██╗ ███████╗ ███████╗
27
+ ██╔══██╗ ██╔══██╗ ██║ ╚══███╔╝ ██╔════╝
28
+ ███████║ ██████╔╝ ██║ ███╔╝ █████╗
29
+ ██╔══██║ ██╔══██╗ ██║ ███╔╝ ██╔══╝
30
+ ██║ ██║ ██║ ██║ ██║ ███████╗ ███████╗
31
+ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝
32
+ █▀▀ █ █ ▄▀█ █ █▀
33
+ ██▄ ▀▄▀ █▀█ █▄▄ ▄█`;
34
+
35
+ const smallLogo = `ARIZE
36
+ EVALS`;
44
37
 
45
38
  const OPTIONS = [
46
- { name: '1. Getting started with AI? Learn about evals.', value: 'option1' },
47
- { name: '2. Arize is now installed! Learn how to integrate it into your app.', value: 'option2' },
48
- { name: '3. I want to see what Arize does', value: 'option3' },
49
- { name: '4. I want to speak to an Arize expert', value: 'option4' }
50
- ];
51
-
52
- function detectColorMode() {
53
- // COLORFGBG format is typically "foreground;background" (e.g., "15;0")
54
- const colorfgbg = process.env.COLORFGBG;
55
- if (!colorfgbg) {
56
- // Default to dark mode if COLORFGBG is not set
57
- return 'dark';
39
+ {
40
+ name: 'Evals Primer',
41
+ subtext: 'Learn the Craft',
42
+ url: 'https://arize.com/llm-evaluation/?utm_source=npmevals'
43
+ },
44
+ {
45
+ name: 'Arize AX SaaS',
46
+ subtext: 'Enterprise Agent Evaluation, Best in Class',
47
+ url: 'https://arize.com/docs/ax?utm_source=npmevals'
48
+ },
49
+ {
50
+ name: 'Arize Phoenix',
51
+ subtext: 'OSS Agent Evals & Traces, Fully Local',
52
+ url: 'https://arize.com/docs/phoenix?utm_source=npmevals'
53
+ },
54
+ {
55
+ name: 'Book an Eval Assessment',
56
+ subtext: 'Improve Your Agent Today',
57
+ url: 'https://arize.com/get-an-eval-assessment?utm_source=npmevals'
58
58
  }
59
-
60
- const parts = colorfgbg.split(';');
61
- if (parts.length < 2) {
62
- return 'dark';
63
- }
64
-
65
- const bgColor = parseInt(parts[parts.length - 1], 10);
66
-
67
- // Background colors: 0 = black (dark), 7 = white (light), 15 = bright white (light)
68
- // Also consider 8-15 as potentially light colors
69
- if (bgColor === 0 || (bgColor >= 1 && bgColor <= 6)) {
70
- return 'dark';
71
- } else {
72
- return 'light';
73
- }
74
- }
59
+ ];
75
60
 
76
61
  function openUrlInBrowser(url) {
77
- console.log(`\nOpening ${url} in your browser...\n`);
78
-
79
- // Open URL in browser (works on macOS, Linux, and Windows)
80
- const command = process.platform === 'win32'
81
- ? `start ${url}`
82
- : process.platform === 'darwin'
83
- ? `open "${url}"`
62
+ const command = process.platform === 'win32'
63
+ ? `start ${url}`
64
+ : process.platform === 'darwin'
65
+ ? `open "${url}"`
84
66
  : `xdg-open "${url}"`;
85
-
67
+
86
68
  exec(command, (error) => {
87
69
  if (error) {
88
70
  console.error(`Failed to open browser: ${error.message}`);
@@ -91,142 +73,137 @@ function openUrlInBrowser(url) {
91
73
  });
92
74
  }
93
75
 
94
- function showMenu() {
95
- // Create a screen object
96
- const screen = blessed.screen({
97
- smartCSR: true,
98
- title: 'Arize Evals'
99
- });
76
+ // Header with hot pink to dark blue gradient
77
+ function Header() {
78
+ const terminalWidth = process.stdout.columns || 80;
100
79
 
101
- // Detect color mode from COLORFGBG
102
- const colorMode = detectColorMode();
103
- const isLightMode = colorMode === 'light';
104
-
105
- // Select logo based on terminal width
106
- const width = process.stdout.columns;
107
- let selectedLogo;
108
- let logoHeight;
109
- let leftMargin;
110
- if (width >= 105) {
111
- selectedLogo = LOGO_105;
112
- logoHeight = 16
113
- leftMargin = 4
114
- } else if (width >= 75) {
115
- selectedLogo = LOGO_75;
116
- logoHeight = 11
117
- leftMargin = 2
80
+ let logo;
81
+ if (terminalWidth >= 45) {
82
+ logo = largeLogo;
83
+ } else if (terminalWidth >= 35) {
84
+ logo = mediumLogo;
118
85
  } else {
119
- selectedLogo = LOGO_51;
120
- logoHeight = 9
121
- leftMargin = 0
86
+ logo = smallLogo;
122
87
  }
123
88
 
124
- // Create a box for the ASCII art
125
- const artBox = blessed.box({
126
- top: 2,
127
- left: 0,
128
- width: '100%',
129
- height: 'shrink',
130
- content: selectedLogo,
131
- tags: true,
132
- style: {
133
- bg: '#fff'
134
- }
135
- });
89
+ return e(Box, { flexDirection: 'column', marginBottom: 1 },
90
+ e(Gradient, { colors: ['#FF008C', '#FF1493', '#8B5CF6', '#1E3A8A'] },
91
+ e(Text, null, logo)
92
+ ),
93
+ e(Text, { color: 'gray', italic: true }, 'Evals and Observability for Agentic AI')
94
+ );
95
+ }
136
96
 
137
- // Create a box for the menu title
138
- const titleBox = blessed.box({
139
- top: logoHeight + 2,
140
- left: leftMargin,
141
- width: 'shrink',
142
- height: 1,
143
- content: 'Select an option:',
144
- tags: true,
145
- style: {
146
- fg: isLightMode ? 'black' : 'white',
147
- bold: true
148
- }
149
- });
97
+ // Character-by-character shimmer component
98
+ function ShimmerText({ text, shimmerPos }) {
99
+ const baseColor = '#FF1493';
100
+ const shimmerColors = ['#FF5AA7', '#FF85C0', '#FFB8D9', '#FFE0EE', '#FFB8D9', '#FF85C0', '#FF5AA7'];
101
+ const shimmerWidth = shimmerColors.length;
150
102
 
151
- // Create a list for the menu options
152
- const list = blessed.list({
153
- top: logoHeight + 3,
154
- left: leftMargin,
155
- width: 80,
156
- height: 8,
157
- keys: true,
158
- mouse: true,
159
- vi: true,
160
- items: OPTIONS.map(opt => opt.name),
161
- style: {
162
- selected: {
163
- bg: 'blue',
164
- fg: 'white',
165
- bold: true
166
- },
167
- item: {
168
- fg: isLightMode ? 'black' : 'white',
169
- }
170
- },
171
- border: {
172
- type: 'line'
103
+ const chars = text.split('').map((char, i) => {
104
+ const distanceFromShimmer = i - shimmerPos;
105
+
106
+ let color = baseColor;
107
+ if (distanceFromShimmer >= 0 && distanceFromShimmer < shimmerWidth) {
108
+ color = shimmerColors[distanceFromShimmer];
173
109
  }
174
- });
175
110
 
176
- // Handle selection
177
- list.on('select', (item) => {
178
- const selectedIndex = list.selected;
179
- const selectedOption = OPTIONS[selectedIndex];
180
- handleOption(selectedOption.value, screen);
111
+ return e(Text, { key: i, color, bold: true }, char);
181
112
  });
182
113
 
183
- // Handle mouse clicks
184
- list.on('click', (data) => {
185
- const selectedIndex = list.selected;
186
- const selectedOption = OPTIONS[selectedIndex];
187
- handleOption(selectedOption.value, screen);
188
- });
114
+ return e(Box, null, ...chars);
115
+ }
189
116
 
190
- // Quit on Escape, q, or Control-C
191
- screen.key(['escape', 'q', 'C-c'], () => {
192
- return screen.destroy();
193
- });
117
+ // Menu item component - single line, hot pink selected with character shimmer
118
+ function MenuItem({ name, subtext, isSelected, shimmerPos }) {
119
+ if (isSelected) {
120
+ return e(Box, null,
121
+ e(Text, { bold: true, color: '#FF1493' }, '❯ '),
122
+ e(ShimmerText, { text: name, shimmerPos }),
123
+ e(Text, { color: 'gray' }, ' — ' + subtext)
124
+ );
125
+ }
194
126
 
195
- // Append all the elements
196
- screen.append(artBox);
197
- screen.append(titleBox);
198
- screen.append(list);
127
+ return e(Box, null,
128
+ e(Text, { color: 'white' }, ' ' + name),
129
+ e(Text, { color: 'gray' }, ' — ' + subtext)
130
+ );
131
+ }
199
132
 
200
- // Focus on the list so it can receive input
201
- list.focus();
133
+ // Main App component
134
+ function App() {
135
+ const [selectedIndex, setSelectedIndex] = useState(0);
136
+ const [shimmerPos, setShimmerPos] = useState(-7); // Start off-screen
137
+ const { exit } = useApp();
138
+
139
+ const selectedName = OPTIONS[selectedIndex].name;
140
+
141
+ // Character-by-character shimmer animation
142
+ useEffect(() => {
143
+ const textLength = selectedName.length;
144
+ const shimmerWidth = 7;
145
+ const totalPositions = textLength + shimmerWidth + 5; // Extra padding for smooth loop
146
+
147
+ const timer = setInterval(() => {
148
+ setShimmerPos(prev => {
149
+ const next = prev + 1;
150
+ return next > totalPositions ? -shimmerWidth : next;
151
+ });
152
+ }, 120); // Speed of shimmer movement
153
+
154
+ return () => clearInterval(timer);
155
+ }, [selectedName]);
156
+
157
+ // Reset shimmer position when selection changes
158
+ useEffect(() => {
159
+ setShimmerPos(-7);
160
+ }, [selectedIndex]);
161
+
162
+ useInput((input, key) => {
163
+ if (input === 'q' || key.escape) {
164
+ exit();
165
+ return;
166
+ }
202
167
 
203
- // Render the screen
204
- screen.render();
205
- }
168
+ if (key.upArrow || input === 'k') {
169
+ setSelectedIndex(prev => (prev > 0 ? prev - 1 : OPTIONS.length - 1));
170
+ }
206
171
 
207
- function handleOption(option, screen) {
208
- screen.destroy();
209
- console.clear();
210
-
211
- if (option === 'option1') {
212
- openUrlInBrowser('https://arize.com/docs/ax/evaluate/evaluators');
213
- } else if (option === 'option2') {
214
- openUrlInBrowser('https://arize.com/docs/ax/observe/tracing/setup');
215
- } else if (option === 'option3') {
216
- openUrlInBrowser('https://www.youtube.com/watch?v=QPMwpX8uzUI');
217
- } else if (option === 'option4') {
218
- openUrlInBrowser('?')
219
- } else {
220
- console.log(`\nYou selected: ${option}`);
221
- console.log('(Implementation coming soon)\n');
222
- process.exit(0);
223
- }
224
- }
172
+ if (key.downArrow || input === 'j') {
173
+ setSelectedIndex(prev => (prev < OPTIONS.length - 1 ? prev + 1 : 0));
174
+ }
225
175
 
226
- // Run the CLI
227
- try {
228
- showMenu();
229
- } catch (error) {
230
- console.error('Error:', error);
231
- process.exit(1);
176
+ if (key.return) {
177
+ const selected = OPTIONS[selectedIndex];
178
+ exit();
179
+ setTimeout(() => {
180
+ console.log(`\nOpening ${selected.url} in your browser...\n`);
181
+ openUrlInBrowser(selected.url);
182
+ }, 100);
183
+ }
184
+ });
185
+
186
+ return e(Box, { flexDirection: 'column', padding: 1 },
187
+ e(Static, { items: ['header'] }, () => e(Header)),
188
+ e(Box, { marginBottom: 1 },
189
+ e(Text, { bold: true, color: 'white' }, 'Select an option:')
190
+ ),
191
+ e(Box, { flexDirection: 'column', paddingX: 1 },
192
+ ...OPTIONS.map((option, index) =>
193
+ e(MenuItem, {
194
+ key: index.toString(),
195
+ name: option.name,
196
+ subtext: option.subtext,
197
+ isSelected: index === selectedIndex,
198
+ shimmerPos: shimmerPos
199
+ })
200
+ )
201
+ ),
202
+ e(Box, { marginTop: 1 },
203
+ e(Text, { dimColor: true }, 'Enter to select · ↑↓ to navigate · Esc to cancel')
204
+ )
205
+ );
232
206
  }
207
+
208
+ // Run the app
209
+ render(e(App), { patchConsole: false });
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "evals",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Arize evals package",
5
- "main": "index.js",
5
+ "type": "module",
6
+ "main": "cli.js",
6
7
  "scripts": {
7
8
  "postinstall": "node cli.js",
8
9
  "start": "node cli.js"
9
10
  },
10
11
  "dependencies": {
11
12
  "@arizeai/phoenix-otel": "*",
12
- "blessed": "^0.1.81"
13
+ "ink": "^6.0.0",
14
+ "ink-gradient": "^3.0.0",
15
+ "react": "^19.0.0"
13
16
  },
14
17
  "bin": {
15
18
  "evals": "./cli.js"
@@ -21,4 +24,3 @@
21
24
  "author": "",
22
25
  "license": "ISC"
23
26
  }
24
-