@arizeai/phoenix-client 1.0.2 → 1.2.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 +17 -5
- package/dist/esm/__generated__/api/v1.d.ts +1809 -295
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.d.ts +48 -13
- package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.js +139 -36
- package/dist/esm/experiments/runExperiment.js.map +1 -1
- package/dist/esm/schemas/llm/constants.d.ts +1 -1
- package/dist/esm/schemas/llm/converters.d.ts +4 -4
- package/dist/esm/schemas/llm/openai/converters.d.ts +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/converters.d.ts +8 -8
- package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts +5 -5
- package/dist/esm/schemas/llm/phoenixPrompt/messageSchemas.d.ts +8 -8
- package/dist/esm/schemas/llm/schemas.d.ts +4 -4
- package/dist/esm/spans/addSpanAnnotation.d.ts +39 -0
- package/dist/esm/spans/addSpanAnnotation.d.ts.map +1 -0
- package/dist/esm/spans/addSpanAnnotation.js +44 -0
- package/dist/esm/spans/addSpanAnnotation.js.map +1 -0
- package/dist/esm/spans/index.d.ts +3 -0
- package/dist/esm/spans/index.d.ts.map +1 -0
- package/dist/esm/spans/index.js +3 -0
- package/dist/esm/spans/index.js.map +1 -0
- package/dist/esm/spans/logSpanAnnotations.d.ts +51 -0
- package/dist/esm/spans/logSpanAnnotations.d.ts.map +1 -0
- package/dist/esm/spans/logSpanAnnotations.js +53 -0
- package/dist/esm/spans/logSpanAnnotations.js.map +1 -0
- package/dist/esm/spans/types.d.ts +43 -0
- package/dist/esm/spans/types.d.ts.map +1 -0
- package/dist/esm/spans/types.js +18 -0
- package/dist/esm/spans/types.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/annotations.d.ts +2 -1
- package/dist/esm/types/annotations.d.ts.map +1 -1
- package/dist/esm/types/experiments.d.ts +1 -7
- package/dist/esm/types/experiments.d.ts.map +1 -1
- package/dist/esm/utils/formatPromptMessages.d.ts +3 -1
- package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/src/__generated__/api/v1.d.ts +1809 -295
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.d.ts +48 -13
- package/dist/src/experiments/runExperiment.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.js +138 -36
- package/dist/src/experiments/runExperiment.js.map +1 -1
- package/dist/src/schemas/llm/constants.d.ts +1 -1
- package/dist/src/schemas/llm/converters.d.ts +4 -4
- package/dist/src/schemas/llm/openai/converters.d.ts +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/converters.d.ts +8 -8
- package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts +5 -5
- package/dist/src/schemas/llm/phoenixPrompt/messageSchemas.d.ts +8 -8
- package/dist/src/schemas/llm/schemas.d.ts +4 -4
- package/dist/src/spans/addSpanAnnotation.d.ts +39 -0
- package/dist/src/spans/addSpanAnnotation.d.ts.map +1 -0
- package/dist/src/spans/addSpanAnnotation.js +59 -0
- package/dist/src/spans/addSpanAnnotation.js.map +1 -0
- package/dist/src/spans/index.d.ts +3 -0
- package/dist/src/spans/index.d.ts.map +1 -0
- package/dist/src/spans/index.js +19 -0
- package/dist/src/spans/index.js.map +1 -0
- package/dist/src/spans/logSpanAnnotations.d.ts +51 -0
- package/dist/src/spans/logSpanAnnotations.d.ts.map +1 -0
- package/dist/src/spans/logSpanAnnotations.js +68 -0
- package/dist/src/spans/logSpanAnnotations.js.map +1 -0
- package/dist/src/spans/types.d.ts +43 -0
- package/dist/src/spans/types.d.ts.map +1 -0
- package/dist/src/spans/types.js +22 -0
- package/dist/src/spans/types.js.map +1 -0
- package/dist/src/types/annotations.d.ts +2 -1
- package/dist/src/types/annotations.d.ts.map +1 -1
- package/dist/src/types/experiments.d.ts +1 -7
- package/dist/src/types/experiments.d.ts.map +1 -1
- package/dist/src/utils/formatPromptMessages.d.ts +3 -1
- package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -2
- package/src/__generated__/api/v1.ts +1809 -295
- package/src/experiments/runExperiment.ts +211 -74
- package/src/spans/addSpanAnnotation.ts +59 -0
- package/src/spans/index.ts +2 -0
- package/src/spans/logSpanAnnotations.ts +71 -0
- package/src/spans/types.ts +60 -0
- package/src/types/annotations.ts +4 -1
- package/src/types/experiments.ts +1 -7
|
@@ -1,40 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { promisifyResult } from "../utils/promisifyResult.js";
|
|
1
|
+
import { queue } from "async";
|
|
3
2
|
import invariant from "tiny-invariant";
|
|
4
|
-
import {
|
|
3
|
+
import { createClient } from "../client.js";
|
|
5
4
|
import { getDatasetBySelector } from "../utils/getDatasetBySelector.js";
|
|
5
|
+
import { pluralize } from "../utils/pluralize.js";
|
|
6
|
+
import { promisifyResult } from "../utils/promisifyResult.js";
|
|
6
7
|
/**
|
|
7
8
|
* Run an experiment.
|
|
8
9
|
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { asEvaluator, runExperiment } from "@phoenix/client/experiments";
|
|
13
|
+
*
|
|
14
|
+
* const experiment = await runExperiment({
|
|
15
|
+
* dataset: "my-dataset",
|
|
16
|
+
* task: async (example) => example.input,
|
|
17
|
+
* evaluators: [
|
|
18
|
+
* asEvaluator("my-evaluator", "CODE", async (params) => params.output),
|
|
19
|
+
* ],
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
9
23
|
* @experimental This feature is not complete, and will change in the future.
|
|
10
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
11
24
|
*/
|
|
12
|
-
export async function runExperiment({ experimentName: _experimentName, client: _client, dataset: _dataset, task, evaluators,
|
|
25
|
+
export async function runExperiment({ experimentName: _experimentName, experimentDescription, experimentMetadata, client: _client, dataset: _dataset, task, evaluators, projectName = "default", logger = console, record = true, concurrency = 5, dryRun = false, }) {
|
|
26
|
+
const isDryRun = typeof dryRun === "number" || dryRun === true;
|
|
13
27
|
const client = _client ?? createClient();
|
|
14
28
|
const dataset = await getDatasetBySelector({ dataset: _dataset, client });
|
|
15
29
|
invariant(dataset, `Dataset not found`);
|
|
16
30
|
invariant(dataset.examples.length > 0, `Dataset has no examples`);
|
|
31
|
+
const nExamples = typeof dryRun === "number"
|
|
32
|
+
? Math.max(dryRun, dataset.examples.length)
|
|
33
|
+
: dataset.examples.length;
|
|
17
34
|
const experimentName = _experimentName ?? `${dataset.name}-${new Date().toISOString()}`;
|
|
18
35
|
const experimentParams = {
|
|
19
|
-
|
|
20
|
-
// TODO: Make configurable?
|
|
21
|
-
nExamples: dataset.examples.length,
|
|
22
|
-
};
|
|
23
|
-
const experiment = {
|
|
24
|
-
id: id(),
|
|
25
|
-
datasetId: dataset.id,
|
|
26
|
-
datasetVersionId: dataset.versionId,
|
|
27
|
-
repetitions,
|
|
28
|
-
projectName,
|
|
36
|
+
nExamples,
|
|
29
37
|
};
|
|
38
|
+
let experiment;
|
|
39
|
+
if (isDryRun) {
|
|
40
|
+
experiment = {
|
|
41
|
+
id: id(),
|
|
42
|
+
datasetId: dataset.id,
|
|
43
|
+
datasetVersionId: dataset.versionId,
|
|
44
|
+
projectName,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const experimentResponse = await client
|
|
49
|
+
.POST("/v1/datasets/{dataset_id}/experiments", {
|
|
50
|
+
params: {
|
|
51
|
+
path: {
|
|
52
|
+
dataset_id: dataset.id,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
body: {
|
|
56
|
+
name: experimentName,
|
|
57
|
+
description: experimentDescription,
|
|
58
|
+
metadata: experimentMetadata,
|
|
59
|
+
project_name: projectName,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
.then((res) => res.data?.data);
|
|
63
|
+
invariant(experimentResponse, `Failed to create experiment`);
|
|
64
|
+
experiment = {
|
|
65
|
+
id: experimentResponse.id,
|
|
66
|
+
datasetId: dataset.id,
|
|
67
|
+
datasetVersionId: dataset.versionId,
|
|
68
|
+
projectName,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
30
71
|
if (!record) {
|
|
31
72
|
logger.info(`🔧 Running experiment in readonly mode. Results will not be recorded.`);
|
|
32
73
|
}
|
|
33
|
-
logger.info(`🧪 Starting experiment "${experimentName}" on dataset "${dataset.id}" with task "${task.name}" and ${evaluators?.length ?? 0} ${pluralize("evaluator", evaluators?.length ?? 0)}`);
|
|
34
|
-
logger.info(`🔁 Running ${repetitions} ${pluralize("repetition", repetitions)} of task "${task.name}"`);
|
|
74
|
+
logger.info(`🧪 Starting experiment "${experimentName}" on dataset "${dataset.id}" with task "${task.name}" and ${evaluators?.length ?? 0} ${pluralize("evaluator", evaluators?.length ?? 0)} and ${concurrency} concurrent runs`);
|
|
35
75
|
const runs = {};
|
|
36
|
-
await
|
|
37
|
-
|
|
76
|
+
await runTask({
|
|
77
|
+
client,
|
|
38
78
|
experimentId: experiment.id,
|
|
39
79
|
task,
|
|
40
80
|
dataset,
|
|
@@ -42,7 +82,10 @@ export async function runExperiment({ experimentName: _experimentName, client: _
|
|
|
42
82
|
onComplete: (run) => {
|
|
43
83
|
runs[run.id] = run;
|
|
44
84
|
},
|
|
45
|
-
|
|
85
|
+
concurrency,
|
|
86
|
+
isDryRun,
|
|
87
|
+
nExamples,
|
|
88
|
+
});
|
|
46
89
|
logger.info(`✅ Task runs completed`);
|
|
47
90
|
const ranExperiment = {
|
|
48
91
|
...experiment,
|
|
@@ -54,24 +97,26 @@ export async function runExperiment({ experimentName: _experimentName, client: _
|
|
|
54
97
|
evaluators: evaluators ?? [],
|
|
55
98
|
client,
|
|
56
99
|
logger,
|
|
100
|
+
concurrency,
|
|
101
|
+
dryRun,
|
|
57
102
|
});
|
|
58
103
|
ranExperiment.evaluationRuns = evaluationRuns;
|
|
59
104
|
logger.info(`✅ Experiment ${experiment.id} completed`);
|
|
60
105
|
return ranExperiment;
|
|
61
106
|
}
|
|
62
107
|
/**
|
|
63
|
-
* Run a task against
|
|
108
|
+
* Run a task against n examples in a dataset.
|
|
64
109
|
*/
|
|
65
|
-
function runTask({ experimentId, task, dataset,
|
|
66
|
-
logger.info(`🔧
|
|
110
|
+
function runTask({ client, experimentId, task, dataset, onComplete, logger, concurrency = 5, isDryRun, nExamples, }) {
|
|
111
|
+
logger.info(`🔧 Running task "${task.name}" on dataset "${dataset.id}"`);
|
|
67
112
|
const run = async (example) => {
|
|
113
|
+
logger.info(`🔧 Running task "${task.name}" on example "${example.id} of dataset "${dataset.id}"`);
|
|
68
114
|
const thisRun = {
|
|
69
115
|
id: id(),
|
|
70
|
-
traceId:
|
|
116
|
+
traceId: null, // TODO: fill this in once we trace experiments
|
|
71
117
|
experimentId,
|
|
72
118
|
datasetExampleId: example.id,
|
|
73
119
|
startTime: new Date(),
|
|
74
|
-
repetitionNumber: repetition,
|
|
75
120
|
endTime: new Date(), // will get replaced with actual end time
|
|
76
121
|
output: null,
|
|
77
122
|
error: null,
|
|
@@ -88,17 +133,46 @@ function runTask({ experimentId, task, dataset, repetition, onComplete, logger,
|
|
|
88
133
|
thisRun.error = error instanceof Error ? error.message : "Unknown error";
|
|
89
134
|
}
|
|
90
135
|
thisRun.endTime = new Date();
|
|
136
|
+
if (!isDryRun) {
|
|
137
|
+
// Log the run to the server
|
|
138
|
+
// We log this without awaiting (e.g. best effort)
|
|
139
|
+
const res = await client.POST("/v1/experiments/{experiment_id}/runs", {
|
|
140
|
+
params: {
|
|
141
|
+
path: {
|
|
142
|
+
experiment_id: experimentId,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
body: {
|
|
146
|
+
dataset_example_id: example.id,
|
|
147
|
+
output: thisRun.output,
|
|
148
|
+
repetition_number: 0,
|
|
149
|
+
start_time: thisRun.startTime.toISOString(),
|
|
150
|
+
end_time: thisRun.endTime.toISOString(),
|
|
151
|
+
trace_id: thisRun.traceId,
|
|
152
|
+
error: thisRun.error,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
// replace the local run id with the server-assigned id
|
|
156
|
+
thisRun.id = res.data?.data.id ?? thisRun.id;
|
|
157
|
+
}
|
|
91
158
|
onComplete(thisRun);
|
|
159
|
+
return thisRun;
|
|
92
160
|
};
|
|
93
|
-
|
|
161
|
+
const q = queue(run, concurrency);
|
|
162
|
+
const examplesToUse = dataset.examples.slice(0, nExamples);
|
|
163
|
+
examplesToUse.forEach((example) => q.push(example));
|
|
164
|
+
return q.drain();
|
|
94
165
|
}
|
|
95
166
|
/**
|
|
96
167
|
* Evaluate an experiment.
|
|
97
168
|
*
|
|
98
169
|
* @experimental This feature is not complete, and will change in the future.
|
|
99
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
100
170
|
*/
|
|
101
|
-
export async function evaluateExperiment({ experiment, evaluators, client: _client, logger, }) {
|
|
171
|
+
export async function evaluateExperiment({ experiment, evaluators, client: _client, logger, concurrency = 5, dryRun = false, }) {
|
|
172
|
+
const isDryRun = typeof dryRun === "number" || dryRun === true;
|
|
173
|
+
const nRuns = typeof dryRun === "number"
|
|
174
|
+
? Math.max(dryRun, Object.keys(experiment.runs).length)
|
|
175
|
+
: Object.keys(experiment.runs).length;
|
|
102
176
|
const client = _client ?? createClient();
|
|
103
177
|
const dataset = await getDatasetBySelector({
|
|
104
178
|
dataset: experiment.datasetId,
|
|
@@ -107,6 +181,7 @@ export async function evaluateExperiment({ experiment, evaluators, client: _clie
|
|
|
107
181
|
invariant(dataset, `Dataset "${experiment.datasetId}" not found`);
|
|
108
182
|
invariant(dataset.examples.length > 0, `Dataset "${experiment.datasetId}" has no examples`);
|
|
109
183
|
invariant(experiment.runs, `Experiment "${experiment.id}" has no runs`);
|
|
184
|
+
const runsToEvaluate = Object.values(experiment.runs).slice(0, nRuns);
|
|
110
185
|
if (evaluators?.length === 0) {
|
|
111
186
|
return {
|
|
112
187
|
...experiment,
|
|
@@ -123,12 +198,40 @@ export async function evaluateExperiment({ experiment, evaluators, client: _clie
|
|
|
123
198
|
evaluationRuns[run.id] = run;
|
|
124
199
|
};
|
|
125
200
|
// Run evaluators against all runs
|
|
126
|
-
|
|
201
|
+
// Flat list of evaluator + run tuples
|
|
202
|
+
const evaluatorsAndRuns = evaluators.flatMap((evaluator) => runsToEvaluate.map((run) => ({
|
|
127
203
|
evaluator,
|
|
128
204
|
run,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
205
|
+
})));
|
|
206
|
+
const evaluatorsQueue = queue(async (evaluatorAndRun) => {
|
|
207
|
+
const evalResult = await runEvaluator({
|
|
208
|
+
evaluator: evaluatorAndRun.evaluator,
|
|
209
|
+
run: evaluatorAndRun.run,
|
|
210
|
+
exampleCache: examplesById,
|
|
211
|
+
onComplete: onEvaluationComplete,
|
|
212
|
+
});
|
|
213
|
+
if (!isDryRun) {
|
|
214
|
+
logger.info(`📝 Logging evaluation ${evalResult.id}`);
|
|
215
|
+
// Log the evaluation to the server
|
|
216
|
+
// We log this without awaiting (e.g. best effort)
|
|
217
|
+
client.POST("/v1/experiment_evaluations", {
|
|
218
|
+
body: {
|
|
219
|
+
experiment_run_id: evaluatorAndRun.run.id,
|
|
220
|
+
name: evaluatorAndRun.evaluator.name,
|
|
221
|
+
annotator_kind: evaluatorAndRun.evaluator.kind,
|
|
222
|
+
start_time: evalResult.startTime.toISOString(),
|
|
223
|
+
end_time: evalResult.endTime.toISOString(),
|
|
224
|
+
result: {
|
|
225
|
+
...evalResult.result,
|
|
226
|
+
},
|
|
227
|
+
error: evalResult.error,
|
|
228
|
+
trace_id: evalResult.traceId,
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}, concurrency);
|
|
233
|
+
evaluatorsAndRuns.forEach((evaluatorAndRun) => evaluatorsQueue.push(evaluatorAndRun));
|
|
234
|
+
await evaluatorsQueue.drain();
|
|
132
235
|
logger.info(`✅ Evaluation runs completed`);
|
|
133
236
|
return {
|
|
134
237
|
...experiment,
|
|
@@ -139,7 +242,6 @@ export async function evaluateExperiment({ experiment, evaluators, client: _clie
|
|
|
139
242
|
* Run an evaluator against a run.
|
|
140
243
|
*
|
|
141
244
|
* @experimental This feature is not complete, and will change in the future.
|
|
142
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
143
245
|
*/
|
|
144
246
|
async function runEvaluator({ evaluator, run, exampleCache, onComplete, }) {
|
|
145
247
|
const example = exampleCache[run.datasetExampleId];
|
|
@@ -147,7 +249,7 @@ async function runEvaluator({ evaluator, run, exampleCache, onComplete, }) {
|
|
|
147
249
|
const evaluate = async () => {
|
|
148
250
|
const thisEval = {
|
|
149
251
|
id: id(),
|
|
150
|
-
traceId:
|
|
252
|
+
traceId: null, // TODO: fill this in once we trace experiments
|
|
151
253
|
experimentRunId: run.id,
|
|
152
254
|
startTime: new Date(),
|
|
153
255
|
endTime: new Date(), // will get replaced with actual end time
|
|
@@ -170,6 +272,7 @@ async function runEvaluator({ evaluator, run, exampleCache, onComplete, }) {
|
|
|
170
272
|
}
|
|
171
273
|
thisEval.endTime = new Date();
|
|
172
274
|
onComplete(thisEval);
|
|
275
|
+
return thisEval;
|
|
173
276
|
};
|
|
174
277
|
return evaluate();
|
|
175
278
|
}
|
|
@@ -177,15 +280,15 @@ async function runEvaluator({ evaluator, run, exampleCache, onComplete, }) {
|
|
|
177
280
|
* Wrap an evaluator function in an object with a name property.
|
|
178
281
|
*
|
|
179
282
|
* @experimental This feature is not complete, and will change in the future.
|
|
180
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
181
283
|
*
|
|
182
284
|
* @param name - The name of the evaluator.
|
|
183
285
|
* @param evaluate - The evaluator function.
|
|
184
286
|
* @returns The evaluator object.
|
|
185
287
|
*/
|
|
186
|
-
export function asEvaluator(name, evaluate) {
|
|
288
|
+
export function asEvaluator({ name, kind, evaluate, }) {
|
|
187
289
|
return {
|
|
188
290
|
name,
|
|
291
|
+
kind,
|
|
189
292
|
evaluate,
|
|
190
293
|
};
|
|
191
294
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runExperiment.js","sourceRoot":"","sources":["../../../src/experiments/runExperiment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runExperiment.js","sourceRoot":"","sources":["../../../src/experiments/runExperiment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAsB,MAAM,WAAW,CAAC;AAa7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAyD3D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAClC,cAAc,EAAE,eAAe,EAC/B,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,IAAI,EACJ,UAAU,EACV,WAAW,GAAG,SAAS,EACvB,MAAM,GAAG,OAAO,EAChB,MAAM,GAAG,IAAI,EACb,WAAW,GAAG,CAAC,EACf,MAAM,GAAG,KAAK,GACM;IACpB,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,CAAC;IAC/D,MAAM,MAAM,GAAG,OAAO,IAAI,YAAY,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM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,MAAM,SAAS,CAAC,QAAQ,CAAC;gBACtC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,IAAI;gBAC1B,QAAQ,EAAE,OAAO,CAAC,MAAM;gBACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B,CAAC,CAAC;YACH,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QAC5E,CAAC;QACD,QAAQ,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,UAAU,CAAC,QAAQ,CAAC,CAAC;QACrB,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,IAAI,EACJ,IAAI,EACJ,QAAQ,GAKT;IACC,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,IAAI,GAAG,GAAG,IAAI,CAAC;AAEf;;;;;GAKG;AACH,MAAM,UAAU,EAAE;IAChB,OAAO,CAAC,GAAG,EAAE;QACX,GAAG,EAAE,CAAC;QACN,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
|
|
@@ -6681,7 +6681,7 @@ export declare const SDKProviderConverterMap: {
|
|
|
6681
6681
|
type: "tool_call";
|
|
6682
6682
|
tool_call_id: string;
|
|
6683
6683
|
} | {
|
|
6684
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
6684
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
6685
6685
|
type: "tool_result";
|
|
6686
6686
|
tool_call_id: string;
|
|
6687
6687
|
})[];
|
|
@@ -6682,7 +6682,7 @@ export declare const safelyConvertMessageToProvider: <TargetProviderSDK extends
|
|
|
6682
6682
|
type: "tool_call";
|
|
6683
6683
|
tool_call_id: string;
|
|
6684
6684
|
} | {
|
|
6685
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
6685
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
6686
6686
|
type: "tool_result";
|
|
6687
6687
|
tool_call_id: string;
|
|
6688
6688
|
})[];
|
|
@@ -15783,7 +15783,7 @@ export declare const safelyConvertToolCallToProvider: <TargetProviderSDK extends
|
|
|
15783
15783
|
type: "tool_call";
|
|
15784
15784
|
tool_call_id: string;
|
|
15785
15785
|
} | {
|
|
15786
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
15786
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
15787
15787
|
type: "tool_result";
|
|
15788
15788
|
tool_call_id: string;
|
|
15789
15789
|
})[];
|
|
@@ -24884,7 +24884,7 @@ export declare const safelyConvertToolDefinitionToProvider: <TargetProviderSDK e
|
|
|
24884
24884
|
type: "tool_call";
|
|
24885
24885
|
tool_call_id: string;
|
|
24886
24886
|
} | {
|
|
24887
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
24887
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
24888
24888
|
type: "tool_result";
|
|
24889
24889
|
tool_call_id: string;
|
|
24890
24890
|
})[];
|
|
@@ -33985,7 +33985,7 @@ export declare const safelyConvertToolChoiceToProvider: <TargetProviderSDK exten
|
|
|
33985
33985
|
type: "tool_call";
|
|
33986
33986
|
tool_call_id: string;
|
|
33987
33987
|
} | {
|
|
33988
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
33988
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
33989
33989
|
type: "tool_result";
|
|
33990
33990
|
tool_call_id: string;
|
|
33991
33991
|
})[];
|
|
@@ -1043,7 +1043,7 @@ export declare const openAIMessageToPhoenixPrompt: import("zod").ZodEffects<impo
|
|
|
1043
1043
|
type: "tool_call";
|
|
1044
1044
|
tool_call_id: string;
|
|
1045
1045
|
} | {
|
|
1046
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
1046
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
1047
1047
|
type: "tool_result";
|
|
1048
1048
|
tool_call_id: string;
|
|
1049
1049
|
})[];
|
|
@@ -44,11 +44,11 @@ export declare const phoenixMessagePartToOpenAI: import("zod").ZodEffects<import
|
|
|
44
44
|
tool_call_id: import("zod").ZodString;
|
|
45
45
|
tool_result: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean, import("zod").ZodNull, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>, import("zod").ZodArray<import("zod").ZodUnknown, "many">]>;
|
|
46
46
|
}, "strip", import("zod").ZodTypeAny, {
|
|
47
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
47
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
48
48
|
type: "tool_result";
|
|
49
49
|
tool_call_id: string;
|
|
50
50
|
}, {
|
|
51
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
51
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
52
52
|
type: "tool_result";
|
|
53
53
|
tool_call_id: string;
|
|
54
54
|
}>]>, {
|
|
@@ -66,7 +66,7 @@ export declare const phoenixMessagePartToOpenAI: import("zod").ZodEffects<import
|
|
|
66
66
|
type: "tool_call";
|
|
67
67
|
tool_call_id: string;
|
|
68
68
|
} | {
|
|
69
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
69
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
70
70
|
type: "tool_result";
|
|
71
71
|
tool_call_id: string;
|
|
72
72
|
}>;
|
|
@@ -121,11 +121,11 @@ export declare const phoenixMessageToOpenAI: import("zod").ZodEffects<import("zo
|
|
|
121
121
|
tool_call_id: import("zod").ZodString;
|
|
122
122
|
tool_result: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean, import("zod").ZodNull, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>, import("zod").ZodArray<import("zod").ZodUnknown, "many">]>;
|
|
123
123
|
}, "strip", import("zod").ZodTypeAny, {
|
|
124
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
124
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
125
125
|
type: "tool_result";
|
|
126
126
|
tool_call_id: string;
|
|
127
127
|
}, {
|
|
128
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
128
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
129
129
|
type: "tool_result";
|
|
130
130
|
tool_call_id: string;
|
|
131
131
|
}>]>, "many">]>;
|
|
@@ -142,7 +142,7 @@ export declare const phoenixMessageToOpenAI: import("zod").ZodEffects<import("zo
|
|
|
142
142
|
type: "tool_call";
|
|
143
143
|
tool_call_id: string;
|
|
144
144
|
} | {
|
|
145
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
145
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
146
146
|
type: "tool_result";
|
|
147
147
|
tool_call_id: string;
|
|
148
148
|
})[];
|
|
@@ -160,7 +160,7 @@ export declare const phoenixMessageToOpenAI: import("zod").ZodEffects<import("zo
|
|
|
160
160
|
type: "tool_call";
|
|
161
161
|
tool_call_id: string;
|
|
162
162
|
} | {
|
|
163
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
163
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
164
164
|
type: "tool_result";
|
|
165
165
|
tool_call_id: string;
|
|
166
166
|
})[];
|
|
@@ -216,7 +216,7 @@ export declare const phoenixMessageToOpenAI: import("zod").ZodEffects<import("zo
|
|
|
216
216
|
type: "tool_call";
|
|
217
217
|
tool_call_id: string;
|
|
218
218
|
} | {
|
|
219
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
219
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
220
220
|
type: "tool_result";
|
|
221
221
|
tool_call_id: string;
|
|
222
222
|
})[];
|
|
@@ -49,11 +49,11 @@ export declare const toolResultPartSchema: z.ZodObject<{
|
|
|
49
49
|
tool_call_id: z.ZodString;
|
|
50
50
|
tool_result: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown, "many">]>;
|
|
51
51
|
}, "strip", z.ZodTypeAny, {
|
|
52
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
52
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
53
53
|
type: "tool_result";
|
|
54
54
|
tool_call_id: string;
|
|
55
55
|
}, {
|
|
56
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
56
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
57
57
|
type: "tool_result";
|
|
58
58
|
tool_call_id: string;
|
|
59
59
|
}>;
|
|
@@ -104,11 +104,11 @@ export declare const phoenixContentPartSchema: z.ZodDiscriminatedUnion<"type", [
|
|
|
104
104
|
tool_call_id: z.ZodString;
|
|
105
105
|
tool_result: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown, "many">]>;
|
|
106
106
|
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
107
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
108
108
|
type: "tool_result";
|
|
109
109
|
tool_call_id: string;
|
|
110
110
|
}, {
|
|
111
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
111
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
112
112
|
type: "tool_result";
|
|
113
113
|
tool_call_id: string;
|
|
114
114
|
}>]>;
|
|
@@ -121,7 +121,7 @@ export declare const makeTextPart: (text?: string | null) => {
|
|
|
121
121
|
export declare const asToolCallPart: (maybePart: unknown) => ToolCallPart | null;
|
|
122
122
|
export declare const asToolResultPart: (maybePart: unknown) => ToolResultPart | null;
|
|
123
123
|
export declare const makeToolResultPart: (toolCallId?: string | null, result?: unknown) => {
|
|
124
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
124
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
125
125
|
type: "tool_result";
|
|
126
126
|
tool_call_id: string;
|
|
127
127
|
} | null;
|
|
@@ -54,11 +54,11 @@ export declare const phoenixMessageSchema: z.ZodObject<{
|
|
|
54
54
|
tool_call_id: z.ZodString;
|
|
55
55
|
tool_result: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown, "many">]>;
|
|
56
56
|
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
57
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
58
58
|
type: "tool_result";
|
|
59
59
|
tool_call_id: string;
|
|
60
60
|
}, {
|
|
61
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
61
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
62
62
|
type: "tool_result";
|
|
63
63
|
tool_call_id: string;
|
|
64
64
|
}>]>, "many">]>;
|
|
@@ -75,7 +75,7 @@ export declare const phoenixMessageSchema: z.ZodObject<{
|
|
|
75
75
|
type: "tool_call";
|
|
76
76
|
tool_call_id: string;
|
|
77
77
|
} | {
|
|
78
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
78
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
79
79
|
type: "tool_result";
|
|
80
80
|
tool_call_id: string;
|
|
81
81
|
})[];
|
|
@@ -93,7 +93,7 @@ export declare const phoenixMessageSchema: z.ZodObject<{
|
|
|
93
93
|
type: "tool_call";
|
|
94
94
|
tool_call_id: string;
|
|
95
95
|
} | {
|
|
96
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
96
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
97
97
|
type: "tool_result";
|
|
98
98
|
tool_call_id: string;
|
|
99
99
|
})[];
|
|
@@ -148,11 +148,11 @@ export declare const phoenixMessagesSchema: z.ZodArray<z.ZodObject<{
|
|
|
148
148
|
tool_call_id: z.ZodString;
|
|
149
149
|
tool_result: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown, "many">]>;
|
|
150
150
|
}, "strip", z.ZodTypeAny, {
|
|
151
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
151
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
152
152
|
type: "tool_result";
|
|
153
153
|
tool_call_id: string;
|
|
154
154
|
}, {
|
|
155
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
155
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
156
156
|
type: "tool_result";
|
|
157
157
|
tool_call_id: string;
|
|
158
158
|
}>]>, "many">]>;
|
|
@@ -169,7 +169,7 @@ export declare const phoenixMessagesSchema: z.ZodArray<z.ZodObject<{
|
|
|
169
169
|
type: "tool_call";
|
|
170
170
|
tool_call_id: string;
|
|
171
171
|
} | {
|
|
172
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
172
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
173
173
|
type: "tool_result";
|
|
174
174
|
tool_call_id: string;
|
|
175
175
|
})[];
|
|
@@ -187,7 +187,7 @@ export declare const phoenixMessagesSchema: z.ZodArray<z.ZodObject<{
|
|
|
187
187
|
type: "tool_call";
|
|
188
188
|
tool_call_id: string;
|
|
189
189
|
} | {
|
|
190
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
190
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
191
191
|
type: "tool_result";
|
|
192
192
|
tool_call_id: string;
|
|
193
193
|
})[];
|
|
@@ -800,11 +800,11 @@ export declare const llmProviderMessageSchema: z.ZodUnion<[z.ZodDiscriminatedUni
|
|
|
800
800
|
tool_call_id: z.ZodString;
|
|
801
801
|
tool_result: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown, "many">]>;
|
|
802
802
|
}, "strip", z.ZodTypeAny, {
|
|
803
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
803
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
804
804
|
type: "tool_result";
|
|
805
805
|
tool_call_id: string;
|
|
806
806
|
}, {
|
|
807
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
807
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
808
808
|
type: "tool_result";
|
|
809
809
|
tool_call_id: string;
|
|
810
810
|
}>]>, "many">]>;
|
|
@@ -821,7 +821,7 @@ export declare const llmProviderMessageSchema: z.ZodUnion<[z.ZodDiscriminatedUni
|
|
|
821
821
|
type: "tool_call";
|
|
822
822
|
tool_call_id: string;
|
|
823
823
|
} | {
|
|
824
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
824
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
825
825
|
type: "tool_result";
|
|
826
826
|
tool_call_id: string;
|
|
827
827
|
})[];
|
|
@@ -839,7 +839,7 @@ export declare const llmProviderMessageSchema: z.ZodUnion<[z.ZodDiscriminatedUni
|
|
|
839
839
|
type: "tool_call";
|
|
840
840
|
tool_call_id: string;
|
|
841
841
|
} | {
|
|
842
|
-
tool_result: string | number | boolean | Record<string, unknown> |
|
|
842
|
+
tool_result: string | number | boolean | unknown[] | Record<string, unknown> | null;
|
|
843
843
|
type: "tool_result";
|
|
844
844
|
tool_call_id: string;
|
|
845
845
|
})[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ClientFn } from "../types/core.js";
|
|
2
|
+
import { SpanAnnotation } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Parameters to add a span annotation
|
|
5
|
+
*/
|
|
6
|
+
interface AddSpanAnnotationParams extends ClientFn {
|
|
7
|
+
spanAnnotation: SpanAnnotation;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Add an annotation to a span.
|
|
11
|
+
*
|
|
12
|
+
* The annotation can be of type "LLM", "CODE", or "HUMAN" and can include a label, score, and metadata.
|
|
13
|
+
* If an identifier is provided and an annotation with that identifier already exists, it will be updated.
|
|
14
|
+
*
|
|
15
|
+
* @param params - The parameters to add a span annotation
|
|
16
|
+
* @returns The ID of the created or updated annotation
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const result = await addSpanAnnotation({
|
|
21
|
+
* spanAnnotation: {
|
|
22
|
+
* spanId: "123abc",
|
|
23
|
+
* name: "quality_score",
|
|
24
|
+
* label: "good",
|
|
25
|
+
* score: 0.95,
|
|
26
|
+
* annotatorKind: "LLM",
|
|
27
|
+
* identifier: "custom_id_123",
|
|
28
|
+
* metadata: {
|
|
29
|
+
* model: "gpt-4"
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function addSpanAnnotation({ client: _client, spanAnnotation, }: AddSpanAnnotationParams): Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
}>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=addSpanAnnotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addSpanAnnotation.d.ts","sourceRoot":"","sources":["../../../src/spans/addSpanAnnotation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAwB,MAAM,SAAS,CAAC;AAE/D;;GAEG;AACH,UAAU,uBAAwB,SAAQ,QAAQ;IAChD,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EAAE,OAAO,EACf,cAAc,GACf,EAAE,uBAAuB,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBnD"}
|