@arizeai/phoenix-client 6.5.3 → 6.5.5
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 +45 -0
- package/dist/esm/__generated__/api/v1.d.ts +244 -0
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/experiments/resumeEvaluation.d.ts.map +1 -1
- package/dist/esm/experiments/resumeEvaluation.js +179 -170
- package/dist/esm/experiments/resumeEvaluation.js.map +1 -1
- package/dist/esm/experiments/resumeExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/resumeExperiment.js +201 -185
- package/dist/esm/experiments/resumeExperiment.js.map +1 -1
- package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.js +238 -207
- package/dist/esm/experiments/runExperiment.js.map +1 -1
- package/dist/esm/experiments/tracing.d.ts +10 -0
- package/dist/esm/experiments/tracing.d.ts.map +1 -0
- package/dist/esm/experiments/tracing.js +21 -0
- package/dist/esm/experiments/tracing.js.map +1 -0
- package/dist/esm/prompts/sdks/toSDK.d.ts +2 -2
- 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 +244 -0
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/experiments/resumeEvaluation.d.ts.map +1 -1
- package/dist/src/experiments/resumeEvaluation.js +192 -183
- package/dist/src/experiments/resumeEvaluation.js.map +1 -1
- package/dist/src/experiments/resumeExperiment.d.ts.map +1 -1
- package/dist/src/experiments/resumeExperiment.js +214 -198
- package/dist/src/experiments/resumeExperiment.js.map +1 -1
- package/dist/src/experiments/runExperiment.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.js +228 -197
- package/dist/src/experiments/runExperiment.js.map +1 -1
- package/dist/src/experiments/tracing.d.ts +10 -0
- package/dist/src/experiments/tracing.d.ts.map +1 -0
- package/dist/src/experiments/tracing.js +24 -0
- package/dist/src/experiments/tracing.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/docs/annotations.mdx +83 -0
- package/docs/datasets.mdx +77 -0
- package/docs/document-annotations.mdx +208 -0
- package/docs/experiments.mdx +271 -0
- package/docs/overview.mdx +176 -0
- package/docs/prompts.mdx +73 -0
- package/docs/session-annotations.mdx +158 -0
- package/docs/sessions.mdx +87 -0
- package/docs/span-annotations.mdx +283 -0
- package/docs/spans.mdx +76 -0
- package/docs/traces.mdx +63 -0
- package/package.json +11 -5
- package/src/__generated__/api/v1.ts +244 -0
- package/src/experiments/resumeEvaluation.ts +224 -206
- package/src/experiments/resumeExperiment.ts +237 -213
- package/src/experiments/runExperiment.ts +281 -243
- package/src/experiments/tracing.ts +30 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Span Annotations"
|
|
3
|
+
description: "Log and retrieve span-level annotations with @arizeai/phoenix-client"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Span annotations attach structured feedback to individual traced operations — an LLM call, a tool invocation, a retrieval step. Use them to record quality scores, human labels, or LLM-as-judge verdicts against any span in your project.
|
|
7
|
+
|
|
8
|
+
All functions are imported from `@arizeai/phoenix-client/spans`. See [Annotations](./annotations) for the shared annotation model and concepts.
|
|
9
|
+
|
|
10
|
+
<section className="hidden" data-agent-context="relevant-source-files" aria-label="Relevant source files">
|
|
11
|
+
<h2>Relevant Source Files</h2>
|
|
12
|
+
<ul>
|
|
13
|
+
<li><code>src/spans/addSpanAnnotation.ts</code> for the single-annotation API</li>
|
|
14
|
+
<li><code>src/spans/logSpanAnnotations.ts</code> for batch logging</li>
|
|
15
|
+
<li><code>src/spans/getSpanAnnotations.ts</code> for reading annotations back</li>
|
|
16
|
+
<li><code>src/spans/getSpans.ts</code> for fetching span IDs from Phoenix</li>
|
|
17
|
+
<li><code>src/spans/types.ts</code> for the <code>SpanAnnotation</code> interface</li>
|
|
18
|
+
</ul>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
21
|
+
## Getting The `spanId`
|
|
22
|
+
|
|
23
|
+
`spanId` is the OpenTelemetry span ID for the operation you want to annotate. In practice, you usually get it one of two ways:
|
|
24
|
+
|
|
25
|
+
### From Running Code With `@arizeai/phoenix-otel`
|
|
26
|
+
|
|
27
|
+
If you are already tracing the operation at runtime, capture the span ID from the active span and keep it with the application response, evaluation job, or feedback event that will log the annotation later.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { register, trace } from "@arizeai/phoenix-otel";
|
|
31
|
+
|
|
32
|
+
register({ projectName: "support-bot" });
|
|
33
|
+
|
|
34
|
+
const tracer = trace.getTracer("support-bot");
|
|
35
|
+
|
|
36
|
+
const result = await tracer.startActiveSpan("answer-question", async (span) => {
|
|
37
|
+
const spanId = span.spanContext().spanId;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
answer: "Phoenix is open source.",
|
|
41
|
+
spanId,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you are already inside traced code and just need the current span, `trace.getActiveSpan()?.spanContext().spanId` gives you the same OpenTelemetry ID.
|
|
47
|
+
|
|
48
|
+
### From Retrieved Spans During Evaluation
|
|
49
|
+
|
|
50
|
+
If you are annotating spans after the fact, fetch the spans from Phoenix first and read the OpenTelemetry span ID from `span.context.span_id`.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { getSpans } from "@arizeai/phoenix-client/spans";
|
|
54
|
+
|
|
55
|
+
const { spans } = await getSpans({
|
|
56
|
+
project: { projectName: "support-bot" },
|
|
57
|
+
spanKind: "LLM",
|
|
58
|
+
limit: 10,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
for (const span of spans) {
|
|
62
|
+
const spanId = span.context.span_id;
|
|
63
|
+
console.log(span.name, spanId);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Add A Single Span Annotation
|
|
68
|
+
|
|
69
|
+
Use `addSpanAnnotation` to attach one annotation to a span. This example records an LLM-as-judge groundedness evaluation:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { addSpanAnnotation } from "@arizeai/phoenix-client/spans";
|
|
73
|
+
|
|
74
|
+
await addSpanAnnotation({
|
|
75
|
+
spanAnnotation: {
|
|
76
|
+
spanId: "abc123def456",
|
|
77
|
+
name: "groundedness",
|
|
78
|
+
annotatorKind: "LLM",
|
|
79
|
+
score: 1,
|
|
80
|
+
label: "grounded",
|
|
81
|
+
explanation: "Answer stayed within retrieved context.",
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Batch Log Span Annotations
|
|
87
|
+
|
|
88
|
+
Use `logSpanAnnotations` to send multiple annotations in a single request. This is ideal for nightly evaluation pipelines that score many spans at once:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { logSpanAnnotations } from "@arizeai/phoenix-client/spans";
|
|
92
|
+
|
|
93
|
+
await logSpanAnnotations({
|
|
94
|
+
spanAnnotations: [
|
|
95
|
+
{
|
|
96
|
+
spanId: "abc123def456",
|
|
97
|
+
name: "helpfulness",
|
|
98
|
+
annotatorKind: "CODE",
|
|
99
|
+
score: 0.2,
|
|
100
|
+
label: "poor",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
spanId: "789ghi012jkl",
|
|
104
|
+
name: "helpfulness",
|
|
105
|
+
annotatorKind: "CODE",
|
|
106
|
+
score: 0.9,
|
|
107
|
+
label: "excellent",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Human Feedback (Thumbs Up/Down)
|
|
114
|
+
|
|
115
|
+
The most common annotation pattern: capture end-user reactions and log them as `HUMAN` annotations. Include metadata to correlate feedback with your application's user model:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { addSpanAnnotation } from "@arizeai/phoenix-client/spans";
|
|
119
|
+
|
|
120
|
+
// User clicked thumbs-up on an LLM response
|
|
121
|
+
await addSpanAnnotation({
|
|
122
|
+
spanAnnotation: {
|
|
123
|
+
spanId: responseSpanId,
|
|
124
|
+
name: "user-feedback",
|
|
125
|
+
annotatorKind: "HUMAN",
|
|
126
|
+
label: "positive",
|
|
127
|
+
score: 1,
|
|
128
|
+
metadata: { userId: "u_42", channel: "web-chat" },
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Idempotent Upserts With `identifier`
|
|
134
|
+
|
|
135
|
+
Annotations are unique by `(name, spanId, identifier)`. The `identifier` field controls whether a write creates a new annotation or updates an existing one.
|
|
136
|
+
|
|
137
|
+
Without `identifier`, a span can only have one annotation per name — writing again overwrites it. Adding an `identifier` lets you store **multiple annotations with the same name** on the same span, each keyed by a different identifier. Re-sending the same `(name, spanId, identifier)` tuple updates that specific annotation in place.
|
|
138
|
+
|
|
139
|
+
Common patterns:
|
|
140
|
+
|
|
141
|
+
- **One annotation per user** — use a user ID as the identifier so each user's feedback is stored separately and re-submitting updates their previous rating.
|
|
142
|
+
- **One annotation per evaluator version** — use the evaluator version string so pipeline reruns update in place rather than duplicating.
|
|
143
|
+
- **One annotation per reviewer** — use the reviewer's name or ID so multiple reviewers can each annotate the same span independently.
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { addSpanAnnotation } from "@arizeai/phoenix-client/spans";
|
|
147
|
+
|
|
148
|
+
// Two different users can each leave a "helpfulness" rating on the same span
|
|
149
|
+
await addSpanAnnotation({
|
|
150
|
+
spanAnnotation: {
|
|
151
|
+
spanId: "abc123def456",
|
|
152
|
+
name: "helpfulness",
|
|
153
|
+
annotatorKind: "HUMAN",
|
|
154
|
+
score: 1,
|
|
155
|
+
label: "helpful",
|
|
156
|
+
identifier: "user-alice",
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
await addSpanAnnotation({
|
|
161
|
+
spanAnnotation: {
|
|
162
|
+
spanId: "abc123def456",
|
|
163
|
+
name: "helpfulness",
|
|
164
|
+
annotatorKind: "HUMAN",
|
|
165
|
+
score: 0,
|
|
166
|
+
label: "not-helpful",
|
|
167
|
+
identifier: "user-bob",
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
// Both annotations coexist. If Alice re-submits, her annotation is updated.
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Read Back Span Annotations
|
|
174
|
+
|
|
175
|
+
Use `getSpanAnnotations` to retrieve annotations for one or more spans.
|
|
176
|
+
|
|
177
|
+
### Basic Read
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
import { getSpanAnnotations } from "@arizeai/phoenix-client/spans";
|
|
181
|
+
|
|
182
|
+
const result = await getSpanAnnotations({
|
|
183
|
+
project: { projectName: "support-bot" },
|
|
184
|
+
spanIds: ["abc123def456"],
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
for (const annotation of result.annotations) {
|
|
188
|
+
console.log(annotation.name, annotation.result?.label);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Filtered Read
|
|
193
|
+
|
|
194
|
+
Fetch only specific annotation names across multiple spans:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
const result = await getSpanAnnotations({
|
|
198
|
+
project: { projectName: "support-bot" },
|
|
199
|
+
spanIds: ["abc123def456", "789ghi012jkl"],
|
|
200
|
+
includeAnnotationNames: ["groundedness", "helpfulness"],
|
|
201
|
+
limit: 50,
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Use `excludeAnnotationNames` to omit specific names instead — for example, to skip `"note"` annotations.
|
|
206
|
+
|
|
207
|
+
### Pagination
|
|
208
|
+
|
|
209
|
+
For large result sets, use cursor-based pagination:
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
let cursor: string | undefined;
|
|
213
|
+
do {
|
|
214
|
+
const page = await getSpanAnnotations({
|
|
215
|
+
project: { projectName: "support-bot" },
|
|
216
|
+
spanIds: spanIdBatch,
|
|
217
|
+
cursor,
|
|
218
|
+
limit: 100,
|
|
219
|
+
});
|
|
220
|
+
for (const annotation of page.annotations) {
|
|
221
|
+
// process each annotation
|
|
222
|
+
}
|
|
223
|
+
cursor = page.nextCursor ?? undefined;
|
|
224
|
+
} while (cursor);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Span Notes
|
|
228
|
+
|
|
229
|
+
`addSpanNote` attaches a free-text comment to a span. Unlike structured annotations (which are keyed by `name` + `identifier`), notes are append-only — each call creates a new note with a unique timestamp-based identifier, so multiple notes naturally accumulate on the same span.
|
|
230
|
+
|
|
231
|
+
This makes notes a good mechanism for **open coding**: reviewers can leave qualitative observations on spans during exploratory analysis without needing to define annotation names or scoring rubrics up front. The accumulated notes can later inform what structured annotations to create.
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
import { addSpanNote } from "@arizeai/phoenix-client/spans";
|
|
235
|
+
|
|
236
|
+
await addSpanNote({
|
|
237
|
+
spanNote: {
|
|
238
|
+
spanId: "abc123def456",
|
|
239
|
+
note: "Escalated: retrieval returned empty docs.",
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Parameter Reference
|
|
245
|
+
|
|
246
|
+
### `SpanAnnotation`
|
|
247
|
+
|
|
248
|
+
| Field | Type | Required | Description |
|
|
249
|
+
|-------|------|----------|-------------|
|
|
250
|
+
| `spanId` | `string` | Yes | OpenTelemetry span ID (hex, no `0x` prefix) |
|
|
251
|
+
| `name` | `string` | Yes | Annotation name (e.g. `"groundedness"`) |
|
|
252
|
+
| `annotatorKind` | `"HUMAN" \| "LLM" \| "CODE"` | No | Defaults to `"HUMAN"` |
|
|
253
|
+
| `label` | `string` | No* | Categorical label |
|
|
254
|
+
| `score` | `number` | No* | Numeric score |
|
|
255
|
+
| `explanation` | `string` | No* | Free-text explanation |
|
|
256
|
+
| `identifier` | `string` | No | For idempotent upserts |
|
|
257
|
+
| `metadata` | `Record<string, unknown>` | No | Arbitrary metadata |
|
|
258
|
+
|
|
259
|
+
\*At least one of `label`, `score`, or `explanation` is required.
|
|
260
|
+
|
|
261
|
+
### `getSpanAnnotations` Options
|
|
262
|
+
|
|
263
|
+
| Field | Type | Required | Description |
|
|
264
|
+
|-------|------|----------|-------------|
|
|
265
|
+
| `project` | `{ projectName } \| { projectId }` | Yes | Project selector |
|
|
266
|
+
| `spanIds` | `string[]` | Yes | Span IDs to fetch annotations for |
|
|
267
|
+
| `includeAnnotationNames` | `string[]` | No | Only return these annotation names |
|
|
268
|
+
| `excludeAnnotationNames` | `string[]` | No | Exclude these annotation names |
|
|
269
|
+
| `cursor` | `string` | No | Pagination cursor |
|
|
270
|
+
| `limit` | `number` | No | Max results per page (default 100) |
|
|
271
|
+
|
|
272
|
+
<section className="hidden" data-agent-context="source-map" aria-label="Source map">
|
|
273
|
+
<h2>Source Map</h2>
|
|
274
|
+
<ul>
|
|
275
|
+
<li><code>src/spans/addSpanAnnotation.ts</code></li>
|
|
276
|
+
<li><code>src/spans/logSpanAnnotations.ts</code></li>
|
|
277
|
+
<li><code>src/spans/getSpanAnnotations.ts</code></li>
|
|
278
|
+
<li><code>src/spans/getSpans.ts</code></li>
|
|
279
|
+
<li><code>src/spans/addSpanNote.ts</code></li>
|
|
280
|
+
<li><code>src/spans/types.ts</code></li>
|
|
281
|
+
<li><code>src/types/annotations.ts</code></li>
|
|
282
|
+
</ul>
|
|
283
|
+
</section>
|
package/docs/spans.mdx
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Spans"
|
|
3
|
+
description: "Search and manage spans with @arizeai/phoenix-client"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use the spans module to search project spans and perform span-level maintenance such as deleting spans or adding notes.
|
|
7
|
+
|
|
8
|
+
<section className="hidden" data-agent-context="relevant-source-files" aria-label="Relevant source files">
|
|
9
|
+
<h2>Relevant Source Files</h2>
|
|
10
|
+
<ul>
|
|
11
|
+
<li>
|
|
12
|
+
<code>src/spans/getSpans.ts</code> for the exact filter names and query
|
|
13
|
+
behavior
|
|
14
|
+
</li>
|
|
15
|
+
</ul>
|
|
16
|
+
</section>
|
|
17
|
+
|
|
18
|
+
## Search Spans
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { getSpans } from "@arizeai/phoenix-client/spans";
|
|
22
|
+
|
|
23
|
+
const result = await getSpans({
|
|
24
|
+
project: { projectName: "support-bot" },
|
|
25
|
+
limit: 100,
|
|
26
|
+
spanKind: ["LLM", "TOOL"],
|
|
27
|
+
statusCode: "ERROR",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
for (const span of result.spans) {
|
|
31
|
+
console.log(span.name, span.context.trace_id);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Root Span Queries
|
|
36
|
+
|
|
37
|
+
Use `parentId: null` to limit results to root spans only.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const rootSpans = await getSpans({
|
|
41
|
+
project: { projectName: "support-bot" },
|
|
42
|
+
parentId: null,
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Span Maintenance
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { addSpanNote, deleteSpan } from "@arizeai/phoenix-client/spans";
|
|
50
|
+
|
|
51
|
+
await addSpanNote({
|
|
52
|
+
spanNote: {
|
|
53
|
+
spanId: "abc123def456",
|
|
54
|
+
note: "Escalated due to failed retrieval",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
await deleteSpan({
|
|
59
|
+
spanIdentifier: "abc123def456",
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`deleteSpan` accepts either the OpenTelemetry `span_id` or Phoenix's global span ID.
|
|
64
|
+
|
|
65
|
+
For span-level annotations (labels, scores, evaluations), see [Span Annotations](./span-annotations) and [Document Annotations](./document-annotations).
|
|
66
|
+
|
|
67
|
+
<section className="hidden" data-agent-context="source-map" aria-label="Source map">
|
|
68
|
+
<h2>Source Map</h2>
|
|
69
|
+
<ul>
|
|
70
|
+
<li><code>src/spans/getSpans.ts</code></li>
|
|
71
|
+
<li><code>src/spans/addSpanNote.ts</code></li>
|
|
72
|
+
<li><code>src/spans/deleteSpan.ts</code></li>
|
|
73
|
+
<li><code>src/spans/getSpanAnnotations.ts</code></li>
|
|
74
|
+
<li><code>src/types/spans.ts</code></li>
|
|
75
|
+
</ul>
|
|
76
|
+
</section>
|
package/docs/traces.mdx
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Traces"
|
|
3
|
+
description: "Retrieve traces with @arizeai/phoenix-client"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use `getTraces` when you want trace-centric pagination by project, optional inline spans, or filtering by session.
|
|
7
|
+
|
|
8
|
+
<section className="hidden" data-agent-context="relevant-source-files" aria-label="Relevant source files">
|
|
9
|
+
<h2>Relevant Source Files</h2>
|
|
10
|
+
<ul>
|
|
11
|
+
<li>
|
|
12
|
+
<code>src/traces/getTraces.ts</code> for the exact query shape and server
|
|
13
|
+
requirement
|
|
14
|
+
</li>
|
|
15
|
+
</ul>
|
|
16
|
+
</section>
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { getTraces } from "@arizeai/phoenix-client/traces";
|
|
22
|
+
|
|
23
|
+
const result = await getTraces({
|
|
24
|
+
project: { projectName: "support-bot" },
|
|
25
|
+
startTime: new Date("2026-03-01T00:00:00Z"),
|
|
26
|
+
endTime: new Date("2026-03-02T00:00:00Z"),
|
|
27
|
+
includeSpans: true,
|
|
28
|
+
limit: 50,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
for (const trace of result.traces) {
|
|
32
|
+
console.log(trace.trace_id);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.log(result.nextCursor);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Supported Filters
|
|
39
|
+
|
|
40
|
+
- `project`
|
|
41
|
+
- `startTime`
|
|
42
|
+
- `endTime`
|
|
43
|
+
- `sort`
|
|
44
|
+
- `order`
|
|
45
|
+
- `limit`
|
|
46
|
+
- `cursor`
|
|
47
|
+
- `includeSpans`
|
|
48
|
+
- `sessionId`
|
|
49
|
+
|
|
50
|
+
## Notes
|
|
51
|
+
|
|
52
|
+
- `getTraces` requires a Phoenix server that supports project trace listing
|
|
53
|
+
- Use the returned `nextCursor` to continue pagination
|
|
54
|
+
- Set `includeSpans` when you need a trace-centric fetch that also contains span details
|
|
55
|
+
- `project` accepts `{ project }`, `{ projectId }`, or `{ projectName }`
|
|
56
|
+
|
|
57
|
+
<section className="hidden" data-agent-context="source-map" aria-label="Source map">
|
|
58
|
+
<h2>Source Map</h2>
|
|
59
|
+
<ul>
|
|
60
|
+
<li><code>src/traces/getTraces.ts</code></li>
|
|
61
|
+
<li><code>src/types/projects.ts</code></li>
|
|
62
|
+
</ul>
|
|
63
|
+
</section>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arizeai/phoenix-client",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.5",
|
|
4
4
|
"description": "A client for the Phoenix API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arize",
|
|
@@ -22,8 +22,12 @@
|
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "git+https://github.com/Arize-ai/phoenix.git"
|
|
24
24
|
},
|
|
25
|
+
"directories": {
|
|
26
|
+
"doc": "./docs"
|
|
27
|
+
},
|
|
25
28
|
"files": [
|
|
26
29
|
"dist",
|
|
30
|
+
"docs",
|
|
27
31
|
"src",
|
|
28
32
|
"package.json"
|
|
29
33
|
],
|
|
@@ -75,20 +79,22 @@
|
|
|
75
79
|
"openapi-fetch": "^0.12.5",
|
|
76
80
|
"tiny-invariant": "^1.3.3",
|
|
77
81
|
"zod": "^4.0.14",
|
|
78
|
-
"@arizeai/phoenix-otel": "0.4.
|
|
79
|
-
"@arizeai/phoenix-config": "0.1.
|
|
82
|
+
"@arizeai/phoenix-otel": "0.4.3",
|
|
83
|
+
"@arizeai/phoenix-config": "0.1.3"
|
|
80
84
|
},
|
|
81
85
|
"devDependencies": {
|
|
82
86
|
"@ai-sdk/openai": "^3.0.29",
|
|
83
87
|
"@anthropic-ai/sdk": "^0.35.0",
|
|
88
|
+
"@opentelemetry/api": "^1.9.0",
|
|
89
|
+
"@opentelemetry/sdk-trace-node": "^2.5.1",
|
|
84
90
|
"@types/async": "^3.2.24",
|
|
85
91
|
"@types/node": "^20.17.22",
|
|
86
92
|
"ai": "^6.0.90",
|
|
87
93
|
"openai": "^6.10.0",
|
|
88
94
|
"openapi-typescript": "^7.6.1",
|
|
89
95
|
"tsx": "^4.19.3",
|
|
90
|
-
"vitest": "^4.0
|
|
91
|
-
"@arizeai/phoenix-evals": "1.0.
|
|
96
|
+
"vitest": "^4.1.0",
|
|
97
|
+
"@arizeai/phoenix-evals": "1.0.2"
|
|
92
98
|
},
|
|
93
99
|
"optionalDependencies": {
|
|
94
100
|
"@anthropic-ai/sdk": "^0.35.0",
|