@arizeai/phoenix-client 2.4.0 → 3.0.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/dist/esm/__generated__/api/v1.d.ts +159 -5
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/spans/deleteSpan.d.ts +48 -0
- package/dist/esm/spans/deleteSpan.d.ts.map +1 -0
- package/dist/esm/spans/deleteSpan.js +60 -0
- package/dist/esm/spans/deleteSpan.js.map +1 -0
- package/dist/esm/spans/index.d.ts +1 -0
- package/dist/esm/spans/index.d.ts.map +1 -1
- package/dist/esm/spans/index.js +1 -0
- package/dist/esm/spans/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -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 +159 -5
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/spans/deleteSpan.d.ts +48 -0
- package/dist/src/spans/deleteSpan.d.ts.map +1 -0
- package/dist/src/spans/deleteSpan.js +63 -0
- package/dist/src/spans/deleteSpan.js.map +1 -0
- package/dist/src/spans/index.d.ts +1 -0
- package/dist/src/spans/index.d.ts.map +1 -1
- package/dist/src/spans/index.js +1 -0
- package/dist/src/spans/index.js.map +1 -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 +2 -2
- package/src/__generated__/api/v1.ts +159 -5
- package/src/spans/deleteSpan.ts +81 -0
- package/src/spans/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arizeai/phoenix-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A client for the Phoenix API",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"optionalDependencies": {
|
|
86
86
|
"@anthropic-ai/sdk": "^0.35.0",
|
|
87
87
|
"ai": "^4.1.47",
|
|
88
|
-
"openai": "^
|
|
88
|
+
"openai": "^5.12.1"
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
91
|
"clean": "rimraf dist",
|
|
@@ -318,6 +318,30 @@ export interface paths {
|
|
|
318
318
|
patch?: never;
|
|
319
319
|
trace?: never;
|
|
320
320
|
};
|
|
321
|
+
"/v1/traces/{trace_identifier}": {
|
|
322
|
+
parameters: {
|
|
323
|
+
query?: never;
|
|
324
|
+
header?: never;
|
|
325
|
+
path?: never;
|
|
326
|
+
cookie?: never;
|
|
327
|
+
};
|
|
328
|
+
get?: never;
|
|
329
|
+
put?: never;
|
|
330
|
+
post?: never;
|
|
331
|
+
/**
|
|
332
|
+
* Delete a trace by identifier
|
|
333
|
+
* @description Delete an entire trace by its identifier. The identifier can be either:
|
|
334
|
+
* 1. A Relay node ID (base64-encoded)
|
|
335
|
+
* 2. An OpenTelemetry trace_id (hex string)
|
|
336
|
+
*
|
|
337
|
+
* This will permanently remove all spans in the trace and their associated data.
|
|
338
|
+
*/
|
|
339
|
+
delete: operations["deleteTrace"];
|
|
340
|
+
options?: never;
|
|
341
|
+
head?: never;
|
|
342
|
+
patch?: never;
|
|
343
|
+
trace?: never;
|
|
344
|
+
};
|
|
321
345
|
"/v1/projects/{project_identifier}/spans/otlpv1": {
|
|
322
346
|
parameters: {
|
|
323
347
|
query?: never;
|
|
@@ -379,6 +403,38 @@ export interface paths {
|
|
|
379
403
|
patch?: never;
|
|
380
404
|
trace?: never;
|
|
381
405
|
};
|
|
406
|
+
"/v1/spans/{span_identifier}": {
|
|
407
|
+
parameters: {
|
|
408
|
+
query?: never;
|
|
409
|
+
header?: never;
|
|
410
|
+
path?: never;
|
|
411
|
+
cookie?: never;
|
|
412
|
+
};
|
|
413
|
+
get?: never;
|
|
414
|
+
put?: never;
|
|
415
|
+
post?: never;
|
|
416
|
+
/**
|
|
417
|
+
* Delete a span by span_identifier
|
|
418
|
+
* @description Delete a single span by identifier.
|
|
419
|
+
*
|
|
420
|
+
* **Important**: This operation deletes ONLY the specified span itself and does NOT
|
|
421
|
+
* delete its descendants/children. All child spans will remain in the trace and
|
|
422
|
+
* become orphaned (their parent_id will point to a non-existent span).
|
|
423
|
+
*
|
|
424
|
+
* Behavior:
|
|
425
|
+
* - Deletes only the target span (preserves all descendant spans)
|
|
426
|
+
* - If this was the last span in the trace, the trace record is also deleted
|
|
427
|
+
* - If the deleted span had a parent, its cumulative metrics (error count, token counts)
|
|
428
|
+
* are subtracted from all ancestor spans in the chain
|
|
429
|
+
*
|
|
430
|
+
* **Note**: This operation is irreversible and may create orphaned spans.
|
|
431
|
+
*/
|
|
432
|
+
delete: operations["deleteSpan"];
|
|
433
|
+
options?: never;
|
|
434
|
+
head?: never;
|
|
435
|
+
patch?: never;
|
|
436
|
+
trace?: never;
|
|
437
|
+
};
|
|
382
438
|
"/v1/evaluations": {
|
|
383
439
|
parameters: {
|
|
384
440
|
query?: never;
|
|
@@ -882,6 +938,8 @@ export interface components {
|
|
|
882
938
|
* Format: date-time
|
|
883
939
|
*/
|
|
884
940
|
updated_at: string;
|
|
941
|
+
/** Example Count */
|
|
942
|
+
example_count: number;
|
|
885
943
|
};
|
|
886
944
|
/** DatasetExample */
|
|
887
945
|
DatasetExample: {
|
|
@@ -1634,7 +1692,7 @@ export interface components {
|
|
|
1634
1692
|
* Reasoning Effort
|
|
1635
1693
|
* @enum {string}
|
|
1636
1694
|
*/
|
|
1637
|
-
reasoning_effort?: "low" | "medium" | "high";
|
|
1695
|
+
reasoning_effort?: "minimal" | "low" | "medium" | "high";
|
|
1638
1696
|
};
|
|
1639
1697
|
/** PromptChatTemplate */
|
|
1640
1698
|
PromptChatTemplate: {
|
|
@@ -1683,7 +1741,7 @@ export interface components {
|
|
|
1683
1741
|
* Reasoning Effort
|
|
1684
1742
|
* @enum {string}
|
|
1685
1743
|
*/
|
|
1686
|
-
reasoning_effort?: "low" | "medium" | "high";
|
|
1744
|
+
reasoning_effort?: "minimal" | "low" | "medium" | "high";
|
|
1687
1745
|
};
|
|
1688
1746
|
/** PromptGoogleInvocationParameters */
|
|
1689
1747
|
PromptGoogleInvocationParameters: {
|
|
@@ -1750,7 +1808,7 @@ export interface components {
|
|
|
1750
1808
|
* Reasoning Effort
|
|
1751
1809
|
* @enum {string}
|
|
1752
1810
|
*/
|
|
1753
|
-
reasoning_effort?: "low" | "medium" | "high";
|
|
1811
|
+
reasoning_effort?: "minimal" | "low" | "medium" | "high";
|
|
1754
1812
|
};
|
|
1755
1813
|
/** PromptOpenAIInvocationParameters */
|
|
1756
1814
|
PromptOpenAIInvocationParameters: {
|
|
@@ -1781,7 +1839,7 @@ export interface components {
|
|
|
1781
1839
|
* Reasoning Effort
|
|
1782
1840
|
* @enum {string}
|
|
1783
1841
|
*/
|
|
1784
|
-
reasoning_effort?: "low" | "medium" | "high";
|
|
1842
|
+
reasoning_effort?: "minimal" | "low" | "medium" | "high";
|
|
1785
1843
|
};
|
|
1786
1844
|
/** PromptResponseFormatJSONSchema */
|
|
1787
1845
|
PromptResponseFormatJSONSchema: {
|
|
@@ -1974,7 +2032,7 @@ export interface components {
|
|
|
1974
2032
|
* Reasoning Effort
|
|
1975
2033
|
* @enum {string}
|
|
1976
2034
|
*/
|
|
1977
|
-
reasoning_effort?: "low" | "medium" | "high";
|
|
2035
|
+
reasoning_effort?: "minimal" | "low" | "medium" | "high";
|
|
1978
2036
|
};
|
|
1979
2037
|
/** Span */
|
|
1980
2038
|
Span: {
|
|
@@ -3457,6 +3515,54 @@ export interface operations {
|
|
|
3457
3515
|
};
|
|
3458
3516
|
};
|
|
3459
3517
|
};
|
|
3518
|
+
deleteTrace: {
|
|
3519
|
+
parameters: {
|
|
3520
|
+
query?: never;
|
|
3521
|
+
header?: never;
|
|
3522
|
+
path: {
|
|
3523
|
+
/** @description The trace identifier: either a relay GlobalID or OpenTelemetry trace_id */
|
|
3524
|
+
trace_identifier: string;
|
|
3525
|
+
};
|
|
3526
|
+
cookie?: never;
|
|
3527
|
+
};
|
|
3528
|
+
requestBody?: never;
|
|
3529
|
+
responses: {
|
|
3530
|
+
/** @description Successful Response */
|
|
3531
|
+
204: {
|
|
3532
|
+
headers: {
|
|
3533
|
+
[name: string]: unknown;
|
|
3534
|
+
};
|
|
3535
|
+
content?: never;
|
|
3536
|
+
};
|
|
3537
|
+
/** @description Forbidden */
|
|
3538
|
+
403: {
|
|
3539
|
+
headers: {
|
|
3540
|
+
[name: string]: unknown;
|
|
3541
|
+
};
|
|
3542
|
+
content: {
|
|
3543
|
+
"text/plain": string;
|
|
3544
|
+
};
|
|
3545
|
+
};
|
|
3546
|
+
/** @description Not Found */
|
|
3547
|
+
404: {
|
|
3548
|
+
headers: {
|
|
3549
|
+
[name: string]: unknown;
|
|
3550
|
+
};
|
|
3551
|
+
content: {
|
|
3552
|
+
"text/plain": string;
|
|
3553
|
+
};
|
|
3554
|
+
};
|
|
3555
|
+
/** @description Validation Error */
|
|
3556
|
+
422: {
|
|
3557
|
+
headers: {
|
|
3558
|
+
[name: string]: unknown;
|
|
3559
|
+
};
|
|
3560
|
+
content: {
|
|
3561
|
+
"application/json": components["schemas"]["HTTPValidationError"];
|
|
3562
|
+
};
|
|
3563
|
+
};
|
|
3564
|
+
};
|
|
3565
|
+
};
|
|
3460
3566
|
spanSearch: {
|
|
3461
3567
|
parameters: {
|
|
3462
3568
|
query?: {
|
|
@@ -3692,6 +3798,54 @@ export interface operations {
|
|
|
3692
3798
|
};
|
|
3693
3799
|
};
|
|
3694
3800
|
};
|
|
3801
|
+
deleteSpan: {
|
|
3802
|
+
parameters: {
|
|
3803
|
+
query?: never;
|
|
3804
|
+
header?: never;
|
|
3805
|
+
path: {
|
|
3806
|
+
/** @description The span identifier: either a relay GlobalID or OpenTelemetry span_id */
|
|
3807
|
+
span_identifier: string;
|
|
3808
|
+
};
|
|
3809
|
+
cookie?: never;
|
|
3810
|
+
};
|
|
3811
|
+
requestBody?: never;
|
|
3812
|
+
responses: {
|
|
3813
|
+
/** @description Successful Response */
|
|
3814
|
+
204: {
|
|
3815
|
+
headers: {
|
|
3816
|
+
[name: string]: unknown;
|
|
3817
|
+
};
|
|
3818
|
+
content?: never;
|
|
3819
|
+
};
|
|
3820
|
+
/** @description Forbidden */
|
|
3821
|
+
403: {
|
|
3822
|
+
headers: {
|
|
3823
|
+
[name: string]: unknown;
|
|
3824
|
+
};
|
|
3825
|
+
content: {
|
|
3826
|
+
"text/plain": string;
|
|
3827
|
+
};
|
|
3828
|
+
};
|
|
3829
|
+
/** @description Not Found */
|
|
3830
|
+
404: {
|
|
3831
|
+
headers: {
|
|
3832
|
+
[name: string]: unknown;
|
|
3833
|
+
};
|
|
3834
|
+
content: {
|
|
3835
|
+
"text/plain": string;
|
|
3836
|
+
};
|
|
3837
|
+
};
|
|
3838
|
+
/** @description Validation Error */
|
|
3839
|
+
422: {
|
|
3840
|
+
headers: {
|
|
3841
|
+
[name: string]: unknown;
|
|
3842
|
+
};
|
|
3843
|
+
content: {
|
|
3844
|
+
"application/json": components["schemas"]["HTTPValidationError"];
|
|
3845
|
+
};
|
|
3846
|
+
};
|
|
3847
|
+
};
|
|
3848
|
+
};
|
|
3695
3849
|
getEvaluations: {
|
|
3696
3850
|
parameters: {
|
|
3697
3851
|
query?: {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createClient } from "../client";
|
|
2
|
+
import { ClientFn } from "../types/core";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parameters to delete a span
|
|
6
|
+
*/
|
|
7
|
+
export interface DeleteSpanParams extends ClientFn {
|
|
8
|
+
/**
|
|
9
|
+
* The span identifier. Can be either:
|
|
10
|
+
* - OpenTelemetry span_id (string)
|
|
11
|
+
* - Phoenix Global ID (string)
|
|
12
|
+
*/
|
|
13
|
+
spanIdentifier: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Delete a single span by identifier.
|
|
18
|
+
*
|
|
19
|
+
* **Important**: This operation deletes ONLY the specified span itself and does NOT
|
|
20
|
+
* delete its descendants/children. All child spans will remain in the trace and
|
|
21
|
+
* become orphaned (their parent_id will point to a non-existent span).
|
|
22
|
+
*
|
|
23
|
+
* Behavior:
|
|
24
|
+
* - Deletes only the target span (preserves all descendant spans)
|
|
25
|
+
* - Child spans become orphaned but remain in the database
|
|
26
|
+
* - Returns successfully if span is found and deleted
|
|
27
|
+
* - Throws error if span is not found (404) or other errors occur
|
|
28
|
+
*
|
|
29
|
+
* @experimental this function is experimental and may change in the future
|
|
30
|
+
*
|
|
31
|
+
* @param params - The parameters to delete a span
|
|
32
|
+
* @returns Promise that resolves when the span is successfully deleted
|
|
33
|
+
* @throws Error if the span is not found or deletion fails
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Delete by OpenTelemetry span_id
|
|
38
|
+
* await deleteSpan({
|
|
39
|
+
* client,
|
|
40
|
+
* spanIdentifier: "abc123def456"
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Delete by Phoenix Global ID
|
|
44
|
+
* await deleteSpan({
|
|
45
|
+
* client,
|
|
46
|
+
* spanIdentifier: "U3BhbjoyMzQ1Njc4OQ=="
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export async function deleteSpan({
|
|
51
|
+
client: _client,
|
|
52
|
+
spanIdentifier,
|
|
53
|
+
}: DeleteSpanParams): Promise<void> {
|
|
54
|
+
const client = _client ?? createClient();
|
|
55
|
+
|
|
56
|
+
const { error } = await client.DELETE("/v1/spans/{span_identifier}", {
|
|
57
|
+
params: {
|
|
58
|
+
path: {
|
|
59
|
+
span_identifier: spanIdentifier,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (error) {
|
|
65
|
+
const isNotFound =
|
|
66
|
+
typeof error === "object" &&
|
|
67
|
+
error !== null &&
|
|
68
|
+
"status" in error &&
|
|
69
|
+
error.status === 404;
|
|
70
|
+
if (isNotFound) {
|
|
71
|
+
throw new Error(`Span not found: ${spanIdentifier}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Extract meaningful error information
|
|
75
|
+
const errorMessage =
|
|
76
|
+
typeof error === "object" && error !== null
|
|
77
|
+
? JSON.stringify(error, null, 2)
|
|
78
|
+
: String(error);
|
|
79
|
+
throw new Error(`Failed to delete span: ${errorMessage}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
package/src/spans/index.ts
CHANGED