@fabricorg/experiments-evals 0.2.0 → 1.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.
@@ -1,4 +1,4 @@
1
- import { M as ModelClient, C as ChatMessage, g as ModelCompletionOptions, h as ModelResponse } from './model-client-B7yk_i1s.cjs';
1
+ import { M as ModelClient, C as ChatMessage, m as ModelCompletionOptions, n as ModelResponse, R as RunItem, S as ScoredItem, j as ExecuteResult, E as Evaluator } from './runner-Kga7ABQA.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /** Authentication accepted by Databricks workspace APIs. */
@@ -76,201 +76,25 @@ declare const MlflowRunResponse: z.ZodObject<{
76
76
  end_time: z.ZodOptional<z.ZodNumber>;
77
77
  artifact_uri: z.ZodOptional<z.ZodString>;
78
78
  run_name: z.ZodOptional<z.ZodString>;
79
- }, "strip", z.ZodTypeAny, {
80
- status: string;
81
- run_id: string;
82
- experiment_id: string;
83
- start_time?: number | undefined;
84
- end_time?: number | undefined;
85
- artifact_uri?: string | undefined;
86
- run_name?: string | undefined;
87
- }, {
88
- status: string;
89
- run_id: string;
90
- experiment_id: string;
91
- start_time?: number | undefined;
92
- end_time?: number | undefined;
93
- artifact_uri?: string | undefined;
94
- run_name?: string | undefined;
95
- }>;
79
+ }, z.core.$strip>;
96
80
  data: z.ZodDefault<z.ZodObject<{
97
81
  metrics: z.ZodDefault<z.ZodArray<z.ZodObject<{
98
82
  key: z.ZodString;
99
83
  value: z.ZodNumber;
100
84
  timestamp: z.ZodOptional<z.ZodNumber>;
101
85
  step: z.ZodOptional<z.ZodNumber>;
102
- }, "strip", z.ZodTypeAny, {
103
- value: number;
104
- key: string;
105
- timestamp?: number | undefined;
106
- step?: number | undefined;
107
- }, {
108
- value: number;
109
- key: string;
110
- timestamp?: number | undefined;
111
- step?: number | undefined;
112
- }>, "many">>;
86
+ }, z.core.$strip>>>;
113
87
  params: z.ZodDefault<z.ZodArray<z.ZodObject<{
114
88
  key: z.ZodString;
115
89
  value: z.ZodString;
116
- }, "strip", z.ZodTypeAny, {
117
- value: string;
118
- key: string;
119
- }, {
120
- value: string;
121
- key: string;
122
- }>, "many">>;
90
+ }, z.core.$strip>>>;
123
91
  tags: z.ZodDefault<z.ZodArray<z.ZodObject<{
124
92
  key: z.ZodString;
125
93
  value: z.ZodString;
126
- }, "strip", z.ZodTypeAny, {
127
- value: string;
128
- key: string;
129
- }, {
130
- value: string;
131
- key: string;
132
- }>, "many">>;
133
- }, "strip", z.ZodTypeAny, {
134
- params: {
135
- value: string;
136
- key: string;
137
- }[];
138
- metrics: {
139
- value: number;
140
- key: string;
141
- timestamp?: number | undefined;
142
- step?: number | undefined;
143
- }[];
144
- tags: {
145
- value: string;
146
- key: string;
147
- }[];
148
- }, {
149
- params?: {
150
- value: string;
151
- key: string;
152
- }[] | undefined;
153
- metrics?: {
154
- value: number;
155
- key: string;
156
- timestamp?: number | undefined;
157
- step?: number | undefined;
158
- }[] | undefined;
159
- tags?: {
160
- value: string;
161
- key: string;
162
- }[] | undefined;
163
- }>>;
164
- }, "strip", z.ZodTypeAny, {
165
- info: {
166
- status: string;
167
- run_id: string;
168
- experiment_id: string;
169
- start_time?: number | undefined;
170
- end_time?: number | undefined;
171
- artifact_uri?: string | undefined;
172
- run_name?: string | undefined;
173
- };
174
- data: {
175
- params: {
176
- value: string;
177
- key: string;
178
- }[];
179
- metrics: {
180
- value: number;
181
- key: string;
182
- timestamp?: number | undefined;
183
- step?: number | undefined;
184
- }[];
185
- tags: {
186
- value: string;
187
- key: string;
188
- }[];
189
- };
190
- }, {
191
- info: {
192
- status: string;
193
- run_id: string;
194
- experiment_id: string;
195
- start_time?: number | undefined;
196
- end_time?: number | undefined;
197
- artifact_uri?: string | undefined;
198
- run_name?: string | undefined;
199
- };
200
- data?: {
201
- params?: {
202
- value: string;
203
- key: string;
204
- }[] | undefined;
205
- metrics?: {
206
- value: number;
207
- key: string;
208
- timestamp?: number | undefined;
209
- step?: number | undefined;
210
- }[] | undefined;
211
- tags?: {
212
- value: string;
213
- key: string;
214
- }[] | undefined;
215
- } | undefined;
216
- }>;
217
- }, "strip", z.ZodTypeAny, {
218
- run: {
219
- info: {
220
- status: string;
221
- run_id: string;
222
- experiment_id: string;
223
- start_time?: number | undefined;
224
- end_time?: number | undefined;
225
- artifact_uri?: string | undefined;
226
- run_name?: string | undefined;
227
- };
228
- data: {
229
- params: {
230
- value: string;
231
- key: string;
232
- }[];
233
- metrics: {
234
- value: number;
235
- key: string;
236
- timestamp?: number | undefined;
237
- step?: number | undefined;
238
- }[];
239
- tags: {
240
- value: string;
241
- key: string;
242
- }[];
243
- };
244
- };
245
- }, {
246
- run: {
247
- info: {
248
- status: string;
249
- run_id: string;
250
- experiment_id: string;
251
- start_time?: number | undefined;
252
- end_time?: number | undefined;
253
- artifact_uri?: string | undefined;
254
- run_name?: string | undefined;
255
- };
256
- data?: {
257
- params?: {
258
- value: string;
259
- key: string;
260
- }[] | undefined;
261
- metrics?: {
262
- value: number;
263
- key: string;
264
- timestamp?: number | undefined;
265
- step?: number | undefined;
266
- }[] | undefined;
267
- tags?: {
268
- value: string;
269
- key: string;
270
- }[] | undefined;
271
- } | undefined;
272
- };
273
- }>;
94
+ }, z.core.$strip>>>;
95
+ }, z.core.$strip>>;
96
+ }, z.core.$strip>;
97
+ }, z.core.$strip>;
274
98
  type DatabricksMlflowRun = z.infer<typeof MlflowRunResponse>['run'];
275
99
  interface DatabricksMlflowClientConfig {
276
100
  host: string;
@@ -305,4 +129,40 @@ declare function parseMlflowMetricGates(value: string): MlflowMetricGate[];
305
129
  /** Evaluate release policy over metrics already computed and retained by MLflow. */
306
130
  declare function evaluateMlflowMetricGates(run: DatabricksMlflowRun, gates: readonly MlflowMetricGate[]): MlflowGateResult[];
307
131
 
308
- export { type DatabricksAuth, DatabricksBearerProvider, DatabricksMlflowClient, type DatabricksMlflowClientConfig, type DatabricksMlflowRun, DatabricksModelClient, type DatabricksModelClientConfig, type MlflowGateOperator, type MlflowGateResult, type MlflowMetricGate, evaluateMlflowMetricGates, normalizeDatabricksHost, parseMlflowMetricGates };
132
+ interface Mlflow3EvaluationRecord {
133
+ inputs: Record<string, unknown>;
134
+ outputs: unknown;
135
+ expectations?: Record<string, unknown>;
136
+ tags?: Record<string, string>;
137
+ metadata?: Record<string, unknown>;
138
+ }
139
+ interface MlflowRecordProvenance {
140
+ promptId?: string;
141
+ promptVersion?: string | number;
142
+ model?: string;
143
+ }
144
+ interface MlflowEvaluationRecordOptions {
145
+ datasetId: string;
146
+ datasetVersion: number;
147
+ datasetVersionHash?: string;
148
+ modelEndpoint?: string;
149
+ provenance?: MlflowRecordProvenance;
150
+ itemProvenance?: (item: RunItem) => MlflowRecordProvenance;
151
+ mapInputs?: (item: RunItem) => Record<string, unknown>;
152
+ mapOutputs?: (item: RunItem) => unknown;
153
+ mapExpectations?: (item: RunItem) => Record<string, unknown> | undefined;
154
+ tags?: (item: RunItem) => Record<string, string>;
155
+ metadata?: (item: RunItem) => Record<string, unknown>;
156
+ scores?: readonly ScoredItem[];
157
+ execution?: {
158
+ result: Pick<ExecuteResult, 'scores' | 'failures'>;
159
+ evaluators: readonly Pick<Evaluator, 'name' | 'version'>[];
160
+ };
161
+ passThreshold?: number;
162
+ }
163
+ /** Build v1 records from precomputed outputs without performing I/O. */
164
+ declare function buildMlflowEvaluationRecords(items: readonly RunItem[], options: MlflowEvaluationRecordOptions): Mlflow3EvaluationRecord[];
165
+ /** Preserve record order and terminate each compact JSON record with LF. */
166
+ declare function serializeMlflowEvaluationRecords(records: readonly Mlflow3EvaluationRecord[]): string;
167
+
168
+ export { type DatabricksAuth, DatabricksBearerProvider, DatabricksMlflowClient, type DatabricksMlflowClientConfig, type DatabricksMlflowRun, DatabricksModelClient, type DatabricksModelClientConfig, type Mlflow3EvaluationRecord, type MlflowEvaluationRecordOptions, type MlflowGateOperator, type MlflowGateResult, type MlflowMetricGate, type MlflowRecordProvenance, buildMlflowEvaluationRecords, evaluateMlflowMetricGates, normalizeDatabricksHost, parseMlflowMetricGates, serializeMlflowEvaluationRecords };
@@ -1,4 +1,4 @@
1
- import { M as ModelClient, C as ChatMessage, g as ModelCompletionOptions, h as ModelResponse } from './model-client-B7yk_i1s.js';
1
+ import { M as ModelClient, C as ChatMessage, m as ModelCompletionOptions, n as ModelResponse, R as RunItem, S as ScoredItem, j as ExecuteResult, E as Evaluator } from './runner-Kga7ABQA.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /** Authentication accepted by Databricks workspace APIs. */
@@ -76,201 +76,25 @@ declare const MlflowRunResponse: z.ZodObject<{
76
76
  end_time: z.ZodOptional<z.ZodNumber>;
77
77
  artifact_uri: z.ZodOptional<z.ZodString>;
78
78
  run_name: z.ZodOptional<z.ZodString>;
79
- }, "strip", z.ZodTypeAny, {
80
- status: string;
81
- run_id: string;
82
- experiment_id: string;
83
- start_time?: number | undefined;
84
- end_time?: number | undefined;
85
- artifact_uri?: string | undefined;
86
- run_name?: string | undefined;
87
- }, {
88
- status: string;
89
- run_id: string;
90
- experiment_id: string;
91
- start_time?: number | undefined;
92
- end_time?: number | undefined;
93
- artifact_uri?: string | undefined;
94
- run_name?: string | undefined;
95
- }>;
79
+ }, z.core.$strip>;
96
80
  data: z.ZodDefault<z.ZodObject<{
97
81
  metrics: z.ZodDefault<z.ZodArray<z.ZodObject<{
98
82
  key: z.ZodString;
99
83
  value: z.ZodNumber;
100
84
  timestamp: z.ZodOptional<z.ZodNumber>;
101
85
  step: z.ZodOptional<z.ZodNumber>;
102
- }, "strip", z.ZodTypeAny, {
103
- value: number;
104
- key: string;
105
- timestamp?: number | undefined;
106
- step?: number | undefined;
107
- }, {
108
- value: number;
109
- key: string;
110
- timestamp?: number | undefined;
111
- step?: number | undefined;
112
- }>, "many">>;
86
+ }, z.core.$strip>>>;
113
87
  params: z.ZodDefault<z.ZodArray<z.ZodObject<{
114
88
  key: z.ZodString;
115
89
  value: z.ZodString;
116
- }, "strip", z.ZodTypeAny, {
117
- value: string;
118
- key: string;
119
- }, {
120
- value: string;
121
- key: string;
122
- }>, "many">>;
90
+ }, z.core.$strip>>>;
123
91
  tags: z.ZodDefault<z.ZodArray<z.ZodObject<{
124
92
  key: z.ZodString;
125
93
  value: z.ZodString;
126
- }, "strip", z.ZodTypeAny, {
127
- value: string;
128
- key: string;
129
- }, {
130
- value: string;
131
- key: string;
132
- }>, "many">>;
133
- }, "strip", z.ZodTypeAny, {
134
- params: {
135
- value: string;
136
- key: string;
137
- }[];
138
- metrics: {
139
- value: number;
140
- key: string;
141
- timestamp?: number | undefined;
142
- step?: number | undefined;
143
- }[];
144
- tags: {
145
- value: string;
146
- key: string;
147
- }[];
148
- }, {
149
- params?: {
150
- value: string;
151
- key: string;
152
- }[] | undefined;
153
- metrics?: {
154
- value: number;
155
- key: string;
156
- timestamp?: number | undefined;
157
- step?: number | undefined;
158
- }[] | undefined;
159
- tags?: {
160
- value: string;
161
- key: string;
162
- }[] | undefined;
163
- }>>;
164
- }, "strip", z.ZodTypeAny, {
165
- info: {
166
- status: string;
167
- run_id: string;
168
- experiment_id: string;
169
- start_time?: number | undefined;
170
- end_time?: number | undefined;
171
- artifact_uri?: string | undefined;
172
- run_name?: string | undefined;
173
- };
174
- data: {
175
- params: {
176
- value: string;
177
- key: string;
178
- }[];
179
- metrics: {
180
- value: number;
181
- key: string;
182
- timestamp?: number | undefined;
183
- step?: number | undefined;
184
- }[];
185
- tags: {
186
- value: string;
187
- key: string;
188
- }[];
189
- };
190
- }, {
191
- info: {
192
- status: string;
193
- run_id: string;
194
- experiment_id: string;
195
- start_time?: number | undefined;
196
- end_time?: number | undefined;
197
- artifact_uri?: string | undefined;
198
- run_name?: string | undefined;
199
- };
200
- data?: {
201
- params?: {
202
- value: string;
203
- key: string;
204
- }[] | undefined;
205
- metrics?: {
206
- value: number;
207
- key: string;
208
- timestamp?: number | undefined;
209
- step?: number | undefined;
210
- }[] | undefined;
211
- tags?: {
212
- value: string;
213
- key: string;
214
- }[] | undefined;
215
- } | undefined;
216
- }>;
217
- }, "strip", z.ZodTypeAny, {
218
- run: {
219
- info: {
220
- status: string;
221
- run_id: string;
222
- experiment_id: string;
223
- start_time?: number | undefined;
224
- end_time?: number | undefined;
225
- artifact_uri?: string | undefined;
226
- run_name?: string | undefined;
227
- };
228
- data: {
229
- params: {
230
- value: string;
231
- key: string;
232
- }[];
233
- metrics: {
234
- value: number;
235
- key: string;
236
- timestamp?: number | undefined;
237
- step?: number | undefined;
238
- }[];
239
- tags: {
240
- value: string;
241
- key: string;
242
- }[];
243
- };
244
- };
245
- }, {
246
- run: {
247
- info: {
248
- status: string;
249
- run_id: string;
250
- experiment_id: string;
251
- start_time?: number | undefined;
252
- end_time?: number | undefined;
253
- artifact_uri?: string | undefined;
254
- run_name?: string | undefined;
255
- };
256
- data?: {
257
- params?: {
258
- value: string;
259
- key: string;
260
- }[] | undefined;
261
- metrics?: {
262
- value: number;
263
- key: string;
264
- timestamp?: number | undefined;
265
- step?: number | undefined;
266
- }[] | undefined;
267
- tags?: {
268
- value: string;
269
- key: string;
270
- }[] | undefined;
271
- } | undefined;
272
- };
273
- }>;
94
+ }, z.core.$strip>>>;
95
+ }, z.core.$strip>>;
96
+ }, z.core.$strip>;
97
+ }, z.core.$strip>;
274
98
  type DatabricksMlflowRun = z.infer<typeof MlflowRunResponse>['run'];
275
99
  interface DatabricksMlflowClientConfig {
276
100
  host: string;
@@ -305,4 +129,40 @@ declare function parseMlflowMetricGates(value: string): MlflowMetricGate[];
305
129
  /** Evaluate release policy over metrics already computed and retained by MLflow. */
306
130
  declare function evaluateMlflowMetricGates(run: DatabricksMlflowRun, gates: readonly MlflowMetricGate[]): MlflowGateResult[];
307
131
 
308
- export { type DatabricksAuth, DatabricksBearerProvider, DatabricksMlflowClient, type DatabricksMlflowClientConfig, type DatabricksMlflowRun, DatabricksModelClient, type DatabricksModelClientConfig, type MlflowGateOperator, type MlflowGateResult, type MlflowMetricGate, evaluateMlflowMetricGates, normalizeDatabricksHost, parseMlflowMetricGates };
132
+ interface Mlflow3EvaluationRecord {
133
+ inputs: Record<string, unknown>;
134
+ outputs: unknown;
135
+ expectations?: Record<string, unknown>;
136
+ tags?: Record<string, string>;
137
+ metadata?: Record<string, unknown>;
138
+ }
139
+ interface MlflowRecordProvenance {
140
+ promptId?: string;
141
+ promptVersion?: string | number;
142
+ model?: string;
143
+ }
144
+ interface MlflowEvaluationRecordOptions {
145
+ datasetId: string;
146
+ datasetVersion: number;
147
+ datasetVersionHash?: string;
148
+ modelEndpoint?: string;
149
+ provenance?: MlflowRecordProvenance;
150
+ itemProvenance?: (item: RunItem) => MlflowRecordProvenance;
151
+ mapInputs?: (item: RunItem) => Record<string, unknown>;
152
+ mapOutputs?: (item: RunItem) => unknown;
153
+ mapExpectations?: (item: RunItem) => Record<string, unknown> | undefined;
154
+ tags?: (item: RunItem) => Record<string, string>;
155
+ metadata?: (item: RunItem) => Record<string, unknown>;
156
+ scores?: readonly ScoredItem[];
157
+ execution?: {
158
+ result: Pick<ExecuteResult, 'scores' | 'failures'>;
159
+ evaluators: readonly Pick<Evaluator, 'name' | 'version'>[];
160
+ };
161
+ passThreshold?: number;
162
+ }
163
+ /** Build v1 records from precomputed outputs without performing I/O. */
164
+ declare function buildMlflowEvaluationRecords(items: readonly RunItem[], options: MlflowEvaluationRecordOptions): Mlflow3EvaluationRecord[];
165
+ /** Preserve record order and terminate each compact JSON record with LF. */
166
+ declare function serializeMlflowEvaluationRecords(records: readonly Mlflow3EvaluationRecord[]): string;
167
+
168
+ export { type DatabricksAuth, DatabricksBearerProvider, DatabricksMlflowClient, type DatabricksMlflowClientConfig, type DatabricksMlflowRun, DatabricksModelClient, type DatabricksModelClientConfig, type Mlflow3EvaluationRecord, type MlflowEvaluationRecordOptions, type MlflowGateOperator, type MlflowGateResult, type MlflowMetricGate, type MlflowRecordProvenance, buildMlflowEvaluationRecords, evaluateMlflowMetricGates, normalizeDatabricksHost, parseMlflowMetricGates, serializeMlflowEvaluationRecords };