evals 1.0.7 → 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.
- package/README.md +30 -80
- package/cli.js +209 -0
- package/package.json +16 -30
- package/LICENSE +0 -7
- package/dist/index.js +0 -15372
- package/src/index.js +0 -190
package/README.md
CHANGED
|
@@ -1,103 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# evals
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An npm package for Arize evals functionality.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## About Arize AI
|
|
6
6
|
|
|
7
|
-
|
|
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
8
|
|
|
9
|
-
|
|
9
|
+
## Arize Phoenix
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
npm install evals
|
|
13
|
-
```
|
|
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:
|
|
14
12
|
|
|
15
|
-
|
|
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
16
|
|
|
17
|
-
-
|
|
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
18
|
|
|
19
|
-
##
|
|
19
|
+
## Arize AX
|
|
20
20
|
|
|
21
|
-
|
|
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
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
These can be set in your `~/.bashrc` or `~/.zshrc` file on Mac or Linux, or in your `~/.bash_profile` file on Windows.
|
|
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
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
export UMBRAGE_EVALS_API_KEY=<your api key for the umbrage evals project>
|
|
34
|
-
export OPENAI_API_KEY=<your openai api key>
|
|
35
|
-
```
|
|
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.
|
|
36
30
|
|
|
37
|
-
To save the file, press `Ctrl + X`, then `Y`, then `Enter`. Then, run `source ~/.bashrc` or `source ~/.zshrc` on Mac or Linux, or `source ~/.bash_profile` on Windows.
|
|
38
31
|
|
|
39
|
-
##
|
|
32
|
+
## Installation
|
|
40
33
|
|
|
41
34
|
```bash
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
npx evals@latest run-evals
|
|
35
|
+
npm install evals
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
export interface ModelSettings {
|
|
51
|
-
temperature: number;
|
|
52
|
-
[key: string]: any;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface Prompt {
|
|
56
|
-
prompt_type: string;
|
|
57
|
-
prompt_text: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface Config {
|
|
61
|
-
promptName: string;
|
|
62
|
-
modelName: string;
|
|
63
|
-
modelSettings: ModelSettings;
|
|
64
|
-
environment: string;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
class BaseModel {
|
|
68
|
-
promptName: string;
|
|
69
|
-
modelName: string;
|
|
70
|
-
modelSettings: ModelSettings;
|
|
71
|
-
environment: string;
|
|
72
|
-
|
|
73
|
-
constructor(config: Config) {
|
|
74
|
-
this.promptName = config.promptName;
|
|
75
|
-
this.modelName = config.modelName;
|
|
76
|
-
this.modelSettings = config.modelSettings;
|
|
77
|
-
this.environment = config.environment || 'development';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* This method should be overridden in subclasses.
|
|
82
|
-
* It should return an object containing the response and the prompts array.
|
|
83
|
-
* @param userMessage The user message to be processed by the model, optional.
|
|
84
|
-
* @returns Promise<{ response: string, prompts: Prompt[] }>
|
|
85
|
-
*/
|
|
86
|
-
async callModel(userMessage: string = ''): Promise<{ response: string; prompts: Prompt[] }> {
|
|
87
|
-
throw new Error('callModel method needs to be implemented');
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export default BaseModel;
|
|
92
|
-
```
|
|
38
|
+
The post-install script will automatically launch the CLI interface.
|
|
93
39
|
|
|
40
|
+
## Usage
|
|
94
41
|
|
|
95
|
-
|
|
42
|
+
Run the CLI manually:
|
|
96
43
|
|
|
97
|
-
|
|
44
|
+
```bash
|
|
45
|
+
npm start
|
|
46
|
+
```
|
|
98
47
|
|
|
99
|
-
|
|
48
|
+
Or use the binary:
|
|
100
49
|
|
|
101
|
-
|
|
50
|
+
```bash
|
|
51
|
+
npx evals
|
|
52
|
+
```
|
|
102
53
|
|
|
103
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/cli.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
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
|
+
// "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`;
|
|
37
|
+
|
|
38
|
+
const OPTIONS = [
|
|
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
|
+
}
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
function openUrlInBrowser(url) {
|
|
62
|
+
const command = process.platform === 'win32'
|
|
63
|
+
? `start ${url}`
|
|
64
|
+
: process.platform === 'darwin'
|
|
65
|
+
? `open "${url}"`
|
|
66
|
+
: `xdg-open "${url}"`;
|
|
67
|
+
|
|
68
|
+
exec(command, (error) => {
|
|
69
|
+
if (error) {
|
|
70
|
+
console.error(`Failed to open browser: ${error.message}`);
|
|
71
|
+
}
|
|
72
|
+
process.exit(0);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Header with hot pink to dark blue gradient
|
|
77
|
+
function Header() {
|
|
78
|
+
const terminalWidth = process.stdout.columns || 80;
|
|
79
|
+
|
|
80
|
+
let logo;
|
|
81
|
+
if (terminalWidth >= 45) {
|
|
82
|
+
logo = largeLogo;
|
|
83
|
+
} else if (terminalWidth >= 35) {
|
|
84
|
+
logo = mediumLogo;
|
|
85
|
+
} else {
|
|
86
|
+
logo = smallLogo;
|
|
87
|
+
}
|
|
88
|
+
|
|
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
|
+
}
|
|
96
|
+
|
|
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;
|
|
102
|
+
|
|
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];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return e(Text, { key: i, color, bold: true }, char);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return e(Box, null, ...chars);
|
|
115
|
+
}
|
|
116
|
+
|
|
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
|
+
}
|
|
126
|
+
|
|
127
|
+
return e(Box, null,
|
|
128
|
+
e(Text, { color: 'white' }, ' ' + name),
|
|
129
|
+
e(Text, { color: 'gray' }, ' — ' + subtext)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
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
|
+
}
|
|
167
|
+
|
|
168
|
+
if (key.upArrow || input === 'k') {
|
|
169
|
+
setSelectedIndex(prev => (prev > 0 ? prev - 1 : OPTIONS.length - 1));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (key.downArrow || input === 'j') {
|
|
173
|
+
setSelectedIndex(prev => (prev < OPTIONS.length - 1 ? prev + 1 : 0));
|
|
174
|
+
}
|
|
175
|
+
|
|
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
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Run the app
|
|
209
|
+
render(e(App), { patchConsole: false });
|
package/package.json
CHANGED
|
@@ -1,40 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evals",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Arize evals package",
|
|
6
5
|
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
"description": "Umbrage Evals CLI",
|
|
9
|
-
"bin": {
|
|
10
|
-
"evals": "./src/index.js"
|
|
11
|
-
},
|
|
6
|
+
"main": "cli.js",
|
|
12
7
|
"scripts": {
|
|
13
|
-
"
|
|
8
|
+
"postinstall": "node cli.js",
|
|
9
|
+
"start": "node cli.js"
|
|
14
10
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@arizeai/phoenix-otel": "*",
|
|
13
|
+
"ink": "^6.0.0",
|
|
14
|
+
"ink-gradient": "^3.0.0",
|
|
15
|
+
"react": "^19.0.0"
|
|
20
16
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
17
|
+
"bin": {
|
|
18
|
+
"evals": "./cli.js"
|
|
23
19
|
},
|
|
24
20
|
"keywords": [
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"ai",
|
|
28
|
-
"cli"
|
|
29
|
-
],
|
|
30
|
-
"author": "umbrage.ai",
|
|
31
|
-
"license": "UNLICENSED",
|
|
32
|
-
"files": [
|
|
33
|
-
"dist/*.js",
|
|
34
|
-
"dist/*.d.ts"
|
|
21
|
+
"arize",
|
|
22
|
+
"evals"
|
|
35
23
|
],
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"openai": "^4.24.1"
|
|
39
|
-
}
|
|
24
|
+
"author": "",
|
|
25
|
+
"license": "ISC"
|
|
40
26
|
}
|
package/LICENSE
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2023 Umbrage Studios, LLC
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|