@arizeai/phoenix-client 7.8.0 → 7.10.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +21 -11
  3. package/dist/esm/__generated__/api/v1.d.ts +48 -5
  4. package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
  5. package/dist/esm/constants/serverRequirements.d.ts +1 -0
  6. package/dist/esm/constants/serverRequirements.d.ts.map +1 -1
  7. package/dist/esm/constants/serverRequirements.js +9 -0
  8. package/dist/esm/constants/serverRequirements.js.map +1 -1
  9. package/dist/esm/prompts/constants.d.ts.map +1 -1
  10. package/dist/esm/prompts/constants.js +2 -0
  11. package/dist/esm/prompts/constants.js.map +1 -1
  12. package/dist/esm/prompts/sdks/toOpenAI.d.ts.map +1 -1
  13. package/dist/esm/prompts/sdks/toOpenAI.js +2 -0
  14. package/dist/esm/prompts/sdks/toOpenAI.js.map +1 -1
  15. package/dist/esm/traces/getTraces.d.ts +29 -1
  16. package/dist/esm/traces/getTraces.d.ts.map +1 -1
  17. package/dist/esm/traces/getTraces.js +78 -30
  18. package/dist/esm/traces/getTraces.js.map +1 -1
  19. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  20. package/dist/esm/types/prompts.d.ts +1 -1
  21. package/dist/esm/types/prompts.d.ts.map +1 -1
  22. package/dist/esm/types/prompts.js.map +1 -1
  23. package/dist/esm/utils/getPromptBySelector.d.ts +1 -1
  24. package/dist/src/__generated__/api/v1.d.ts +48 -5
  25. package/dist/src/__generated__/api/v1.d.ts.map +1 -1
  26. package/dist/src/constants/serverRequirements.d.ts +1 -0
  27. package/dist/src/constants/serverRequirements.d.ts.map +1 -1
  28. package/dist/src/constants/serverRequirements.js +10 -1
  29. package/dist/src/constants/serverRequirements.js.map +1 -1
  30. package/dist/src/prompts/constants.d.ts.map +1 -1
  31. package/dist/src/prompts/constants.js +2 -0
  32. package/dist/src/prompts/constants.js.map +1 -1
  33. package/dist/src/prompts/sdks/toOpenAI.d.ts.map +1 -1
  34. package/dist/src/prompts/sdks/toOpenAI.js +2 -0
  35. package/dist/src/prompts/sdks/toOpenAI.js.map +1 -1
  36. package/dist/src/traces/getTraces.d.ts +29 -1
  37. package/dist/src/traces/getTraces.d.ts.map +1 -1
  38. package/dist/src/traces/getTraces.js +92 -32
  39. package/dist/src/traces/getTraces.js.map +1 -1
  40. package/dist/src/types/prompts.d.ts +1 -1
  41. package/dist/src/types/prompts.d.ts.map +1 -1
  42. package/dist/src/types/prompts.js.map +1 -1
  43. package/dist/src/utils/getPromptBySelector.d.ts +1 -1
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/docs/traces.mdx +14 -1
  46. package/package.json +2 -2
  47. package/src/__generated__/api/v1.ts +48 -5
  48. package/src/constants/serverRequirements.ts +11 -0
  49. package/src/prompts/constants.ts +2 -0
  50. package/src/prompts/sdks/toOpenAI.ts +2 -0
  51. package/src/traces/getTraces.ts +126 -47
  52. package/src/types/prompts.ts +3 -1
package/docs/traces.mdx CHANGED
@@ -29,7 +29,7 @@ The traces module provides trace retrieval, project transfer, and trace-level an
29
29
 
30
30
  ## Retrieve Traces
31
31
 
32
- Use `getTraces` when you want trace-centric pagination by project, optional inline spans, or filtering by session.
32
+ Use `getTraces` when you want trace-centric pagination by project, optional inline spans, or filtering by session, error status, or latency.
33
33
 
34
34
  ```ts
35
35
  import { getTraces } from "@arizeai/phoenix-client/traces";
@@ -60,6 +60,18 @@ console.log(result.nextCursor);
60
60
  - `cursor`
61
61
  - `includeSpans`
62
62
  - `sessionId`
63
+ - `error`
64
+ - `minLatencyMs`
65
+ - `maxLatencyMs`
66
+
67
+ ```ts
68
+ // Slow traces that contain at least one errored span
69
+ const slowFailures = await getTraces({
70
+ project: { projectName: "support-bot" },
71
+ error: true,
72
+ minLatencyMs: 1000,
73
+ });
74
+ ```
63
75
 
64
76
  ### Notes
65
77
 
@@ -67,6 +79,7 @@ console.log(result.nextCursor);
67
79
  - Use the returned `nextCursor` to continue pagination
68
80
  - Set `includeSpans` when you need a trace-centric fetch that also contains span details
69
81
  - `project` accepts `{ project }`, `{ projectId }`, or `{ projectName }`
82
+ - `error`, `minLatencyMs`, and `maxLatencyMs` require Phoenix server >= 20.8.0; `error: false` selects traces with no errored spans
70
83
 
71
84
  ## Move Traces To Another Project
72
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/phoenix-client",
3
- "version": "7.8.0",
3
+ "version": "7.10.0",
4
4
  "description": "A client for the Phoenix API",
5
5
  "keywords": [
6
6
  "arize",
@@ -127,7 +127,7 @@
127
127
  "openai": "^6.49.0",
128
128
  "openapi-typescript": "^7.13.0",
129
129
  "tsx": "^4.23.12",
130
- "vitest": "^4.1.11"
130
+ "vitest": "^5.0.0"
131
131
  },
132
132
  "peerDependencies": {
133
133
  "@anthropic-ai/sdk": "^0.35.0",
@@ -1572,7 +1572,7 @@ export interface paths {
1572
1572
  put?: never;
1573
1573
  /**
1574
1574
  * OpenAI-compatible chat completions
1575
- * @description Creates a chat completion using the OpenAI wire format, proxying to the selected provider with credentials resolved on the server (secret store first, environment second) — callers never handle provider API keys. Model must be '{provider}:{model_name}' for a built-in provider (one of anthropic, aws, azure_openai, cerebras, deepseek, fireworks, google, groq, moonshot, ollama, openai, perplexity, together, xai, zai) or 'custom:{provider_id}:{model_name}' for a stored custom provider, e.g. 'openai:gpt-4o' or 'anthropic:claude-sonnet-4-5'. Set `stream: true` for server-sent events of `chat.completion.chunk` payloads terminated by `data: [DONE]`. Tool calling is not supported.
1575
+ * @description Creates a chat completion using the OpenAI wire format, proxying to the selected provider with credentials resolved on the server (secret store first, environment second) — callers never handle provider API keys. Model must be '{provider}:{model_name}' for a built-in provider (one of anthropic, aws, azure_openai, cerebras, deepseek, fireworks, google, groq, meta, minimax, moonshot, ollama, openai, perplexity, together, xai, zai) or 'custom:{provider_id}:{model_name}' for a stored custom provider, e.g. 'openai:gpt-4o' or 'anthropic:claude-sonnet-4-5'. Set `stream: true` for server-sent events of `chat.completion.chunk` payloads terminated by `data: [DONE]`. Tool calling is not supported.
1576
1576
  *
1577
1577
  * **Phoenix is not an AI gateway.** The same server also takes on trace ingestion traffic, so routing production LLM calls through it competes with ingestion. Use this endpoint only to quickly try out different models in non-production environments.
1578
1578
  */
@@ -2592,7 +2592,7 @@ export interface components {
2592
2592
  CreateChatCompletionRequestBody: {
2593
2593
  /**
2594
2594
  * Model
2595
- * @description Model must be '{provider}:{model_name}' for a built-in provider (one of anthropic, aws, azure_openai, cerebras, deepseek, fireworks, google, groq, moonshot, ollama, openai, perplexity, together, xai, zai) or 'custom:{provider_id}:{model_name}' for a stored custom provider, e.g. 'openai:gpt-4o' or 'anthropic:claude-sonnet-4-5'.
2595
+ * @description Model must be '{provider}:{model_name}' for a built-in provider (one of anthropic, aws, azure_openai, cerebras, deepseek, fireworks, google, groq, meta, minimax, moonshot, ollama, openai, perplexity, together, xai, zai) or 'custom:{provider_id}:{model_name}' for a stored custom provider, e.g. 'openai:gpt-4o' or 'anthropic:claude-sonnet-4-5'.
2596
2596
  */
2597
2597
  model: string;
2598
2598
  /** Messages */
@@ -4088,7 +4088,7 @@ export interface components {
4088
4088
  * ModelProvider
4089
4089
  * @enum {string}
4090
4090
  */
4091
- ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE" | "DEEPSEEK" | "XAI" | "OLLAMA" | "AWS" | "CEREBRAS" | "FIREWORKS" | "GROQ" | "MOONSHOT" | "PERPLEXITY" | "TOGETHER" | "ZAI";
4091
+ ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE" | "DEEPSEEK" | "XAI" | "OLLAMA" | "AWS" | "CEREBRAS" | "FIREWORKS" | "GROQ" | "MOONSHOT" | "MINIMAX" | "PERPLEXITY" | "TOGETHER" | "ZAI" | "META";
4092
4092
  /** OAuth2User */
4093
4093
  OAuth2User: {
4094
4094
  /** Id */
@@ -4936,6 +4936,43 @@ export interface components {
4936
4936
  /** Content */
4937
4937
  content: string | (components["schemas"]["TextContentPart"] | components["schemas"]["ToolCallContentPart"] | components["schemas"]["ToolResultContentPart"])[];
4938
4938
  };
4939
+ /** PromptMetaInvocationParameters */
4940
+ PromptMetaInvocationParameters: {
4941
+ /**
4942
+ * @description discriminator enum property added by openapi-typescript
4943
+ * @enum {string}
4944
+ */
4945
+ type: "meta";
4946
+ meta: components["schemas"]["PromptMetaInvocationParametersContent"];
4947
+ };
4948
+ /** PromptMetaInvocationParametersContent */
4949
+ PromptMetaInvocationParametersContent: {
4950
+ /** Temperature */
4951
+ temperature?: number;
4952
+ /** Max Tokens */
4953
+ max_tokens?: number;
4954
+ /** Max Completion Tokens */
4955
+ max_completion_tokens?: number;
4956
+ /** Frequency Penalty */
4957
+ frequency_penalty?: number;
4958
+ /** Presence Penalty */
4959
+ presence_penalty?: number;
4960
+ /** Top P */
4961
+ top_p?: number;
4962
+ /** Seed */
4963
+ seed?: number;
4964
+ /** Stop */
4965
+ stop?: string[];
4966
+ /**
4967
+ * Reasoning Effort
4968
+ * @enum {string}
4969
+ */
4970
+ reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
4971
+ /** Extra Body */
4972
+ extra_body?: {
4973
+ [key: string]: unknown;
4974
+ };
4975
+ };
4939
4976
  /** PromptMoonshotInvocationParameters */
4940
4977
  PromptMoonshotInvocationParameters: {
4941
4978
  /**
@@ -5267,7 +5304,7 @@ export interface components {
5267
5304
  template_type: components["schemas"]["PromptTemplateType"];
5268
5305
  template_format: components["schemas"]["PromptTemplateFormat"];
5269
5306
  /** Invocation Parameters */
5270
- invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"] | components["schemas"]["PromptPerplexityInvocationParameters"] | components["schemas"]["PromptTogetherInvocationParameters"] | components["schemas"]["PromptZAIInvocationParameters"];
5307
+ invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"] | components["schemas"]["PromptPerplexityInvocationParameters"] | components["schemas"]["PromptTogetherInvocationParameters"] | components["schemas"]["PromptZAIInvocationParameters"] | components["schemas"]["PromptMetaInvocationParameters"];
5271
5308
  tools?: components["schemas"]["PromptTools"] | null;
5272
5309
  /** Response Format */
5273
5310
  response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
@@ -5286,7 +5323,7 @@ export interface components {
5286
5323
  template_type: components["schemas"]["PromptTemplateType"];
5287
5324
  template_format: components["schemas"]["PromptTemplateFormat"];
5288
5325
  /** Invocation Parameters */
5289
- invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"] | components["schemas"]["PromptPerplexityInvocationParameters"] | components["schemas"]["PromptTogetherInvocationParameters"] | components["schemas"]["PromptZAIInvocationParameters"];
5326
+ invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"] | components["schemas"]["PromptPerplexityInvocationParameters"] | components["schemas"]["PromptTogetherInvocationParameters"] | components["schemas"]["PromptZAIInvocationParameters"] | components["schemas"]["PromptMetaInvocationParameters"];
5290
5327
  tools?: components["schemas"]["PromptTools"] | null;
5291
5328
  /** Response Format */
5292
5329
  response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
@@ -10061,6 +10098,12 @@ export interface operations {
10061
10098
  include_spans?: boolean;
10062
10099
  /** @description List of session identifiers to filter traces by. Each value can be either a session_id string or a session GlobalID. Only traces belonging to the specified sessions will be returned. */
10063
10100
  session_identifier?: string[] | null;
10101
+ /** @description Filter by trace error status. If true, only return traces that contain at least one span with `status_code == ERROR`. If false, only return traces with no errored spans. If omitted, traces are not filtered by error status. Matches the error indicator shown in the UI. */
10102
+ error?: boolean | null;
10103
+ /** @description Inclusive lower bound on trace latency in milliseconds. */
10104
+ min_latency_ms?: number | null;
10105
+ /** @description Inclusive upper bound on trace latency in milliseconds. */
10106
+ max_latency_ms?: number | null;
10064
10107
  };
10065
10108
  header?: never;
10066
10109
  path: {
@@ -98,6 +98,16 @@ export const LIST_PROJECT_TRACES: RouteRequirement = {
98
98
  minServerVersion: [13, 15, 0],
99
99
  };
100
100
 
101
+ export const GET_TRACES_FILTERS: ParameterRequirement = {
102
+ kind: "parameter",
103
+ parameterName: "error",
104
+ parameterLocation: "query",
105
+ route: "GET /v1/projects/{id}/traces",
106
+ minServerVersion: [20, 8, 0],
107
+ description:
108
+ "The 'error', 'min_latency_ms', and 'max_latency_ms' query parameters on GET /v1/projects/{id}/traces",
109
+ };
110
+
101
111
  export const TRANSFER_TRACES: RouteRequirement = {
102
112
  kind: "route",
103
113
  method: "POST",
@@ -234,6 +244,7 @@ export const ALL_REQUIREMENTS: readonly CapabilityRequirement[] = [
234
244
  GET_SPANS_FILTERS,
235
245
  GET_SPANS_BY_ATTRIBUTE,
236
246
  LIST_PROJECT_TRACES,
247
+ GET_TRACES_FILTERS,
237
248
  TRANSFER_TRACES,
238
249
  DATASET_UPLOAD_EXAMPLE_IDS,
239
250
  ADD_TRACE_NOTE_IDENTIFIER,
@@ -16,6 +16,8 @@ export const PromptModelProviders: Record<PromptModelProvider, string> = {
16
16
  FIREWORKS: "Fireworks",
17
17
  GROQ: "Groq",
18
18
  MOONSHOT: "Moonshot",
19
+ MINIMAX: "MiniMax",
19
20
  PERPLEXITY: "Perplexity",
20
21
  ZAI: "Z.ai",
22
+ META: "Meta",
21
23
  };
@@ -57,6 +57,8 @@ function getInvocationParameters(
57
57
  return parameters.together;
58
58
  case "zai":
59
59
  return parameters.zai;
60
+ case "meta":
61
+ return parameters.meta;
60
62
  default:
61
63
  // eslint-disable-next-line no-console
62
64
  console.warn(
@@ -1,6 +1,9 @@
1
1
  import type { operations } from "../__generated__/api/v1";
2
2
  import { createClient } from "../client";
3
- import { LIST_PROJECT_TRACES } from "../constants/serverRequirements";
3
+ import {
4
+ GET_TRACES_FILTERS,
5
+ LIST_PROJECT_TRACES,
6
+ } from "../constants/serverRequirements";
4
7
  import type { ClientFn } from "../types/core";
5
8
  import type { ProjectIdentifier } from "../types/projects";
6
9
  import { resolveProjectIdentifier } from "../types/projects";
@@ -28,6 +31,112 @@ export interface GetTracesParams extends ClientFn {
28
31
  includeSpans?: boolean;
29
32
  /** Filter traces by session identifier(s) (session_id strings or GlobalIDs) */
30
33
  sessionId?: string | string[] | null;
34
+ /**
35
+ * Filter by trace error status. `true` returns only traces containing at
36
+ * least one errored span, `false` only traces with no errored spans.
37
+ * Omit to leave traces unfiltered by error status.
38
+ *
39
+ * @requires Phoenix server >= 20.8.0
40
+ */
41
+ error?: boolean | null;
42
+ /**
43
+ * Inclusive lower bound on trace latency in milliseconds.
44
+ *
45
+ * @requires Phoenix server >= 20.8.0
46
+ */
47
+ minLatencyMs?: number | null;
48
+ /**
49
+ * Inclusive upper bound on trace latency in milliseconds.
50
+ *
51
+ * @requires Phoenix server >= 20.8.0
52
+ */
53
+ maxLatencyMs?: number | null;
54
+ }
55
+
56
+ /**
57
+ * Reject latency bounds the server would reject (negatives) or that can never
58
+ * match a trace (an inverted range), so callers get a clear error instead of a
59
+ * 422 or a silently empty page.
60
+ */
61
+ function validateLatencyBounds({
62
+ minLatencyMs,
63
+ maxLatencyMs,
64
+ }: Pick<GetTracesParams, "minLatencyMs" | "maxLatencyMs">): void {
65
+ if (minLatencyMs != null && minLatencyMs < 0) {
66
+ throw new Error(`minLatencyMs must be non-negative, got ${minLatencyMs}`);
67
+ }
68
+ if (maxLatencyMs != null && maxLatencyMs < 0) {
69
+ throw new Error(`maxLatencyMs must be non-negative, got ${maxLatencyMs}`);
70
+ }
71
+ if (
72
+ minLatencyMs != null &&
73
+ maxLatencyMs != null &&
74
+ minLatencyMs > maxLatencyMs
75
+ ) {
76
+ throw new Error(
77
+ `minLatencyMs (${minLatencyMs}) must not exceed maxLatencyMs (${maxLatencyMs})`
78
+ );
79
+ }
80
+ }
81
+
82
+ type ListProjectTracesQuery = NonNullable<
83
+ operations["listProjectTraces"]["parameters"]["query"]
84
+ >;
85
+
86
+ /**
87
+ * Translate the camelCase parameters into the endpoint's snake_case query,
88
+ * omitting anything the caller left unset so the server applies its defaults.
89
+ */
90
+ function buildQuery({
91
+ cursor,
92
+ limit = 100,
93
+ startTime,
94
+ endTime,
95
+ sort,
96
+ order,
97
+ includeSpans,
98
+ sessionId,
99
+ error,
100
+ minLatencyMs,
101
+ maxLatencyMs,
102
+ }: Omit<GetTracesParams, "client" | "project">): ListProjectTracesQuery {
103
+ const query: ListProjectTracesQuery = { limit };
104
+ if (cursor) {
105
+ query.cursor = cursor;
106
+ }
107
+ if (startTime) {
108
+ query.start_time =
109
+ startTime instanceof Date ? startTime.toISOString() : startTime;
110
+ }
111
+ if (endTime) {
112
+ query.end_time = endTime instanceof Date ? endTime.toISOString() : endTime;
113
+ }
114
+ if (sort) {
115
+ query.sort = sort;
116
+ }
117
+ if (order) {
118
+ query.order = order;
119
+ }
120
+ if (includeSpans) {
121
+ query.include_spans = true;
122
+ }
123
+ if (sessionId) {
124
+ query.session_identifier = Array.isArray(sessionId)
125
+ ? sessionId
126
+ : [sessionId];
127
+ }
128
+ // `error: false` is a meaningful filter (traces with no errored spans), so
129
+ // send the parameter whenever it was set rather than only when truthy.
130
+ if (error != null) {
131
+ query.error = error;
132
+ }
133
+ if (minLatencyMs != null) {
134
+ query.min_latency_ms = minLatencyMs;
135
+ }
136
+ if (maxLatencyMs != null) {
137
+ query.max_latency_ms = maxLatencyMs;
138
+ }
139
+ return query;
31
140
  }
32
141
 
33
142
  export type GetTracesResponse =
@@ -81,60 +190,30 @@ export type GetTracesResult = {
81
190
  * });
82
191
  * cursor = result.nextCursor || undefined;
83
192
  * } while (cursor);
193
+ *
194
+ * // Only slow traces that errored
195
+ * const slowFailures = await getTraces({
196
+ * client,
197
+ * project: { projectName: "my-project" },
198
+ * error: true,
199
+ * minLatencyMs: 1000,
200
+ * });
84
201
  * ```
85
202
  */
86
203
  export async function getTraces({
87
204
  client: _client,
88
205
  project,
89
- cursor,
90
- limit = 100,
91
- startTime,
92
- endTime,
93
- sort,
94
- order,
95
- includeSpans,
96
- sessionId,
206
+ ...params
97
207
  }: GetTracesParams): Promise<GetTracesResult> {
208
+ const { error: errorFilter, minLatencyMs, maxLatencyMs } = params;
98
209
  const client = _client ?? createClient();
210
+ validateLatencyBounds({ minLatencyMs, maxLatencyMs });
99
211
  await ensureServerCapability({ client, requirement: LIST_PROJECT_TRACES });
100
- const projectIdentifier = resolveProjectIdentifier(project);
101
-
102
- const params: NonNullable<
103
- operations["listProjectTraces"]["parameters"]["query"]
104
- > = {
105
- limit,
106
- };
107
-
108
- if (cursor) {
109
- params.cursor = cursor;
110
- }
111
-
112
- if (startTime) {
113
- params.start_time =
114
- startTime instanceof Date ? startTime.toISOString() : startTime;
115
- }
116
-
117
- if (endTime) {
118
- params.end_time = endTime instanceof Date ? endTime.toISOString() : endTime;
119
- }
120
-
121
- if (sort) {
122
- params.sort = sort;
123
- }
124
-
125
- if (order) {
126
- params.order = order;
127
- }
128
-
129
- if (includeSpans) {
130
- params.include_spans = true;
131
- }
132
-
133
- if (sessionId) {
134
- params.session_identifier = Array.isArray(sessionId)
135
- ? sessionId
136
- : [sessionId];
212
+ if (errorFilter != null || minLatencyMs != null || maxLatencyMs != null) {
213
+ await ensureServerCapability({ client, requirement: GET_TRACES_FILTERS });
137
214
  }
215
+ const projectIdentifier = resolveProjectIdentifier(project);
216
+ const query = buildQuery(params);
138
217
 
139
218
  const { data, error } = await client.GET(
140
219
  "/v1/projects/{project_identifier}/traces",
@@ -143,7 +222,7 @@ export async function getTraces({
143
222
  path: {
144
223
  project_identifier: projectIdentifier,
145
224
  },
146
- query: params,
225
+ query,
147
226
  },
148
227
  }
149
228
  );
@@ -16,8 +16,10 @@ export type PromptModelProvider =
16
16
  | "FIREWORKS"
17
17
  | "GROQ"
18
18
  | "MOONSHOT"
19
+ | "MINIMAX"
19
20
  | "PERPLEXITY"
20
- | "ZAI";
21
+ | "ZAI"
22
+ | "META";
21
23
 
22
24
  /**
23
25
  * Supported prompt provider SDKs