@arizeai/phoenix-client 6.8.1 β 6.9.1
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 +78 -0
- package/dist/esm/__generated__/api/v1.d.ts +30 -15
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/constants/serverRequirements.d.ts +1 -0
- package/dist/esm/constants/serverRequirements.d.ts.map +1 -1
- package/dist/esm/constants/serverRequirements.js +7 -0
- package/dist/esm/constants/serverRequirements.js.map +1 -1
- package/dist/esm/sessions/addSessionNote.d.ts +45 -0
- package/dist/esm/sessions/addSessionNote.d.ts.map +1 -0
- package/dist/esm/sessions/addSessionNote.js +45 -0
- package/dist/esm/sessions/addSessionNote.js.map +1 -0
- package/dist/esm/sessions/index.d.ts +1 -0
- package/dist/esm/sessions/index.d.ts.map +1 -1
- package/dist/esm/sessions/index.js +1 -0
- package/dist/esm/sessions/index.js.map +1 -1
- package/dist/esm/spans/addSpanNote.d.ts +5 -3
- package/dist/esm/spans/addSpanNote.d.ts.map +1 -1
- package/dist/esm/spans/addSpanNote.js +7 -4
- package/dist/esm/spans/addSpanNote.js.map +1 -1
- package/dist/esm/traces/addTraceAnnotation.d.ts +43 -0
- package/dist/esm/traces/addTraceAnnotation.d.ts.map +1 -0
- package/dist/esm/traces/addTraceAnnotation.js +43 -0
- package/dist/esm/traces/addTraceAnnotation.js.map +1 -0
- package/dist/esm/traces/addTraceNote.d.ts +5 -2
- package/dist/esm/traces/addTraceNote.d.ts.map +1 -1
- package/dist/esm/traces/addTraceNote.js +7 -3
- package/dist/esm/traces/addTraceNote.js.map +1 -1
- package/dist/esm/traces/index.d.ts +3 -0
- package/dist/esm/traces/index.d.ts.map +1 -1
- package/dist/esm/traces/index.js +2 -0
- package/dist/esm/traces/index.js.map +1 -1
- package/dist/esm/traces/logTraceAnnotations.d.ts +53 -0
- package/dist/esm/traces/logTraceAnnotations.d.ts.map +1 -0
- package/dist/esm/traces/logTraceAnnotations.js +50 -0
- package/dist/esm/traces/logTraceAnnotations.js.map +1 -0
- package/dist/esm/traces/types.d.ts +24 -0
- package/dist/esm/traces/types.d.ts.map +1 -0
- package/dist/esm/traces/types.js +38 -0
- package/dist/esm/traces/types.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/apiErrorUtils.d.ts +2 -0
- package/dist/esm/utils/apiErrorUtils.d.ts.map +1 -0
- package/dist/esm/utils/apiErrorUtils.js +19 -0
- package/dist/esm/utils/apiErrorUtils.js.map +1 -0
- 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 +30 -15
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/constants/serverRequirements.d.ts +1 -0
- package/dist/src/constants/serverRequirements.d.ts.map +1 -1
- package/dist/src/constants/serverRequirements.js +8 -1
- package/dist/src/constants/serverRequirements.js.map +1 -1
- package/dist/src/sessions/addSessionNote.d.ts +45 -0
- package/dist/src/sessions/addSessionNote.d.ts.map +1 -0
- package/dist/src/sessions/addSessionNote.js +48 -0
- package/dist/src/sessions/addSessionNote.js.map +1 -0
- package/dist/src/sessions/index.d.ts +1 -0
- package/dist/src/sessions/index.d.ts.map +1 -1
- package/dist/src/sessions/index.js +1 -0
- package/dist/src/sessions/index.js.map +1 -1
- package/dist/src/spans/addSpanNote.d.ts +5 -3
- package/dist/src/spans/addSpanNote.d.ts.map +1 -1
- package/dist/src/spans/addSpanNote.js +7 -4
- package/dist/src/spans/addSpanNote.js.map +1 -1
- package/dist/src/traces/addTraceAnnotation.d.ts +43 -0
- package/dist/src/traces/addTraceAnnotation.d.ts.map +1 -0
- package/dist/src/traces/addTraceAnnotation.js +47 -0
- package/dist/src/traces/addTraceAnnotation.js.map +1 -0
- package/dist/src/traces/addTraceNote.d.ts +5 -2
- package/dist/src/traces/addTraceNote.d.ts.map +1 -1
- package/dist/src/traces/addTraceNote.js +7 -3
- package/dist/src/traces/addTraceNote.js.map +1 -1
- package/dist/src/traces/index.d.ts +3 -0
- package/dist/src/traces/index.d.ts.map +1 -1
- package/dist/src/traces/index.js +2 -0
- package/dist/src/traces/index.js.map +1 -1
- package/dist/src/traces/logTraceAnnotations.d.ts +53 -0
- package/dist/src/traces/logTraceAnnotations.d.ts.map +1 -0
- package/dist/src/traces/logTraceAnnotations.js +53 -0
- package/dist/src/traces/logTraceAnnotations.js.map +1 -0
- package/dist/src/traces/types.d.ts +24 -0
- package/dist/src/traces/types.d.ts.map +1 -0
- package/dist/src/traces/types.js +42 -0
- package/dist/src/traces/types.js.map +1 -0
- package/dist/src/utils/apiErrorUtils.d.ts +2 -0
- package/dist/src/utils/apiErrorUtils.d.ts.map +1 -0
- package/dist/src/utils/apiErrorUtils.js +22 -0
- package/dist/src/utils/apiErrorUtils.js.map +1 -0
- 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 +4 -4
- package/src/__generated__/api/v1.ts +30 -15
- package/src/constants/serverRequirements.ts +8 -0
- package/src/sessions/addSessionNote.ts +74 -0
- package/src/sessions/index.ts +1 -0
- package/src/spans/addSpanNote.ts +7 -4
- package/src/traces/addTraceAnnotation.ts +65 -0
- package/src/traces/addTraceNote.ts +7 -3
- package/src/traces/index.ts +3 -0
- package/src/traces/logTraceAnnotations.ts +75 -0
- package/src/traces/types.ts +72 -0
- package/src/utils/apiErrorUtils.ts +17 -0
package/README.md
CHANGED
|
@@ -368,6 +368,69 @@ do {
|
|
|
368
368
|
|
|
369
369
|
> **Note:** Requires Phoenix server >= 13.15.0.
|
|
370
370
|
|
|
371
|
+
### Trace Annotations
|
|
372
|
+
|
|
373
|
+
Add structured feedback (label/score by name) to entire traces. Use `addTraceAnnotation` for one trace or `logTraceAnnotations` for batches.
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
import {
|
|
377
|
+
addTraceAnnotation,
|
|
378
|
+
logTraceAnnotations,
|
|
379
|
+
} from "@arizeai/phoenix-client/traces";
|
|
380
|
+
|
|
381
|
+
// Single annotation
|
|
382
|
+
const result = await addTraceAnnotation({
|
|
383
|
+
traceAnnotation: {
|
|
384
|
+
traceId: "abc123",
|
|
385
|
+
name: "correctness",
|
|
386
|
+
label: "correct",
|
|
387
|
+
score: 1.0,
|
|
388
|
+
annotatorKind: "HUMAN",
|
|
389
|
+
},
|
|
390
|
+
sync: true, // returns { id: "..." } when sync, null when async
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
// Batch
|
|
394
|
+
await logTraceAnnotations({
|
|
395
|
+
traceAnnotations: [
|
|
396
|
+
{
|
|
397
|
+
traceId: "abc123",
|
|
398
|
+
name: "correctness",
|
|
399
|
+
label: "correct",
|
|
400
|
+
score: 1.0,
|
|
401
|
+
annotatorKind: "HUMAN",
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
traceId: "def456",
|
|
405
|
+
name: "faithfulness",
|
|
406
|
+
label: "faithful",
|
|
407
|
+
score: 0.9,
|
|
408
|
+
annotatorKind: "LLM",
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
sync: true,
|
|
412
|
+
});
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
The reserved name `note` is rejected β use `addTraceNote` instead for free-form notes (see below).
|
|
416
|
+
|
|
417
|
+
### Trace Notes
|
|
418
|
+
|
|
419
|
+
Notes are a special type of annotation for free-form text β useful for open coding, where reviewers leave qualitative observations on a trace before any rubric exists. Multiple notes can coexist on the same trace.
|
|
420
|
+
|
|
421
|
+
```ts
|
|
422
|
+
import { addTraceNote } from "@arizeai/phoenix-client/traces";
|
|
423
|
+
|
|
424
|
+
await addTraceNote({
|
|
425
|
+
traceNote: {
|
|
426
|
+
traceId: "abc123",
|
|
427
|
+
note: "Needs follow-up β unexpected tool call sequence",
|
|
428
|
+
},
|
|
429
|
+
});
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
> **Note:** `addTraceNote` requires Phoenix server >= 14.13.0.
|
|
433
|
+
|
|
371
434
|
## Spans
|
|
372
435
|
|
|
373
436
|
The `@arizeai/phoenix-client` package provides a `spans` export for querying spans with powerful filtering.
|
|
@@ -505,6 +568,7 @@ import {
|
|
|
505
568
|
listSessions,
|
|
506
569
|
getSession,
|
|
507
570
|
addSessionAnnotation,
|
|
571
|
+
addSessionNote,
|
|
508
572
|
} from "@arizeai/phoenix-client/sessions";
|
|
509
573
|
|
|
510
574
|
// List all sessions for a project
|
|
@@ -537,6 +601,19 @@ await addSessionAnnotation({
|
|
|
537
601
|
});
|
|
538
602
|
```
|
|
539
603
|
|
|
604
|
+
### Adding Session Notes
|
|
605
|
+
|
|
606
|
+
Session notes require Phoenix server `14.17.0` or newer.
|
|
607
|
+
|
|
608
|
+
```ts
|
|
609
|
+
await addSessionNote({
|
|
610
|
+
sessionNote: {
|
|
611
|
+
sessionId: "my-session-id",
|
|
612
|
+
note: "Needs review",
|
|
613
|
+
},
|
|
614
|
+
});
|
|
615
|
+
```
|
|
616
|
+
|
|
540
617
|
## Examples
|
|
541
618
|
|
|
542
619
|
To run examples, install dependencies using `pnpm` and run:
|
|
@@ -572,4 +649,5 @@ Join our community to connect with thousands of AI builders:
|
|
|
572
649
|
- π Leave a star on our [GitHub](https://github.com/Arize-ai/phoenix).
|
|
573
650
|
- π Report bugs with [GitHub Issues](https://github.com/Arize-ai/phoenix/issues).
|
|
574
651
|
- π Follow us on [π](https://twitter.com/ArizePhoenix).
|
|
652
|
+
- πΌ Follow us on [LinkedIn](https://www.linkedin.com/showcase/113218220).
|
|
575
653
|
- πΊοΈ Check out our [roadmap](https://github.com/orgs/Arize-ai/projects/45) to see where we're heading next.
|
|
@@ -66,7 +66,10 @@ export interface paths {
|
|
|
66
66
|
path?: never;
|
|
67
67
|
cookie?: never;
|
|
68
68
|
};
|
|
69
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Get span annotations filtered by span_ids and/or identifier.
|
|
71
|
+
* @description Return span annotations for a project, filtered by `span_ids`, `identifier`, or both. At least one of `span_ids` or `identifier` must be supplied. When both are supplied, results are the AND-intersection of the two filters.
|
|
72
|
+
*/
|
|
70
73
|
get: operations["listSpanAnnotationsBySpanIds"];
|
|
71
74
|
put?: never;
|
|
72
75
|
post?: never;
|
|
@@ -83,7 +86,10 @@ export interface paths {
|
|
|
83
86
|
path?: never;
|
|
84
87
|
cookie?: never;
|
|
85
88
|
};
|
|
86
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Get trace annotations filtered by trace_ids and/or identifier.
|
|
91
|
+
* @description Return trace annotations for a project, filtered by `trace_ids`, `identifier`, or both. At least one of `trace_ids` or `identifier` must be supplied. When both are supplied, results are the AND-intersection of the two filters.
|
|
92
|
+
*/
|
|
87
93
|
get: operations["listTraceAnnotationsByTraceIds"];
|
|
88
94
|
put?: never;
|
|
89
95
|
post?: never;
|
|
@@ -100,7 +106,10 @@ export interface paths {
|
|
|
100
106
|
path?: never;
|
|
101
107
|
cookie?: never;
|
|
102
108
|
};
|
|
103
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Get session annotations filtered by session_ids and/or identifier.
|
|
111
|
+
* @description Return session annotations for a project, filtered by `session_ids`, `identifier`, or both. At least one of `session_ids` or `identifier` must be supplied. When both are supplied, results are the AND-intersection of the two filters.
|
|
112
|
+
*/
|
|
104
113
|
get: operations["listSessionAnnotationsBySessionIds"];
|
|
105
114
|
put?: never;
|
|
106
115
|
post?: never;
|
|
@@ -485,7 +494,7 @@ export interface paths {
|
|
|
485
494
|
put?: never;
|
|
486
495
|
/**
|
|
487
496
|
* Create a trace note
|
|
488
|
-
* @description Add a note annotation to a trace.
|
|
497
|
+
* @description Add a note annotation to a trace. Each call appends a new note with an auto-generated UUIDv4 identifier, so multiple notes accumulate on the same trace. Structured annotations, by contrast, are keyed by (name, trace_id, identifier) β re-writing the same key overwrites the existing annotation, so to keep multiple structured annotations with the same name on a trace you must supply distinct identifiers.
|
|
489
498
|
*/
|
|
490
499
|
post: operations["createTraceNote"];
|
|
491
500
|
delete?: never;
|
|
@@ -590,7 +599,7 @@ export interface paths {
|
|
|
590
599
|
put?: never;
|
|
591
600
|
/**
|
|
592
601
|
* Create a span note
|
|
593
|
-
* @description Add a note annotation to a span.
|
|
602
|
+
* @description Add a note annotation to a span. Each call appends a new note with an auto-generated UUIDv4 identifier, so multiple notes accumulate on the same span. Structured annotations, by contrast, are keyed by (name, span_id, identifier) β re-writing the same key overwrites the existing annotation, so to keep multiple structured annotations with the same name on a span you must supply distinct identifiers.
|
|
594
603
|
*/
|
|
595
604
|
post: operations["createSpanNote"];
|
|
596
605
|
delete?: never;
|
|
@@ -941,7 +950,7 @@ export interface paths {
|
|
|
941
950
|
put?: never;
|
|
942
951
|
/**
|
|
943
952
|
* Create a session note
|
|
944
|
-
* @description Add a note annotation to a session.
|
|
953
|
+
* @description Add a note annotation to a session. Each call appends a new note with an auto-generated UUIDv4 identifier, so multiple notes accumulate on the same session. Structured annotations, by contrast, are keyed by (name, session_id, identifier) β re-writing the same key overwrites the existing annotation, so to keep multiple structured annotations with the same name on a session you must supply distinct identifiers.
|
|
945
954
|
*/
|
|
946
955
|
post: operations["createSessionNote"];
|
|
947
956
|
delete?: never;
|
|
@@ -3966,9 +3975,11 @@ export interface operations {
|
|
|
3966
3975
|
};
|
|
3967
3976
|
listSpanAnnotationsBySpanIds: {
|
|
3968
3977
|
parameters: {
|
|
3969
|
-
query
|
|
3970
|
-
/** @description
|
|
3971
|
-
span_ids
|
|
3978
|
+
query?: {
|
|
3979
|
+
/** @description Optional list of span ids to fetch annotations for. If omitted, `identifier` must be supplied. */
|
|
3980
|
+
span_ids?: string[] | null;
|
|
3981
|
+
/** @description Optional list of annotation identifiers to filter by. Each value must be non-empty. If omitted, `span_ids` must be supplied. When combined with `span_ids`, results are the AND-intersection of both filters. */
|
|
3982
|
+
identifier?: string[] | null;
|
|
3972
3983
|
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned. 'note' annotations are excluded by default unless explicitly included in this list. */
|
|
3973
3984
|
include_annotation_names?: string[] | null;
|
|
3974
3985
|
/** @description Optional list of annotation names to exclude from results. */
|
|
@@ -4027,9 +4038,11 @@ export interface operations {
|
|
|
4027
4038
|
};
|
|
4028
4039
|
listTraceAnnotationsByTraceIds: {
|
|
4029
4040
|
parameters: {
|
|
4030
|
-
query
|
|
4031
|
-
/** @description
|
|
4032
|
-
trace_ids
|
|
4041
|
+
query?: {
|
|
4042
|
+
/** @description Optional list of trace ids to fetch annotations for. If omitted, `identifier` must be supplied. */
|
|
4043
|
+
trace_ids?: string[] | null;
|
|
4044
|
+
/** @description Optional list of annotation identifiers to filter by. Each value must be non-empty. If omitted, `trace_ids` must be supplied. When combined with `trace_ids`, results are the AND-intersection of both filters. */
|
|
4045
|
+
identifier?: string[] | null;
|
|
4033
4046
|
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned. 'note' annotations are excluded by default unless explicitly included in this list. */
|
|
4034
4047
|
include_annotation_names?: string[] | null;
|
|
4035
4048
|
/** @description Optional list of annotation names to exclude from results. */
|
|
@@ -4088,9 +4101,11 @@ export interface operations {
|
|
|
4088
4101
|
};
|
|
4089
4102
|
listSessionAnnotationsBySessionIds: {
|
|
4090
4103
|
parameters: {
|
|
4091
|
-
query
|
|
4092
|
-
/** @description
|
|
4093
|
-
session_ids
|
|
4104
|
+
query?: {
|
|
4105
|
+
/** @description Optional list of session ids to fetch annotations for. If omitted, `identifier` must be supplied. */
|
|
4106
|
+
session_ids?: string[] | null;
|
|
4107
|
+
/** @description Optional list of annotation identifiers to filter by. Each value must be non-empty. If omitted, `session_ids` must be supplied. When combined with `session_ids`, results are the AND-intersection of both filters. */
|
|
4108
|
+
identifier?: string[] | null;
|
|
4094
4109
|
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned. 'note' annotations are excluded by default unless explicitly included in this list. */
|
|
4095
4110
|
include_annotation_names?: string[] | null;
|
|
4096
4111
|
/** @description Optional list of annotation names to exclude from results. */
|