@arizeai/phoenix-client 7.0.1 → 7.1.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/docs/overview.mdx CHANGED
@@ -61,7 +61,7 @@ export PHOENIX_HOST=http://localhost:6006
61
61
  export PHOENIX_API_KEY=<your-api-key>
62
62
  ```
63
63
 
64
- If you're using Phoenix Cloud, `PHOENIX_HOST` may look like `https://app.phoenix.arize.com/s/my-space`.
64
+ For a remote deployment, `PHOENIX_HOST` is that instance's base URL, e.g. `https://your-phoenix.example.com`.
65
65
 
66
66
  ```ts
67
67
  import { createClient } from "@arizeai/phoenix-client";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/phoenix-client",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "A client for the Phoenix API",
5
5
  "keywords": [
6
6
  "arize",
@@ -118,8 +118,8 @@
118
118
  "openapi-typescript": "^7.13.0",
119
119
  "tsx": "^4.23.1",
120
120
  "vitest": "^4.1.10",
121
- "@arizeai/phoenix-evals": "2.1.0",
122
- "@arizeai/phoenix-testing": "0.0.0"
121
+ "@arizeai/phoenix-testing": "0.0.0",
122
+ "@arizeai/phoenix-evals": "2.1.0"
123
123
  },
124
124
  "peerDependencies": {
125
125
  "@anthropic-ai/sdk": "^0.35.0",
@@ -8636,6 +8636,8 @@ export interface operations {
8636
8636
  end_time?: string | null;
8637
8637
  /** @description Filter by one or more trace IDs */
8638
8638
  trace_id?: string[] | null;
8639
+ /** @description Filter by one or more span IDs */
8640
+ span_id?: string[] | null;
8639
8641
  /** @description Filter by parent span ID. Use "null" to get root spans only. */
8640
8642
  parent_id?: string | null;
8641
8643
  /** @description Filter by span name(s) */
@@ -8705,6 +8707,8 @@ export interface operations {
8705
8707
  end_time?: string | null;
8706
8708
  /** @description Filter by one or more trace IDs */
8707
8709
  trace_id?: string[] | null;
8710
+ /** @description Filter by one or more span IDs */
8711
+ span_id?: string[] | null;
8708
8712
  /** @description Filter by parent span ID. Use "null" to get root spans only. */
8709
8713
  parent_id?: string | null;
8710
8714
  /** @description Filter by span name(s) */
@@ -75,6 +75,14 @@ export const GET_SPANS_TRACE_IDS: ParameterRequirement = {
75
75
  minServerVersion: [13, 9, 0],
76
76
  };
77
77
 
78
+ export const GET_SPANS_SPAN_IDS: ParameterRequirement = {
79
+ kind: "parameter",
80
+ parameterName: "span_id",
81
+ parameterLocation: "query",
82
+ route: "GET /v1/projects/{id}/spans",
83
+ minServerVersion: [19, 6, 0],
84
+ };
85
+
78
86
  export const GET_SPANS_FILTERS: ParameterRequirement = {
79
87
  kind: "parameter",
80
88
  parameterName: "span_kind",
@@ -145,6 +153,7 @@ export const ALL_REQUIREMENTS: readonly CapabilityRequirement[] = [
145
153
  ADD_TRACE_NOTE,
146
154
  ADD_SESSION_NOTE,
147
155
  GET_SPANS_TRACE_IDS,
156
+ GET_SPANS_SPAN_IDS,
148
157
  GET_SPANS_FILTERS,
149
158
  GET_SPANS_BY_ATTRIBUTE,
150
159
  LIST_PROJECT_TRACES,
@@ -3,6 +3,7 @@ import { createClient } from "../client";
3
3
  import {
4
4
  GET_SPANS_BY_ATTRIBUTE,
5
5
  GET_SPANS_FILTERS,
6
+ GET_SPANS_SPAN_IDS,
6
7
  GET_SPANS_TRACE_IDS,
7
8
  } from "../constants/serverRequirements";
8
9
  import type { ClientFn } from "../types/core";
@@ -59,6 +60,8 @@ export interface GetSpansParams extends ClientFn {
59
60
  limit?: number;
60
61
  /** Filter spans by one or more trace IDs */
61
62
  traceIds?: string[] | null;
63
+ /** Filter spans by one or more span IDs */
64
+ spanIds?: string[] | null;
62
65
  /** Filter by parent span ID. Use `null` or the string `"null"` to get root spans only. */
63
66
  parentId?: string | null;
64
67
  /** Filter by span name(s) */
@@ -96,6 +99,7 @@ export type GetSpansResult = {
96
99
  * @returns A paginated response containing spans and optional next cursor
97
100
  *
98
101
  * @requires Phoenix server >= 13.9.0 when filtering by `traceIds`
102
+ * @requires Phoenix server >= 19.6.0 when filtering by `spanIds`
99
103
  * @requires Phoenix server >= 14.9.0 when filtering by `attributes`
100
104
  *
101
105
  * @example
@@ -125,6 +129,13 @@ export type GetSpansResult = {
125
129
  * traceIds: ["trace-abc-123", "trace-def-456"],
126
130
  * });
127
131
  *
132
+ * // Get specific spans by span ID (requires Phoenix server >= 19.6.0)
133
+ * const result = await getSpans({
134
+ * client,
135
+ * project: { projectName: "my-project" },
136
+ * spanIds: ["span-abc-123", "span-def-456"],
137
+ * });
138
+ *
128
139
  * // Paginate through results
129
140
  * let cursor: string | undefined;
130
141
  * do {
@@ -152,6 +163,7 @@ export async function getSpans({
152
163
  startTime,
153
164
  endTime,
154
165
  traceIds,
166
+ spanIds,
155
167
  parentId,
156
168
  name,
157
169
  spanKind,
@@ -168,6 +180,9 @@ export async function getSpans({
168
180
  if (traceIds) {
169
181
  await ensureServerCapability({ client, requirement: GET_SPANS_TRACE_IDS });
170
182
  }
183
+ if (spanIds) {
184
+ await ensureServerCapability({ client, requirement: GET_SPANS_SPAN_IDS });
185
+ }
171
186
  if (name != null || spanKind != null || statusCode != null) {
172
187
  await ensureServerCapability({ client, requirement: GET_SPANS_FILTERS });
173
188
  }
@@ -200,6 +215,10 @@ export async function getSpans({
200
215
  params.trace_id = traceIds;
201
216
  }
202
217
 
218
+ if (spanIds) {
219
+ params.span_id = spanIds;
220
+ }
221
+
203
222
  if (parentId !== undefined) {
204
223
  params.parent_id = parentId === null ? "null" : parentId;
205
224
  }