@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
|
@@ -16,45 +16,85 @@ exports.runExperiment = runExperiment;
|
|
|
16
16
|
exports.evaluateExperiment = evaluateExperiment;
|
|
17
17
|
exports.asEvaluator = asEvaluator;
|
|
18
18
|
exports.id = id;
|
|
19
|
-
const
|
|
20
|
-
const promisifyResult_1 = require("../utils/promisifyResult");
|
|
19
|
+
const async_1 = require("async");
|
|
21
20
|
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
22
|
-
const
|
|
21
|
+
const client_1 = require("../client");
|
|
23
22
|
const getDatasetBySelector_1 = require("../utils/getDatasetBySelector");
|
|
23
|
+
const pluralize_1 = require("../utils/pluralize");
|
|
24
|
+
const promisifyResult_1 = require("../utils/promisifyResult");
|
|
24
25
|
/**
|
|
25
26
|
* Run an experiment.
|
|
26
27
|
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { asEvaluator, runExperiment } from "@phoenix/client/experiments";
|
|
31
|
+
*
|
|
32
|
+
* const experiment = await runExperiment({
|
|
33
|
+
* dataset: "my-dataset",
|
|
34
|
+
* task: async (example) => example.input,
|
|
35
|
+
* evaluators: [
|
|
36
|
+
* asEvaluator("my-evaluator", "CODE", async (params) => params.output),
|
|
37
|
+
* ],
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
27
41
|
* @experimental This feature is not complete, and will change in the future.
|
|
28
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
29
42
|
*/
|
|
30
43
|
function runExperiment(_a) {
|
|
31
|
-
return __awaiter(this, arguments, void 0, function* ({ experimentName: _experimentName, client: _client, dataset: _dataset, task, evaluators,
|
|
44
|
+
return __awaiter(this, arguments, void 0, function* ({ experimentName: _experimentName, experimentDescription, experimentMetadata, client: _client, dataset: _dataset, task, evaluators, projectName = "default", logger = console, record = true, concurrency = 5, dryRun = false, }) {
|
|
32
45
|
var _b, _c;
|
|
46
|
+
const isDryRun = typeof dryRun === "number" || dryRun === true;
|
|
33
47
|
const client = _client !== null && _client !== void 0 ? _client : (0, client_1.createClient)();
|
|
34
48
|
const dataset = yield (0, getDatasetBySelector_1.getDatasetBySelector)({ dataset: _dataset, client });
|
|
35
49
|
(0, tiny_invariant_1.default)(dataset, `Dataset not found`);
|
|
36
50
|
(0, tiny_invariant_1.default)(dataset.examples.length > 0, `Dataset has no examples`);
|
|
51
|
+
const nExamples = typeof dryRun === "number"
|
|
52
|
+
? Math.max(dryRun, dataset.examples.length)
|
|
53
|
+
: dataset.examples.length;
|
|
37
54
|
const experimentName = _experimentName !== null && _experimentName !== void 0 ? _experimentName : `${dataset.name}-${new Date().toISOString()}`;
|
|
38
55
|
const experimentParams = {
|
|
39
|
-
|
|
40
|
-
// TODO: Make configurable?
|
|
41
|
-
nExamples: dataset.examples.length,
|
|
42
|
-
};
|
|
43
|
-
const experiment = {
|
|
44
|
-
id: id(),
|
|
45
|
-
datasetId: dataset.id,
|
|
46
|
-
datasetVersionId: dataset.versionId,
|
|
47
|
-
repetitions,
|
|
48
|
-
projectName,
|
|
56
|
+
nExamples,
|
|
49
57
|
};
|
|
58
|
+
let experiment;
|
|
59
|
+
if (isDryRun) {
|
|
60
|
+
experiment = {
|
|
61
|
+
id: id(),
|
|
62
|
+
datasetId: dataset.id,
|
|
63
|
+
datasetVersionId: dataset.versionId,
|
|
64
|
+
projectName,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const experimentResponse = yield client
|
|
69
|
+
.POST("/v1/datasets/{dataset_id}/experiments", {
|
|
70
|
+
params: {
|
|
71
|
+
path: {
|
|
72
|
+
dataset_id: dataset.id,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
body: {
|
|
76
|
+
name: experimentName,
|
|
77
|
+
description: experimentDescription,
|
|
78
|
+
metadata: experimentMetadata,
|
|
79
|
+
project_name: projectName,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
.then((res) => { var _a; return (_a = res.data) === null || _a === void 0 ? void 0 : _a.data; });
|
|
83
|
+
(0, tiny_invariant_1.default)(experimentResponse, `Failed to create experiment`);
|
|
84
|
+
experiment = {
|
|
85
|
+
id: experimentResponse.id,
|
|
86
|
+
datasetId: dataset.id,
|
|
87
|
+
datasetVersionId: dataset.versionId,
|
|
88
|
+
projectName,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
50
91
|
if (!record) {
|
|
51
92
|
logger.info(`🔧 Running experiment in readonly mode. Results will not be recorded.`);
|
|
52
93
|
}
|
|
53
|
-
logger.info(`🧪 Starting experiment "${experimentName}" on dataset "${dataset.id}" with task "${task.name}" and ${(_b = evaluators === null || evaluators === void 0 ? void 0 : evaluators.length) !== null && _b !== void 0 ? _b : 0} ${(0, pluralize_1.pluralize)("evaluator", (_c = evaluators === null || evaluators === void 0 ? void 0 : evaluators.length) !== null && _c !== void 0 ? _c : 0)}`);
|
|
54
|
-
logger.info(`🔁 Running ${repetitions} ${(0, pluralize_1.pluralize)("repetition", repetitions)} of task "${task.name}"`);
|
|
94
|
+
logger.info(`🧪 Starting experiment "${experimentName}" on dataset "${dataset.id}" with task "${task.name}" and ${(_b = evaluators === null || evaluators === void 0 ? void 0 : evaluators.length) !== null && _b !== void 0 ? _b : 0} ${(0, pluralize_1.pluralize)("evaluator", (_c = evaluators === null || evaluators === void 0 ? void 0 : evaluators.length) !== null && _c !== void 0 ? _c : 0)} and ${concurrency} concurrent runs`);
|
|
55
95
|
const runs = {};
|
|
56
|
-
yield
|
|
57
|
-
|
|
96
|
+
yield runTask({
|
|
97
|
+
client,
|
|
58
98
|
experimentId: experiment.id,
|
|
59
99
|
task,
|
|
60
100
|
dataset,
|
|
@@ -62,7 +102,10 @@ function runExperiment(_a) {
|
|
|
62
102
|
onComplete: (run) => {
|
|
63
103
|
runs[run.id] = run;
|
|
64
104
|
},
|
|
65
|
-
|
|
105
|
+
concurrency,
|
|
106
|
+
isDryRun,
|
|
107
|
+
nExamples,
|
|
108
|
+
});
|
|
66
109
|
logger.info(`✅ Task runs completed`);
|
|
67
110
|
const ranExperiment = Object.assign(Object.assign({}, experiment), { params: experimentParams, runs });
|
|
68
111
|
const { evaluationRuns } = yield evaluateExperiment({
|
|
@@ -70,6 +113,8 @@ function runExperiment(_a) {
|
|
|
70
113
|
evaluators: evaluators !== null && evaluators !== void 0 ? evaluators : [],
|
|
71
114
|
client,
|
|
72
115
|
logger,
|
|
116
|
+
concurrency,
|
|
117
|
+
dryRun,
|
|
73
118
|
});
|
|
74
119
|
ranExperiment.evaluationRuns = evaluationRuns;
|
|
75
120
|
logger.info(`✅ Experiment ${experiment.id} completed`);
|
|
@@ -77,18 +122,19 @@ function runExperiment(_a) {
|
|
|
77
122
|
});
|
|
78
123
|
}
|
|
79
124
|
/**
|
|
80
|
-
* Run a task against
|
|
125
|
+
* Run a task against n examples in a dataset.
|
|
81
126
|
*/
|
|
82
|
-
function runTask({ experimentId, task, dataset,
|
|
83
|
-
logger.info(`🔧
|
|
127
|
+
function runTask({ client, experimentId, task, dataset, onComplete, logger, concurrency = 5, isDryRun, nExamples, }) {
|
|
128
|
+
logger.info(`🔧 Running task "${task.name}" on dataset "${dataset.id}"`);
|
|
84
129
|
const run = (example) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
var _a, _b;
|
|
131
|
+
logger.info(`🔧 Running task "${task.name}" on example "${example.id} of dataset "${dataset.id}"`);
|
|
85
132
|
const thisRun = {
|
|
86
133
|
id: id(),
|
|
87
|
-
traceId:
|
|
134
|
+
traceId: null, // TODO: fill this in once we trace experiments
|
|
88
135
|
experimentId,
|
|
89
136
|
datasetExampleId: example.id,
|
|
90
137
|
startTime: new Date(),
|
|
91
|
-
repetitionNumber: repetition,
|
|
92
138
|
endTime: new Date(), // will get replaced with actual end time
|
|
93
139
|
output: null,
|
|
94
140
|
error: null,
|
|
@@ -105,19 +151,48 @@ function runTask({ experimentId, task, dataset, repetition, onComplete, logger,
|
|
|
105
151
|
thisRun.error = error instanceof Error ? error.message : "Unknown error";
|
|
106
152
|
}
|
|
107
153
|
thisRun.endTime = new Date();
|
|
154
|
+
if (!isDryRun) {
|
|
155
|
+
// Log the run to the server
|
|
156
|
+
// We log this without awaiting (e.g. best effort)
|
|
157
|
+
const res = yield client.POST("/v1/experiments/{experiment_id}/runs", {
|
|
158
|
+
params: {
|
|
159
|
+
path: {
|
|
160
|
+
experiment_id: experimentId,
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
body: {
|
|
164
|
+
dataset_example_id: example.id,
|
|
165
|
+
output: thisRun.output,
|
|
166
|
+
repetition_number: 0,
|
|
167
|
+
start_time: thisRun.startTime.toISOString(),
|
|
168
|
+
end_time: thisRun.endTime.toISOString(),
|
|
169
|
+
trace_id: thisRun.traceId,
|
|
170
|
+
error: thisRun.error,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
// replace the local run id with the server-assigned id
|
|
174
|
+
thisRun.id = (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.data.id) !== null && _b !== void 0 ? _b : thisRun.id;
|
|
175
|
+
}
|
|
108
176
|
onComplete(thisRun);
|
|
177
|
+
return thisRun;
|
|
109
178
|
});
|
|
110
|
-
|
|
179
|
+
const q = (0, async_1.queue)(run, concurrency);
|
|
180
|
+
const examplesToUse = dataset.examples.slice(0, nExamples);
|
|
181
|
+
examplesToUse.forEach((example) => q.push(example));
|
|
182
|
+
return q.drain();
|
|
111
183
|
}
|
|
112
184
|
/**
|
|
113
185
|
* Evaluate an experiment.
|
|
114
186
|
*
|
|
115
187
|
* @experimental This feature is not complete, and will change in the future.
|
|
116
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
117
188
|
*/
|
|
118
189
|
function evaluateExperiment(_a) {
|
|
119
|
-
return __awaiter(this, arguments, void 0, function* ({ experiment, evaluators, client: _client, logger, }) {
|
|
190
|
+
return __awaiter(this, arguments, void 0, function* ({ experiment, evaluators, client: _client, logger, concurrency = 5, dryRun = false, }) {
|
|
120
191
|
var _b, _c;
|
|
192
|
+
const isDryRun = typeof dryRun === "number" || dryRun === true;
|
|
193
|
+
const nRuns = typeof dryRun === "number"
|
|
194
|
+
? Math.max(dryRun, Object.keys(experiment.runs).length)
|
|
195
|
+
: Object.keys(experiment.runs).length;
|
|
121
196
|
const client = _client !== null && _client !== void 0 ? _client : (0, client_1.createClient)();
|
|
122
197
|
const dataset = yield (0, getDatasetBySelector_1.getDatasetBySelector)({
|
|
123
198
|
dataset: experiment.datasetId,
|
|
@@ -126,6 +201,7 @@ function evaluateExperiment(_a) {
|
|
|
126
201
|
(0, tiny_invariant_1.default)(dataset, `Dataset "${experiment.datasetId}" not found`);
|
|
127
202
|
(0, tiny_invariant_1.default)(dataset.examples.length > 0, `Dataset "${experiment.datasetId}" has no examples`);
|
|
128
203
|
(0, tiny_invariant_1.default)(experiment.runs, `Experiment "${experiment.id}" has no runs`);
|
|
204
|
+
const runsToEvaluate = Object.values(experiment.runs).slice(0, nRuns);
|
|
129
205
|
if ((evaluators === null || evaluators === void 0 ? void 0 : evaluators.length) === 0) {
|
|
130
206
|
return Object.assign(Object.assign({}, experiment), { evaluationRuns: [] });
|
|
131
207
|
}
|
|
@@ -139,12 +215,38 @@ function evaluateExperiment(_a) {
|
|
|
139
215
|
evaluationRuns[run.id] = run;
|
|
140
216
|
};
|
|
141
217
|
// Run evaluators against all runs
|
|
142
|
-
|
|
218
|
+
// Flat list of evaluator + run tuples
|
|
219
|
+
const evaluatorsAndRuns = evaluators.flatMap((evaluator) => runsToEvaluate.map((run) => ({
|
|
143
220
|
evaluator,
|
|
144
221
|
run,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
222
|
+
})));
|
|
223
|
+
const evaluatorsQueue = (0, async_1.queue)((evaluatorAndRun) => __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
const evalResult = yield runEvaluator({
|
|
225
|
+
evaluator: evaluatorAndRun.evaluator,
|
|
226
|
+
run: evaluatorAndRun.run,
|
|
227
|
+
exampleCache: examplesById,
|
|
228
|
+
onComplete: onEvaluationComplete,
|
|
229
|
+
});
|
|
230
|
+
if (!isDryRun) {
|
|
231
|
+
logger.info(`📝 Logging evaluation ${evalResult.id}`);
|
|
232
|
+
// Log the evaluation to the server
|
|
233
|
+
// We log this without awaiting (e.g. best effort)
|
|
234
|
+
client.POST("/v1/experiment_evaluations", {
|
|
235
|
+
body: {
|
|
236
|
+
experiment_run_id: evaluatorAndRun.run.id,
|
|
237
|
+
name: evaluatorAndRun.evaluator.name,
|
|
238
|
+
annotator_kind: evaluatorAndRun.evaluator.kind,
|
|
239
|
+
start_time: evalResult.startTime.toISOString(),
|
|
240
|
+
end_time: evalResult.endTime.toISOString(),
|
|
241
|
+
result: Object.assign({}, evalResult.result),
|
|
242
|
+
error: evalResult.error,
|
|
243
|
+
trace_id: evalResult.traceId,
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}), concurrency);
|
|
248
|
+
evaluatorsAndRuns.forEach((evaluatorAndRun) => evaluatorsQueue.push(evaluatorAndRun));
|
|
249
|
+
yield evaluatorsQueue.drain();
|
|
148
250
|
logger.info(`✅ Evaluation runs completed`);
|
|
149
251
|
return Object.assign(Object.assign({}, experiment), { evaluationRuns: Object.values(evaluationRuns) });
|
|
150
252
|
});
|
|
@@ -153,7 +255,6 @@ function evaluateExperiment(_a) {
|
|
|
153
255
|
* Run an evaluator against a run.
|
|
154
256
|
*
|
|
155
257
|
* @experimental This feature is not complete, and will change in the future.
|
|
156
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
157
258
|
*/
|
|
158
259
|
function runEvaluator(_a) {
|
|
159
260
|
return __awaiter(this, arguments, void 0, function* ({ evaluator, run, exampleCache, onComplete, }) {
|
|
@@ -163,7 +264,7 @@ function runEvaluator(_a) {
|
|
|
163
264
|
var _a;
|
|
164
265
|
const thisEval = {
|
|
165
266
|
id: id(),
|
|
166
|
-
traceId:
|
|
267
|
+
traceId: null, // TODO: fill this in once we trace experiments
|
|
167
268
|
experimentRunId: run.id,
|
|
168
269
|
startTime: new Date(),
|
|
169
270
|
endTime: new Date(), // will get replaced with actual end time
|
|
@@ -186,6 +287,7 @@ function runEvaluator(_a) {
|
|
|
186
287
|
}
|
|
187
288
|
thisEval.endTime = new Date();
|
|
188
289
|
onComplete(thisEval);
|
|
290
|
+
return thisEval;
|
|
189
291
|
});
|
|
190
292
|
return evaluate();
|
|
191
293
|
});
|
|
@@ -194,15 +296,15 @@ function runEvaluator(_a) {
|
|
|
194
296
|
* Wrap an evaluator function in an object with a name property.
|
|
195
297
|
*
|
|
196
298
|
* @experimental This feature is not complete, and will change in the future.
|
|
197
|
-
* @deprecated This function will be un-marked as deprecated once the experimental feature flag is removed.
|
|
198
299
|
*
|
|
199
300
|
* @param name - The name of the evaluator.
|
|
200
301
|
* @param evaluate - The evaluator function.
|
|
201
302
|
* @returns The evaluator object.
|
|
202
303
|
*/
|
|
203
|
-
function asEvaluator(name, evaluate) {
|
|
304
|
+
function asEvaluator({ name, kind, evaluate, }) {
|
|
204
305
|
return {
|
|
205
306
|
name,
|
|
307
|
+
kind,
|
|
206
308
|
evaluate,
|
|
207
309
|
};
|
|
208
310
|
}
|
|
@@ -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":";;;;;;;;;;;;;;AA4FA,sCAgHC;AAiGD,gDAwHC;AA4DD,kCAcC;AAUD,gBAKC;AA9fD,iCAA8B;AAC9B,oEAAuC;AACvC,sCAA6D;AAa7D,wEAAqE;AACrE,kDAA+C;AAC/C,8DAA2D;AAyD3D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAsB,aAAa;yDAAC,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;;QACpB,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,CAAC;QAC/D,MAAM,MAAM,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAA,qBAAY,GAAE,CAAC;QACzC,MAAM,OAAO,GAAG,MAAM,IAAA,2CAAoB,EAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1E,IAAA,wBAAS,EAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QACxC,IAAA,wBAAS,EAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,yBAAyB,CAAC,CAAC;QAClE,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,QAAQ;YACxB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC3C,CAAC,CAAC,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K,EAAE,OAAO,CAAC,KAAK;oBACpB,MAAM,EAAE,MAAA,GAAG,CAAC,MAAM,mCAAI,IAAI;oBAC1B,QAAQ,EAAE,OAAO,CAAC,MAAM;oBACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;iBAC3B,CAAC,CAAC;gBACH,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;YAC3B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,QAAQ,CAAC,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YAC5E,CAAC;YACD,QAAQ,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;YAC9B,UAAU,CAAC,QAAQ,CAAC,CAAC;YACrB,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA,CAAC;QAEF,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;CAAA;AAED;;;;;;;;GAQG;AACH,SAAgB,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,SAAgB,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";
|
|
2
|
+
import { SpanAnnotation } from "./types";
|
|
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"}
|