@arizeai/phoenix-client 2.0.1 → 2.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.
Files changed (37) hide show
  1. package/dist/esm/__generated__/api/v1.d.ts +331 -3
  2. package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
  3. package/dist/esm/prompts/createPrompt.d.ts +5 -1
  4. package/dist/esm/prompts/createPrompt.d.ts.map +1 -1
  5. package/dist/esm/prompts/createPrompt.js +16 -0
  6. package/dist/esm/prompts/createPrompt.js.map +1 -1
  7. package/dist/esm/schemas/llm/anthropic/converters.d.ts +21 -21
  8. package/dist/esm/schemas/llm/constants.d.ts +294 -294
  9. package/dist/esm/schemas/llm/converters.d.ts +1176 -1176
  10. package/dist/esm/schemas/llm/openai/converters.d.ts +168 -168
  11. package/dist/esm/schemas/llm/openai/toolSchemas.d.ts +63 -63
  12. package/dist/esm/schemas/llm/phoenixPrompt/converters.d.ts +21 -21
  13. package/dist/esm/schemas/llm/schemas.d.ts +63 -63
  14. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  15. package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
  16. package/dist/esm/utils/getPromptBySelector.d.ts +1 -1
  17. package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
  18. package/dist/src/__generated__/api/v1.d.ts +331 -3
  19. package/dist/src/__generated__/api/v1.d.ts.map +1 -1
  20. package/dist/src/prompts/createPrompt.d.ts +5 -1
  21. package/dist/src/prompts/createPrompt.d.ts.map +1 -1
  22. package/dist/src/prompts/createPrompt.js +16 -0
  23. package/dist/src/prompts/createPrompt.js.map +1 -1
  24. package/dist/src/schemas/llm/anthropic/converters.d.ts +21 -21
  25. package/dist/src/schemas/llm/constants.d.ts +294 -294
  26. package/dist/src/schemas/llm/converters.d.ts +1176 -1176
  27. package/dist/src/schemas/llm/openai/converters.d.ts +168 -168
  28. package/dist/src/schemas/llm/openai/toolSchemas.d.ts +63 -63
  29. package/dist/src/schemas/llm/phoenixPrompt/converters.d.ts +21 -21
  30. package/dist/src/schemas/llm/schemas.d.ts +63 -63
  31. package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
  32. package/dist/src/utils/getPromptBySelector.d.ts +1 -1
  33. package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/src/__generated__/api/v1.ts +331 -3
  37. package/src/prompts/createPrompt.ts +23 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/phoenix-client",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "A client for the Phoenix API",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -318,6 +318,26 @@ export interface paths {
318
318
  patch?: never;
319
319
  trace?: never;
320
320
  };
321
+ "/v1/projects/{project_identifier}/spans/otlpv1": {
322
+ parameters: {
323
+ query?: never;
324
+ header?: never;
325
+ path?: never;
326
+ cookie?: never;
327
+ };
328
+ /**
329
+ * Search spans with simple filters (no DSL)
330
+ * @description Return spans within a project filtered by time range, annotation names, and ordered by start_time. Supports cursor-based pagination.
331
+ */
332
+ get: operations["spanSearch"];
333
+ put?: never;
334
+ post?: never;
335
+ delete?: never;
336
+ options?: never;
337
+ head?: never;
338
+ patch?: never;
339
+ trace?: never;
340
+ };
321
341
  "/v1/span_annotations": {
322
342
  parameters: {
323
343
  query?: never;
@@ -1083,12 +1103,205 @@ export interface components {
1083
1103
  * ModelProvider
1084
1104
  * @enum {string}
1085
1105
  */
1086
- ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE";
1106
+ ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE" | "DEEPSEEK";
1087
1107
  /**
1088
1108
  * OptimizationDirection
1089
1109
  * @enum {string}
1090
1110
  */
1091
1111
  OptimizationDirection: "MINIMIZE" | "MAXIMIZE" | "NONE";
1112
+ /** OtlpAnyValue */
1113
+ OtlpAnyValue: {
1114
+ array_value?: components["schemas"]["OtlpArrayValue"] | null;
1115
+ /** Bool Value */
1116
+ bool_value?: boolean | null;
1117
+ /** Bytes Value */
1118
+ bytes_value?: string | null;
1119
+ /** Double Value */
1120
+ double_value?: number | components["schemas"]["OtlpDoubleValue"] | string | null;
1121
+ /** Int Value */
1122
+ int_value?: number | string | null;
1123
+ /** Kvlist Value */
1124
+ kvlist_value?: null;
1125
+ /** String Value */
1126
+ string_value?: string | null;
1127
+ };
1128
+ /** OtlpArrayValue */
1129
+ OtlpArrayValue: {
1130
+ /**
1131
+ * Values
1132
+ * @description Array of values. The array may be empty (contain 0 elements).
1133
+ */
1134
+ values?: components["schemas"]["OtlpAnyValue"][] | null;
1135
+ };
1136
+ /**
1137
+ * OtlpDoubleValue
1138
+ * @enum {string}
1139
+ */
1140
+ OtlpDoubleValue: "Infinity" | "-Infinity" | "NaN";
1141
+ /** OtlpEvent */
1142
+ OtlpEvent: {
1143
+ /**
1144
+ * Attributes
1145
+ * @description attributes is a collection of attribute key/value pairs on the event. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key).
1146
+ */
1147
+ attributes?: components["schemas"]["OtlpKeyValue"][] | null;
1148
+ /**
1149
+ * Dropped Attributes Count
1150
+ * @description dropped_attributes_count is the number of dropped attributes. If the value is 0, then no attributes were dropped.
1151
+ */
1152
+ dropped_attributes_count?: number | null;
1153
+ /**
1154
+ * Name
1155
+ * @description name of the event. This field is semantically required to be set to non-empty string.
1156
+ */
1157
+ name?: string | null;
1158
+ /**
1159
+ * Time Unix Nano
1160
+ * @description time_unix_nano is the time the event occurred. Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
1161
+ */
1162
+ time_unix_nano?: number | string | null;
1163
+ };
1164
+ /** OtlpKeyValue */
1165
+ OtlpKeyValue: {
1166
+ /** Key */
1167
+ key?: string | null;
1168
+ value?: components["schemas"]["OtlpAnyValue"] | null;
1169
+ };
1170
+ /**
1171
+ * OtlpKind
1172
+ * @enum {string}
1173
+ */
1174
+ OtlpKind: "SPAN_KIND_UNSPECIFIED" | "SPAN_KIND_INTERNAL" | "SPAN_KIND_SERVER" | "SPAN_KIND_CLIENT" | "SPAN_KIND_PRODUCER" | "SPAN_KIND_CONSUMER";
1175
+ /** OtlpSpan */
1176
+ OtlpSpan: {
1177
+ /**
1178
+ * Attributes
1179
+ * @description attributes is a collection of key/value pairs. Note, global attributes like server name can be set using the resource API. Examples of attributes:
1180
+ *
1181
+ * "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
1182
+ * "/http/server_latency": 300
1183
+ * "example.com/myattribute": true
1184
+ * "example.com/score": 10.239
1185
+ *
1186
+ * The OpenTelemetry API specification further restricts the allowed value types:
1187
+ * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute
1188
+ * Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key).
1189
+ */
1190
+ attributes?: components["schemas"]["OtlpKeyValue"][] | null;
1191
+ /**
1192
+ * Dropped Attributes Count
1193
+ * @description dropped_attributes_count is the number of attributes that were discarded. Attributes can be discarded because their keys are too long or because there are too many attributes. If this value is 0, then no attributes were dropped.
1194
+ */
1195
+ dropped_attributes_count?: number | null;
1196
+ /**
1197
+ * Dropped Events Count
1198
+ * @description dropped_events_count is the number of dropped events. If the value is 0, then no events were dropped.
1199
+ */
1200
+ dropped_events_count?: number | null;
1201
+ /**
1202
+ * Dropped Links Count
1203
+ * @description dropped_links_count is the number of dropped links after the maximum size was enforced. If this value is 0, then no links were dropped.
1204
+ */
1205
+ dropped_links_count?: number | null;
1206
+ /**
1207
+ * End Time Unix Nano
1208
+ * @description end_time_unix_nano is the end time of the span. On the client side, this is the time kept by the local machine where the span execution ends. On the server side, this is the time when the server application handler stops running.
1209
+ * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
1210
+ *
1211
+ * This field is semantically required and it is expected that end_time >= start_time.
1212
+ */
1213
+ end_time_unix_nano?: number | string | null;
1214
+ /**
1215
+ * Events
1216
+ * @description events is a collection of Event items. A span with no events is valid.
1217
+ */
1218
+ events?: components["schemas"]["OtlpEvent"][] | null;
1219
+ /**
1220
+ * Flags
1221
+ * @description Flags, a bit field.
1222
+ *
1223
+ * Bits 0-7 (8 least significant bits) are the trace flags as defined in W3C Trace Context specification. To read the 8-bit W3C trace flag, use `flags & SPAN_FLAGS_TRACE_FLAGS_MASK`.
1224
+ *
1225
+ * See https://www.w3.org/TR/trace-context-2/#trace-flags for the flag definitions.
1226
+ *
1227
+ * Bits 8 and 9 represent the 3 states of whether a span's parent is remote. The states are (unknown, is not remote, is remote).
1228
+ * To read whether the value is known, use `(flags & SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) != 0`.
1229
+ * To read whether the span is remote, use `(flags & SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) != 0`.
1230
+ *
1231
+ * When creating span messages, if the message is logically forwarded from another source with an equivalent flags fields (i.e., usually another OTLP span message), the field SHOULD be copied as-is. If creating from a source that does not have an equivalent flags field (such as a runtime representation of an OpenTelemetry span), the high 22 bits MUST be set to zero.
1232
+ * Readers MUST NOT assume that bits 10-31 (22 most significant bits) will be zero.
1233
+ *
1234
+ * [Optional].
1235
+ */
1236
+ flags?: number | null;
1237
+ /**
1238
+ * Kind
1239
+ * @description Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using `CLIENT` (caller) and `SERVER` (callee) to identify queueing latency associated with the span.
1240
+ * @default SPAN_KIND_INTERNAL
1241
+ */
1242
+ kind?: components["schemas"]["OtlpKind"] | number | null;
1243
+ /** Links */
1244
+ links?: null;
1245
+ /**
1246
+ * Name
1247
+ * @description A description of the span's operation.
1248
+ *
1249
+ * For example, the name can be a qualified method name or a file name and a line number where the operation is called. A best practice is to use the same display name at the same call point in an application. This makes it easier to correlate spans in different traces.
1250
+ *
1251
+ * This field is semantically required to be set to non-empty string. Empty value is equivalent to an unknown span name.
1252
+ *
1253
+ * This field is required.
1254
+ */
1255
+ name?: string | null;
1256
+ /**
1257
+ * Parent Span Id
1258
+ * @description The `span_id` of this span's parent span. If this is a root span, then this field must be empty. The ID is an 8-byte array.
1259
+ */
1260
+ parent_span_id?: string | null;
1261
+ /**
1262
+ * Span Id
1263
+ * @description A unique identifier for a span within a trace, assigned when the span is created. The ID is an 8-byte array. An ID with all zeroes OR of length other than 8 bytes is considered invalid (empty string in OTLP/JSON is zero-length and thus is also invalid).
1264
+ *
1265
+ * This field is required.
1266
+ */
1267
+ span_id?: string | null;
1268
+ /**
1269
+ * Start Time Unix Nano
1270
+ * @description start_time_unix_nano is the start time of the span. On the client side, this is the time kept by the local machine where the span execution starts. On the server side, this is the time when the server's application handler starts running.
1271
+ * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
1272
+ *
1273
+ * This field is semantically required and it is expected that end_time >= start_time.
1274
+ */
1275
+ start_time_unix_nano?: number | string | null;
1276
+ /** @description An optional final status for this span. Semantically when Status isn't set, it means span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0). */
1277
+ status?: components["schemas"]["OtlpStatus"] | null;
1278
+ /**
1279
+ * Trace Id
1280
+ * @description A unique identifier for a trace. All spans from the same trace share the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR of length other than 16 bytes is considered invalid (empty string in OTLP/JSON is zero-length and thus is also invalid).
1281
+ *
1282
+ * This field is required.
1283
+ */
1284
+ trace_id?: string | null;
1285
+ /**
1286
+ * Trace State
1287
+ * @description trace_state conveys information about request position in multiple distributed tracing graphs. It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header
1288
+ * See also https://github.com/w3c/distributed-tracing for more details about this field.
1289
+ */
1290
+ trace_state?: string | null;
1291
+ };
1292
+ /** OtlpStatus */
1293
+ OtlpStatus: {
1294
+ /**
1295
+ * Code
1296
+ * @description The status code.
1297
+ */
1298
+ code?: number | null;
1299
+ /**
1300
+ * Message
1301
+ * @description A developer-facing human readable error message.
1302
+ */
1303
+ message?: string | null;
1304
+ };
1092
1305
  /** Project */
1093
1306
  Project: {
1094
1307
  /** Name */
@@ -1197,6 +1410,37 @@ export interface components {
1197
1410
  /** Source Prompt Id */
1198
1411
  source_prompt_id?: string | null;
1199
1412
  };
1413
+ /** PromptDeepSeekInvocationParameters */
1414
+ PromptDeepSeekInvocationParameters: {
1415
+ /**
1416
+ * @description discriminator enum property added by openapi-typescript
1417
+ * @enum {string}
1418
+ */
1419
+ type: "deepseek";
1420
+ deepseek: components["schemas"]["PromptDeepSeekInvocationParametersContent"];
1421
+ };
1422
+ /** PromptDeepSeekInvocationParametersContent */
1423
+ PromptDeepSeekInvocationParametersContent: {
1424
+ /** Temperature */
1425
+ temperature?: number;
1426
+ /** Max Tokens */
1427
+ max_tokens?: number;
1428
+ /** Max Completion Tokens */
1429
+ max_completion_tokens?: number;
1430
+ /** Frequency Penalty */
1431
+ frequency_penalty?: number;
1432
+ /** Presence Penalty */
1433
+ presence_penalty?: number;
1434
+ /** Top P */
1435
+ top_p?: number;
1436
+ /** Seed */
1437
+ seed?: number;
1438
+ /**
1439
+ * Reasoning Effort
1440
+ * @enum {string}
1441
+ */
1442
+ reasoning_effort?: "low" | "medium" | "high";
1443
+ };
1200
1444
  /** PromptGoogleInvocationParameters */
1201
1445
  PromptGoogleInvocationParameters: {
1202
1446
  /**
@@ -1388,7 +1632,7 @@ export interface components {
1388
1632
  template_type: components["schemas"]["PromptTemplateType"];
1389
1633
  template_format: components["schemas"]["PromptTemplateFormat"];
1390
1634
  /** Invocation Parameters */
1391
- invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"];
1635
+ invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"];
1392
1636
  tools?: components["schemas"]["PromptTools"] | null;
1393
1637
  /** Response Format */
1394
1638
  response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
@@ -1407,7 +1651,7 @@ export interface components {
1407
1651
  template_type: components["schemas"]["PromptTemplateType"];
1408
1652
  template_format: components["schemas"]["PromptTemplateFormat"];
1409
1653
  /** Invocation Parameters */
1410
- invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"];
1654
+ invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"];
1411
1655
  tools?: components["schemas"]["PromptTools"] | null;
1412
1656
  /** Response Format */
1413
1657
  response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
@@ -1538,6 +1782,16 @@ export interface components {
1538
1782
  /** Next Cursor */
1539
1783
  next_cursor: string | null;
1540
1784
  };
1785
+ /**
1786
+ * SpanSearchResponseBody
1787
+ * @description Paginated response where each span follows OTLP JSON structure.
1788
+ */
1789
+ SpanSearchResponseBody: {
1790
+ /** Data */
1791
+ data: components["schemas"]["OtlpSpan"][];
1792
+ /** Next Cursor */
1793
+ next_cursor: string | null;
1794
+ };
1541
1795
  /** TextContentPart */
1542
1796
  TextContentPart: {
1543
1797
  /**
@@ -1604,6 +1858,8 @@ export interface components {
1604
1858
  UploadDatasetData: {
1605
1859
  /** Dataset Id */
1606
1860
  dataset_id: string;
1861
+ /** Version Id */
1862
+ version_id: string;
1607
1863
  };
1608
1864
  /** UploadDatasetResponseBody */
1609
1865
  UploadDatasetResponseBody: {
@@ -2728,6 +2984,15 @@ export interface operations {
2728
2984
  "text/plain": string;
2729
2985
  };
2730
2986
  };
2987
+ /** @description This experiment run has already been submitted */
2988
+ 409: {
2989
+ headers: {
2990
+ [name: string]: unknown;
2991
+ };
2992
+ content: {
2993
+ "text/plain": string;
2994
+ };
2995
+ };
2731
2996
  /** @description Validation Error */
2732
2997
  422: {
2733
2998
  headers: {
@@ -2790,6 +3055,69 @@ export interface operations {
2790
3055
  };
2791
3056
  };
2792
3057
  };
3058
+ spanSearch: {
3059
+ parameters: {
3060
+ query?: {
3061
+ /** @description Pagination cursor (GlobalID of Span) */
3062
+ cursor?: string | null;
3063
+ /** @description Maximum number of spans to return */
3064
+ limit?: number;
3065
+ /** @description Sort direction for the sort field */
3066
+ sort_direction?: "asc" | "desc";
3067
+ /** @description Inclusive lower bound time */
3068
+ start_time?: string | null;
3069
+ /** @description Exclusive upper bound time */
3070
+ end_time?: string | null;
3071
+ /** @description If provided, only include spans that have at least one annotation with one of these names. */
3072
+ annotationNames?: string[] | null;
3073
+ };
3074
+ header?: never;
3075
+ path: {
3076
+ /** @description The project identifier: either project ID or project name. If using a project name, it cannot contain slash (/), question mark (?), or pound sign (#) characters. */
3077
+ project_identifier: string;
3078
+ };
3079
+ cookie?: never;
3080
+ };
3081
+ requestBody?: never;
3082
+ responses: {
3083
+ /** @description Successful Response */
3084
+ 200: {
3085
+ headers: {
3086
+ [name: string]: unknown;
3087
+ };
3088
+ content: {
3089
+ "application/json": components["schemas"]["SpanSearchResponseBody"];
3090
+ };
3091
+ };
3092
+ /** @description Forbidden */
3093
+ 403: {
3094
+ headers: {
3095
+ [name: string]: unknown;
3096
+ };
3097
+ content: {
3098
+ "text/plain": string;
3099
+ };
3100
+ };
3101
+ /** @description Not Found */
3102
+ 404: {
3103
+ headers: {
3104
+ [name: string]: unknown;
3105
+ };
3106
+ content: {
3107
+ "text/plain": string;
3108
+ };
3109
+ };
3110
+ /** @description Unprocessable Entity */
3111
+ 422: {
3112
+ headers: {
3113
+ [name: string]: unknown;
3114
+ };
3115
+ content: {
3116
+ "text/plain": string;
3117
+ };
3118
+ };
3119
+ };
3120
+ };
2793
3121
  annotateSpans: {
2794
3122
  parameters: {
2795
3123
  query?: {
@@ -102,11 +102,17 @@ interface GooglePromptVersionInput extends PromptVersionInputBase {
102
102
  invocationParameters?: GoogleInvocationParameters;
103
103
  }
104
104
 
105
+ interface DeepSeekPromptVersionInput extends PromptVersionInputBase {
106
+ modelProvider: "DEEPSEEK";
107
+ invocationParameters?: OpenAIInvocationParameters;
108
+ }
109
+
105
110
  type PromptVersionInput =
106
111
  | OpenAIPromptVersionInput
107
112
  | AzureOpenAIPromptVersionInput
108
113
  | AnthropicPromptVersionInput
109
- | GooglePromptVersionInput;
114
+ | GooglePromptVersionInput
115
+ | DeepSeekPromptVersionInput;
110
116
 
111
117
  /**
112
118
  * A helper function to construct a prompt version declaratively.
@@ -190,6 +196,22 @@ export function promptVersion(params: PromptVersionInput): PromptVersionData {
190
196
  google: invocation_parameters ?? {},
191
197
  },
192
198
  };
199
+ case "DEEPSEEK":
200
+ return {
201
+ description,
202
+ model_provider,
203
+ model_name,
204
+ template_type: "CHAT",
205
+ template_format,
206
+ template: {
207
+ type: "chat",
208
+ messages: templateMessages,
209
+ },
210
+ invocation_parameters: {
211
+ type: "deepseek",
212
+ deepseek: invocation_parameters ?? {},
213
+ },
214
+ };
193
215
  default:
194
216
  assertUnreachable(model_provider);
195
217
  }