@arizeai/phoenix-client 3.0.0 → 3.2.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 (91) hide show
  1. package/README.md +22 -1
  2. package/dist/esm/__generated__/api/v1.d.ts +188 -50
  3. package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
  4. package/dist/esm/experiments/instrumention.d.ts +6 -1
  5. package/dist/esm/experiments/instrumention.d.ts.map +1 -1
  6. package/dist/esm/experiments/instrumention.js +15 -15
  7. package/dist/esm/experiments/instrumention.js.map +1 -1
  8. package/dist/esm/experiments/runExperiment.d.ts +12 -2
  9. package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
  10. package/dist/esm/experiments/runExperiment.js +5 -2
  11. package/dist/esm/experiments/runExperiment.js.map +1 -1
  12. package/dist/esm/schemas/llm/converters.js +4 -4
  13. package/dist/esm/schemas/llm/converters.js.map +1 -1
  14. package/dist/esm/spans/addDocumentAnnotation.d.ts +45 -0
  15. package/dist/esm/spans/addDocumentAnnotation.d.ts.map +1 -0
  16. package/dist/esm/spans/addDocumentAnnotation.js +45 -0
  17. package/dist/esm/spans/addDocumentAnnotation.js.map +1 -0
  18. package/dist/esm/spans/addSpanAnnotation.d.ts +8 -2
  19. package/dist/esm/spans/addSpanAnnotation.d.ts.map +1 -1
  20. package/dist/esm/spans/addSpanAnnotation.js +5 -5
  21. package/dist/esm/spans/addSpanAnnotation.js.map +1 -1
  22. package/dist/esm/spans/index.d.ts +2 -0
  23. package/dist/esm/spans/index.d.ts.map +1 -1
  24. package/dist/esm/spans/index.js +2 -0
  25. package/dist/esm/spans/index.js.map +1 -1
  26. package/dist/esm/spans/logDocumentAnnotations.d.ts +58 -0
  27. package/dist/esm/spans/logDocumentAnnotations.d.ts.map +1 -0
  28. package/dist/esm/spans/logDocumentAnnotations.js +55 -0
  29. package/dist/esm/spans/logDocumentAnnotations.js.map +1 -0
  30. package/dist/esm/spans/logSpanAnnotations.d.ts +7 -1
  31. package/dist/esm/spans/logSpanAnnotations.d.ts.map +1 -1
  32. package/dist/esm/spans/logSpanAnnotations.js +5 -5
  33. package/dist/esm/spans/logSpanAnnotations.js.map +1 -1
  34. package/dist/esm/spans/types.d.ts +48 -0
  35. package/dist/esm/spans/types.d.ts.map +1 -1
  36. package/dist/esm/spans/types.js +41 -8
  37. package/dist/esm/spans/types.js.map +1 -1
  38. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  39. package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
  40. package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
  41. package/dist/src/__generated__/api/v1.d.ts +188 -50
  42. package/dist/src/__generated__/api/v1.d.ts.map +1 -1
  43. package/dist/src/experiments/instrumention.d.ts +6 -1
  44. package/dist/src/experiments/instrumention.d.ts.map +1 -1
  45. package/dist/src/experiments/instrumention.js +13 -13
  46. package/dist/src/experiments/instrumention.js.map +1 -1
  47. package/dist/src/experiments/runExperiment.d.ts +12 -2
  48. package/dist/src/experiments/runExperiment.d.ts.map +1 -1
  49. package/dist/src/experiments/runExperiment.js +5 -2
  50. package/dist/src/experiments/runExperiment.js.map +1 -1
  51. package/dist/src/schemas/llm/converters.js +4 -4
  52. package/dist/src/schemas/llm/converters.js.map +1 -1
  53. package/dist/src/spans/addDocumentAnnotation.d.ts +45 -0
  54. package/dist/src/spans/addDocumentAnnotation.d.ts.map +1 -0
  55. package/dist/src/spans/addDocumentAnnotation.js +49 -0
  56. package/dist/src/spans/addDocumentAnnotation.js.map +1 -0
  57. package/dist/src/spans/addSpanAnnotation.d.ts +8 -2
  58. package/dist/src/spans/addSpanAnnotation.d.ts.map +1 -1
  59. package/dist/src/spans/addSpanAnnotation.js +6 -6
  60. package/dist/src/spans/addSpanAnnotation.js.map +1 -1
  61. package/dist/src/spans/index.d.ts +2 -0
  62. package/dist/src/spans/index.d.ts.map +1 -1
  63. package/dist/src/spans/index.js +2 -0
  64. package/dist/src/spans/index.js.map +1 -1
  65. package/dist/src/spans/logDocumentAnnotations.d.ts +58 -0
  66. package/dist/src/spans/logDocumentAnnotations.d.ts.map +1 -0
  67. package/dist/src/spans/logDocumentAnnotations.js +58 -0
  68. package/dist/src/spans/logDocumentAnnotations.js.map +1 -0
  69. package/dist/src/spans/logSpanAnnotations.d.ts +7 -1
  70. package/dist/src/spans/logSpanAnnotations.d.ts.map +1 -1
  71. package/dist/src/spans/logSpanAnnotations.js +5 -6
  72. package/dist/src/spans/logSpanAnnotations.js.map +1 -1
  73. package/dist/src/spans/types.d.ts +48 -0
  74. package/dist/src/spans/types.d.ts.map +1 -1
  75. package/dist/src/spans/types.js +45 -10
  76. package/dist/src/spans/types.js.map +1 -1
  77. package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
  78. package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +1 -1
  81. package/src/__generated__/api/v1.d.ts +1240 -1238
  82. package/src/__generated__/api/v1.ts +188 -50
  83. package/src/experiments/instrumention.ts +27 -14
  84. package/src/experiments/runExperiment.ts +15 -0
  85. package/src/schemas/llm/converters.ts +4 -4
  86. package/src/spans/addDocumentAnnotation.ts +66 -0
  87. package/src/spans/addSpanAnnotation.ts +12 -6
  88. package/src/spans/index.ts +2 -0
  89. package/src/spans/logDocumentAnnotations.ts +79 -0
  90. package/src/spans/logSpanAnnotations.ts +11 -5
  91. package/src/spans/types.ts +112 -8
package/README.md CHANGED
@@ -12,7 +12,14 @@
12
12
  </div>
13
13
  </h1>
14
14
 
15
- ![NPM](https://img.shields.io/npm/v/%40arizeai%2Fphoenix-client)
15
+ <p align="center">
16
+ <a href="https://www.npmjs.com/package/@arizeai/phoenix-client">
17
+ <img src="https://img.shields.io/npm/v/%40arizeai%2Fphoenix-client" alt="NPM Version">
18
+ </a>
19
+ <a href="https://arize-ai.github.io/phoenix/">
20
+ <img src="https://img.shields.io/badge/docs-blue?logo=typescript&logoColor=white" alt="Documentation">
21
+ </a>
22
+ </p>
16
23
 
17
24
  This package provides a TypeSript client for the [Arize Phoenix](https://github.com/Arize-ai/phoenix) API. It is still under active development and is subject to change.
18
25
 
@@ -312,3 +319,17 @@ Compatibility Table:
312
319
  | ---------------------- | ---------------------- |
313
320
  | ^2.0.0 | ^9.0.0 |
314
321
  | ^1.0.0 | ^8.0.0 |
322
+
323
+ ---
324
+
325
+ ## Community
326
+
327
+ Join our community to connect with thousands of AI builders:
328
+
329
+ - 🌍 Join our [Slack community](https://arize-ai.slack.com/join/shared_invite/zt-11t1vbu4x-xkBIHmOREQnYnYDH1GDfCg).
330
+ - 📚 Read the [Phoenix documentation](https://arize.com/docs/phoenix).
331
+ - 💡 Ask questions and provide feedback in the _#phoenix-support_ channel.
332
+ - 🌟 Leave a star on our [GitHub](https://github.com/Arize-ai/phoenix).
333
+ - 🐞 Report bugs with [GitHub Issues](https://github.com/Arize-ai/phoenix/issues).
334
+ - 𝕏 Follow us on [𝕏](https://twitter.com/ArizePhoenix).
335
+ - 🗺️ Check out our [roadmap](https://github.com/orgs/Arize-ai/projects/45) to see where we're heading next.
@@ -289,7 +289,10 @@ export interface paths {
289
289
  path?: never;
290
290
  cookie?: never;
291
291
  };
292
- /** List runs for an experiment */
292
+ /**
293
+ * List runs for an experiment
294
+ * @description Retrieve a paginated list of runs for an experiment
295
+ */
293
296
  get: operations["listExperimentRuns"];
294
297
  put?: never;
295
298
  /** Create run for an experiment */
@@ -632,6 +635,23 @@ export interface paths {
632
635
  patch?: never;
633
636
  trace?: never;
634
637
  };
638
+ "/v1/document_annotations": {
639
+ parameters: {
640
+ query?: never;
641
+ header?: never;
642
+ path?: never;
643
+ cookie?: never;
644
+ };
645
+ get?: never;
646
+ put?: never;
647
+ /** Annotate Span Documents */
648
+ post: operations["annotateSpanDocuments"];
649
+ delete?: never;
650
+ options?: never;
651
+ head?: never;
652
+ patch?: never;
653
+ trace?: never;
654
+ };
635
655
  "/v1/users": {
636
656
  parameters: {
637
657
  query?: never;
@@ -680,6 +700,16 @@ export interface paths {
680
700
  export type webhooks = Record<string, never>;
681
701
  export interface components {
682
702
  schemas: {
703
+ /** AnnotateSpanDocumentsRequestBody */
704
+ AnnotateSpanDocumentsRequestBody: {
705
+ /** Data */
706
+ data: components["schemas"]["SpanDocumentAnnotationData"][];
707
+ };
708
+ /** AnnotateSpanDocumentsResponseBody */
709
+ AnnotateSpanDocumentsResponseBody: {
710
+ /** Data */
711
+ data: components["schemas"]["InsertedSpanDocumentAnnotation"][];
712
+ };
683
713
  /** AnnotateSpansRequestBody */
684
714
  AnnotateSpansRequestBody: {
685
715
  /** Data */
@@ -690,6 +720,24 @@ export interface components {
690
720
  /** Data */
691
721
  data: components["schemas"]["InsertedSpanAnnotation"][];
692
722
  };
723
+ /** AnnotationResult */
724
+ AnnotationResult: {
725
+ /**
726
+ * Label
727
+ * @description The label assigned by the annotation
728
+ */
729
+ label?: string | null;
730
+ /**
731
+ * Score
732
+ * @description The score assigned by the annotation
733
+ */
734
+ score?: number | null;
735
+ /**
736
+ * Explanation
737
+ * @description Explanation of the annotation result
738
+ */
739
+ explanation?: string | null;
740
+ };
693
741
  /** CategoricalAnnotationConfig */
694
742
  CategoricalAnnotationConfig: {
695
743
  /** Name */
@@ -1227,6 +1275,14 @@ export interface components {
1227
1275
  */
1228
1276
  id: string;
1229
1277
  };
1278
+ /** InsertedSpanDocumentAnnotation */
1279
+ InsertedSpanDocumentAnnotation: {
1280
+ /**
1281
+ * Id
1282
+ * @description The ID of the inserted span document annotation
1283
+ */
1284
+ id: string;
1285
+ };
1230
1286
  /** ListDatasetExamplesData */
1231
1287
  ListDatasetExamplesData: {
1232
1288
  /** Dataset Id */
@@ -1258,6 +1314,8 @@ export interface components {
1258
1314
  ListExperimentRunsResponseBody: {
1259
1315
  /** Data */
1260
1316
  data: components["schemas"]["ExperimentRunResponse"][];
1317
+ /** Next Cursor */
1318
+ next_cursor: string | null;
1261
1319
  };
1262
1320
  /** ListExperimentsResponseBody */
1263
1321
  ListExperimentsResponseBody: {
@@ -2096,11 +2154,25 @@ export interface components {
2096
2154
  };
2097
2155
  /** SpanAnnotation */
2098
2156
  SpanAnnotation: {
2157
+ /** Id */
2158
+ id: string;
2099
2159
  /**
2100
- * Span Id
2101
- * @description OpenTelemetry Span ID (hex format w/o 0x prefix)
2160
+ * Created At
2161
+ * Format: date-time
2102
2162
  */
2103
- span_id: string;
2163
+ created_at: string;
2164
+ /**
2165
+ * Updated At
2166
+ * Format: date-time
2167
+ */
2168
+ updated_at: string;
2169
+ /**
2170
+ * Source
2171
+ * @enum {string}
2172
+ */
2173
+ source: "API" | "APP";
2174
+ /** User Id */
2175
+ user_id: string | null;
2104
2176
  /**
2105
2177
  * Name
2106
2178
  * @description The name of the annotation
@@ -2113,7 +2185,7 @@ export interface components {
2113
2185
  */
2114
2186
  annotator_kind: "LLM" | "CODE" | "HUMAN";
2115
2187
  /** @description The result of the annotation */
2116
- result?: components["schemas"]["SpanAnnotationResult"] | null;
2188
+ result?: components["schemas"]["AnnotationResult"] | null;
2117
2189
  /**
2118
2190
  * Metadata
2119
2191
  * @description Metadata for the annotation
@@ -2127,33 +2199,14 @@ export interface components {
2127
2199
  * @default
2128
2200
  */
2129
2201
  identifier?: string;
2130
- /** Id */
2131
- id: string;
2132
- /**
2133
- * Created At
2134
- * Format: date-time
2135
- */
2136
- created_at: string;
2137
- /**
2138
- * Updated At
2139
- * Format: date-time
2140
- */
2141
- updated_at: string;
2142
- /**
2143
- * Source
2144
- * @enum {string}
2145
- */
2146
- source: "API" | "APP";
2147
- /** User Id */
2148
- user_id: string | null;
2149
- };
2150
- /** SpanAnnotationData */
2151
- SpanAnnotationData: {
2152
2202
  /**
2153
2203
  * Span Id
2154
2204
  * @description OpenTelemetry Span ID (hex format w/o 0x prefix)
2155
2205
  */
2156
2206
  span_id: string;
2207
+ };
2208
+ /** SpanAnnotationData */
2209
+ SpanAnnotationData: {
2157
2210
  /**
2158
2211
  * Name
2159
2212
  * @description The name of the annotation
@@ -2166,7 +2219,7 @@ export interface components {
2166
2219
  */
2167
2220
  annotator_kind: "LLM" | "CODE" | "HUMAN";
2168
2221
  /** @description The result of the annotation */
2169
- result?: components["schemas"]["SpanAnnotationResult"] | null;
2222
+ result?: components["schemas"]["AnnotationResult"] | null;
2170
2223
  /**
2171
2224
  * Metadata
2172
2225
  * @description Metadata for the annotation
@@ -2180,24 +2233,11 @@ export interface components {
2180
2233
  * @default
2181
2234
  */
2182
2235
  identifier?: string;
2183
- };
2184
- /** SpanAnnotationResult */
2185
- SpanAnnotationResult: {
2186
- /**
2187
- * Label
2188
- * @description The label assigned by the annotation
2189
- */
2190
- label?: string | null;
2191
2236
  /**
2192
- * Score
2193
- * @description The score assigned by the annotation
2194
- */
2195
- score?: number | null;
2196
- /**
2197
- * Explanation
2198
- * @description Explanation of the annotation result
2237
+ * Span Id
2238
+ * @description OpenTelemetry Span ID (hex format w/o 0x prefix)
2199
2239
  */
2200
- explanation?: string | null;
2240
+ span_id: string;
2201
2241
  };
2202
2242
  /** SpanAnnotationsResponseBody */
2203
2243
  SpanAnnotationsResponseBody: {
@@ -2219,6 +2259,45 @@ export interface components {
2219
2259
  */
2220
2260
  span_id: string;
2221
2261
  };
2262
+ /** SpanDocumentAnnotationData */
2263
+ SpanDocumentAnnotationData: {
2264
+ /**
2265
+ * Name
2266
+ * @description The name of the annotation
2267
+ */
2268
+ name: string;
2269
+ /**
2270
+ * Annotator Kind
2271
+ * @description The kind of annotator used for the annotation
2272
+ * @enum {string}
2273
+ */
2274
+ annotator_kind: "LLM" | "CODE" | "HUMAN";
2275
+ /** @description The result of the annotation */
2276
+ result?: components["schemas"]["AnnotationResult"] | null;
2277
+ /**
2278
+ * Metadata
2279
+ * @description Metadata for the annotation
2280
+ */
2281
+ metadata?: {
2282
+ [key: string]: unknown;
2283
+ } | null;
2284
+ /**
2285
+ * Identifier
2286
+ * @description The identifier of the annotation. If provided, the annotation will be updated if it already exists.
2287
+ * @default
2288
+ */
2289
+ identifier?: string;
2290
+ /**
2291
+ * Span Id
2292
+ * @description OpenTelemetry Span ID (hex format w/o 0x prefix)
2293
+ */
2294
+ span_id: string;
2295
+ /**
2296
+ * Document Position
2297
+ * @description A 0 based index of the document. E.x. the first document during retrieval is 0
2298
+ */
2299
+ document_position: number;
2300
+ };
2222
2301
  /** SpanEvent */
2223
2302
  SpanEvent: {
2224
2303
  /**
@@ -2350,11 +2429,11 @@ export interface components {
2350
2429
  * @description The end time of the evaluation in ISO format
2351
2430
  */
2352
2431
  end_time: string;
2353
- /** @description The result of the evaluation */
2354
- result: components["schemas"]["ExperimentEvaluationResult"];
2432
+ /** @description The result of the evaluation. Either result or error must be provided. */
2433
+ result?: components["schemas"]["ExperimentEvaluationResult"] | null;
2355
2434
  /**
2356
2435
  * Error
2357
- * @description Optional error message if the evaluation encountered an error
2436
+ * @description Error message if the evaluation encountered an error. Either result or error must be provided.
2358
2437
  */
2359
2438
  error?: string | null;
2360
2439
  /**
@@ -3354,7 +3433,12 @@ export interface operations {
3354
3433
  };
3355
3434
  listExperimentRuns: {
3356
3435
  parameters: {
3357
- query?: never;
3436
+ query?: {
3437
+ /** @description Cursor for pagination (base64-encoded experiment run ID) */
3438
+ cursor?: string | null;
3439
+ /** @description The max number of experiment runs to return at a time. If not specified, returns all results. */
3440
+ limit?: number | null;
3441
+ };
3358
3442
  header?: never;
3359
3443
  path: {
3360
3444
  experiment_id: string;
@@ -3390,13 +3474,13 @@ export interface operations {
3390
3474
  "text/plain": string;
3391
3475
  };
3392
3476
  };
3393
- /** @description Validation Error */
3477
+ /** @description Invalid cursor format */
3394
3478
  422: {
3395
3479
  headers: {
3396
3480
  [name: string]: unknown;
3397
3481
  };
3398
3482
  content: {
3399
- "application/json": components["schemas"]["HTTPValidationError"];
3483
+ "text/plain": string;
3400
3484
  };
3401
3485
  };
3402
3486
  };
@@ -4586,6 +4670,60 @@ export interface operations {
4586
4670
  };
4587
4671
  };
4588
4672
  };
4673
+ annotateSpanDocuments: {
4674
+ parameters: {
4675
+ query?: {
4676
+ /** @description If set to true, the annotations are inserted synchronously. */
4677
+ sync?: boolean;
4678
+ };
4679
+ header?: never;
4680
+ path?: never;
4681
+ cookie?: never;
4682
+ };
4683
+ requestBody: {
4684
+ content: {
4685
+ "application/json": components["schemas"]["AnnotateSpanDocumentsRequestBody"];
4686
+ };
4687
+ };
4688
+ responses: {
4689
+ /** @description Span document annotation inserted successfully */
4690
+ 200: {
4691
+ headers: {
4692
+ [name: string]: unknown;
4693
+ };
4694
+ content: {
4695
+ "application/json": components["schemas"]["AnnotateSpanDocumentsResponseBody"];
4696
+ };
4697
+ };
4698
+ /** @description Forbidden */
4699
+ 403: {
4700
+ headers: {
4701
+ [name: string]: unknown;
4702
+ };
4703
+ content: {
4704
+ "text/plain": string;
4705
+ };
4706
+ };
4707
+ /** @description Span not found */
4708
+ 404: {
4709
+ headers: {
4710
+ [name: string]: unknown;
4711
+ };
4712
+ content: {
4713
+ "text/plain": string;
4714
+ };
4715
+ };
4716
+ /** @description Invalid request - non-empty identifier not supported */
4717
+ 422: {
4718
+ headers: {
4719
+ [name: string]: unknown;
4720
+ };
4721
+ content: {
4722
+ "text/plain": string;
4723
+ };
4724
+ };
4725
+ };
4726
+ };
4589
4727
  getUsers: {
4590
4728
  parameters: {
4591
4729
  query?: {