@arizeai/phoenix-client 5.9.0 → 6.0.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 (198) hide show
  1. package/dist/esm/__generated__/api/v1.d.ts +190 -0
  2. package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
  3. package/dist/esm/schemas/jsonLiteralSchema.d.ts +1 -1
  4. package/dist/esm/schemas/jsonLiteralSchema.d.ts.map +1 -1
  5. package/dist/esm/schemas/jsonLiteralSchema.js +1 -1
  6. package/dist/esm/schemas/jsonLiteralSchema.js.map +1 -1
  7. package/dist/esm/schemas/jsonSchema.d.ts +28 -126
  8. package/dist/esm/schemas/jsonSchema.d.ts.map +1 -1
  9. package/dist/esm/schemas/jsonSchema.js +5 -11
  10. package/dist/esm/schemas/jsonSchema.js.map +1 -1
  11. package/dist/esm/schemas/llm/anthropic/converters.d.ts +205 -1344
  12. package/dist/esm/schemas/llm/anthropic/converters.d.ts.map +1 -1
  13. package/dist/esm/schemas/llm/anthropic/messagePartSchemas.d.ts +45 -217
  14. package/dist/esm/schemas/llm/anthropic/messagePartSchemas.d.ts.map +1 -1
  15. package/dist/esm/schemas/llm/anthropic/messageSchemas.d.ts +87 -725
  16. package/dist/esm/schemas/llm/anthropic/messageSchemas.d.ts.map +1 -1
  17. package/dist/esm/schemas/llm/anthropic/messageSchemas.js +3 -13
  18. package/dist/esm/schemas/llm/anthropic/messageSchemas.js.map +1 -1
  19. package/dist/esm/schemas/llm/anthropic/toolCallSchemas.d.ts +4 -24
  20. package/dist/esm/schemas/llm/anthropic/toolCallSchemas.d.ts.map +1 -1
  21. package/dist/esm/schemas/llm/anthropic/toolChoiceSchemas.d.ts +4 -18
  22. package/dist/esm/schemas/llm/anthropic/toolChoiceSchemas.d.ts.map +1 -1
  23. package/dist/esm/schemas/llm/anthropic/toolSchemas.d.ts +29 -169
  24. package/dist/esm/schemas/llm/anthropic/toolSchemas.d.ts.map +1 -1
  25. package/dist/esm/schemas/llm/constants.d.ts +836 -8952
  26. package/dist/esm/schemas/llm/constants.d.ts.map +1 -1
  27. package/dist/esm/schemas/llm/converters.d.ts +3564 -36028
  28. package/dist/esm/schemas/llm/converters.d.ts.map +1 -1
  29. package/dist/esm/schemas/llm/converters.js +8 -0
  30. package/dist/esm/schemas/llm/converters.js.map +1 -1
  31. package/dist/esm/schemas/llm/openai/converters.d.ts +559 -5065
  32. package/dist/esm/schemas/llm/openai/converters.d.ts.map +1 -1
  33. package/dist/esm/schemas/llm/openai/messagePartSchemas.d.ts +7 -47
  34. package/dist/esm/schemas/llm/openai/messagePartSchemas.d.ts.map +1 -1
  35. package/dist/esm/schemas/llm/openai/messageSchemas.d.ts +51 -665
  36. package/dist/esm/schemas/llm/openai/messageSchemas.d.ts.map +1 -1
  37. package/dist/esm/schemas/llm/openai/messageSchemas.js +12 -24
  38. package/dist/esm/schemas/llm/openai/messageSchemas.js.map +1 -1
  39. package/dist/esm/schemas/llm/openai/responseFormatSchema.d.ts +30 -218
  40. package/dist/esm/schemas/llm/openai/responseFormatSchema.d.ts.map +1 -1
  41. package/dist/esm/schemas/llm/openai/toolCallSchemas.d.ts +6 -54
  42. package/dist/esm/schemas/llm/openai/toolCallSchemas.d.ts.map +1 -1
  43. package/dist/esm/schemas/llm/openai/toolCallSchemas.js +2 -3
  44. package/dist/esm/schemas/llm/openai/toolCallSchemas.js.map +1 -1
  45. package/dist/esm/schemas/llm/openai/toolChoiceSchemas.d.ts +3 -17
  46. package/dist/esm/schemas/llm/openai/toolChoiceSchemas.d.ts.map +1 -1
  47. package/dist/esm/schemas/llm/openai/toolSchemas.d.ts +33 -1254
  48. package/dist/esm/schemas/llm/openai/toolSchemas.d.ts.map +1 -1
  49. package/dist/esm/schemas/llm/openai/toolSchemas.js +3 -6
  50. package/dist/esm/schemas/llm/openai/toolSchemas.js.map +1 -1
  51. package/dist/esm/schemas/llm/phoenixPrompt/converters.d.ts +105 -696
  52. package/dist/esm/schemas/llm/phoenixPrompt/converters.d.ts.map +1 -1
  53. package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts +13 -89
  54. package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts.map +1 -1
  55. package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.js +1 -1
  56. package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.js.map +1 -1
  57. package/dist/esm/schemas/llm/phoenixPrompt/messageSchemas.d.ts +41 -165
  58. package/dist/esm/schemas/llm/phoenixPrompt/messageSchemas.d.ts.map +1 -1
  59. package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts +2 -28
  60. package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts.map +1 -1
  61. package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.js +1 -1
  62. package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.js.map +1 -1
  63. package/dist/esm/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts +2 -26
  64. package/dist/esm/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts.map +1 -1
  65. package/dist/esm/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts +5 -23
  66. package/dist/esm/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts.map +1 -1
  67. package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.d.ts +2 -28
  68. package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.d.ts.map +1 -1
  69. package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.js +1 -1
  70. package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.js.map +1 -1
  71. package/dist/esm/schemas/llm/schemas.d.ts +172 -2608
  72. package/dist/esm/schemas/llm/schemas.d.ts.map +1 -1
  73. package/dist/esm/schemas/llm/schemas.js +2 -2
  74. package/dist/esm/schemas/llm/schemas.js.map +1 -1
  75. package/dist/esm/schemas/llm/types.d.ts +8 -8
  76. package/dist/esm/schemas/llm/types.d.ts.map +1 -1
  77. package/dist/esm/schemas/llm/utils.d.ts +2 -2
  78. package/dist/esm/schemas/llm/utils.d.ts.map +1 -1
  79. package/dist/esm/schemas/llm/vercel/messagePartSchemas.d.ts +13 -105
  80. package/dist/esm/schemas/llm/vercel/messagePartSchemas.d.ts.map +1 -1
  81. package/dist/esm/schemas/llm/vercel/messageSchemas.d.ts +20 -137
  82. package/dist/esm/schemas/llm/vercel/messageSchemas.d.ts.map +1 -1
  83. package/dist/esm/schemas/llm/vercel/toolChoiceSchemas.d.ts +2 -8
  84. package/dist/esm/schemas/llm/vercel/toolChoiceSchemas.d.ts.map +1 -1
  85. package/dist/esm/schemas/llm/vercel/toolSchemas.d.ts +2 -26
  86. package/dist/esm/schemas/llm/vercel/toolSchemas.d.ts.map +1 -1
  87. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  88. package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
  89. package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
  90. package/dist/esm/utils/schemaMatches.d.ts +1 -1
  91. package/dist/esm/utils/schemaMatches.d.ts.map +1 -1
  92. package/dist/src/__generated__/api/v1.d.ts +190 -0
  93. package/dist/src/__generated__/api/v1.d.ts.map +1 -1
  94. package/dist/src/schemas/jsonLiteralSchema.d.ts +1 -1
  95. package/dist/src/schemas/jsonLiteralSchema.d.ts.map +1 -1
  96. package/dist/src/schemas/jsonLiteralSchema.js +1 -1
  97. package/dist/src/schemas/jsonLiteralSchema.js.map +1 -1
  98. package/dist/src/schemas/jsonSchema.d.ts +28 -126
  99. package/dist/src/schemas/jsonSchema.d.ts.map +1 -1
  100. package/dist/src/schemas/jsonSchema.js +5 -11
  101. package/dist/src/schemas/jsonSchema.js.map +1 -1
  102. package/dist/src/schemas/llm/anthropic/converters.d.ts +205 -1344
  103. package/dist/src/schemas/llm/anthropic/converters.d.ts.map +1 -1
  104. package/dist/src/schemas/llm/anthropic/messagePartSchemas.d.ts +45 -217
  105. package/dist/src/schemas/llm/anthropic/messagePartSchemas.d.ts.map +1 -1
  106. package/dist/src/schemas/llm/anthropic/messageSchemas.d.ts +87 -725
  107. package/dist/src/schemas/llm/anthropic/messageSchemas.d.ts.map +1 -1
  108. package/dist/src/schemas/llm/anthropic/messageSchemas.js +3 -13
  109. package/dist/src/schemas/llm/anthropic/messageSchemas.js.map +1 -1
  110. package/dist/src/schemas/llm/anthropic/toolCallSchemas.d.ts +4 -24
  111. package/dist/src/schemas/llm/anthropic/toolCallSchemas.d.ts.map +1 -1
  112. package/dist/src/schemas/llm/anthropic/toolChoiceSchemas.d.ts +4 -18
  113. package/dist/src/schemas/llm/anthropic/toolChoiceSchemas.d.ts.map +1 -1
  114. package/dist/src/schemas/llm/anthropic/toolSchemas.d.ts +29 -169
  115. package/dist/src/schemas/llm/anthropic/toolSchemas.d.ts.map +1 -1
  116. package/dist/src/schemas/llm/constants.d.ts +836 -8952
  117. package/dist/src/schemas/llm/constants.d.ts.map +1 -1
  118. package/dist/src/schemas/llm/converters.d.ts +3564 -36028
  119. package/dist/src/schemas/llm/converters.d.ts.map +1 -1
  120. package/dist/src/schemas/llm/converters.js +8 -0
  121. package/dist/src/schemas/llm/converters.js.map +1 -1
  122. package/dist/src/schemas/llm/openai/converters.d.ts +559 -5065
  123. package/dist/src/schemas/llm/openai/converters.d.ts.map +1 -1
  124. package/dist/src/schemas/llm/openai/messagePartSchemas.d.ts +7 -47
  125. package/dist/src/schemas/llm/openai/messagePartSchemas.d.ts.map +1 -1
  126. package/dist/src/schemas/llm/openai/messageSchemas.d.ts +51 -665
  127. package/dist/src/schemas/llm/openai/messageSchemas.d.ts.map +1 -1
  128. package/dist/src/schemas/llm/openai/messageSchemas.js +12 -24
  129. package/dist/src/schemas/llm/openai/messageSchemas.js.map +1 -1
  130. package/dist/src/schemas/llm/openai/responseFormatSchema.d.ts +30 -218
  131. package/dist/src/schemas/llm/openai/responseFormatSchema.d.ts.map +1 -1
  132. package/dist/src/schemas/llm/openai/toolCallSchemas.d.ts +6 -54
  133. package/dist/src/schemas/llm/openai/toolCallSchemas.d.ts.map +1 -1
  134. package/dist/src/schemas/llm/openai/toolCallSchemas.js +2 -3
  135. package/dist/src/schemas/llm/openai/toolCallSchemas.js.map +1 -1
  136. package/dist/src/schemas/llm/openai/toolChoiceSchemas.d.ts +3 -17
  137. package/dist/src/schemas/llm/openai/toolChoiceSchemas.d.ts.map +1 -1
  138. package/dist/src/schemas/llm/openai/toolSchemas.d.ts +33 -1254
  139. package/dist/src/schemas/llm/openai/toolSchemas.d.ts.map +1 -1
  140. package/dist/src/schemas/llm/openai/toolSchemas.js +3 -6
  141. package/dist/src/schemas/llm/openai/toolSchemas.js.map +1 -1
  142. package/dist/src/schemas/llm/phoenixPrompt/converters.d.ts +105 -696
  143. package/dist/src/schemas/llm/phoenixPrompt/converters.d.ts.map +1 -1
  144. package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts +13 -89
  145. package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts.map +1 -1
  146. package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.js +1 -1
  147. package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.js.map +1 -1
  148. package/dist/src/schemas/llm/phoenixPrompt/messageSchemas.d.ts +41 -165
  149. package/dist/src/schemas/llm/phoenixPrompt/messageSchemas.d.ts.map +1 -1
  150. package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts +2 -28
  151. package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts.map +1 -1
  152. package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.js +1 -1
  153. package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.js.map +1 -1
  154. package/dist/src/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts +2 -26
  155. package/dist/src/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts.map +1 -1
  156. package/dist/src/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts +5 -23
  157. package/dist/src/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts.map +1 -1
  158. package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.d.ts +2 -28
  159. package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.d.ts.map +1 -1
  160. package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.js +1 -1
  161. package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.js.map +1 -1
  162. package/dist/src/schemas/llm/schemas.d.ts +172 -2608
  163. package/dist/src/schemas/llm/schemas.d.ts.map +1 -1
  164. package/dist/src/schemas/llm/schemas.js +2 -2
  165. package/dist/src/schemas/llm/schemas.js.map +1 -1
  166. package/dist/src/schemas/llm/types.d.ts +8 -8
  167. package/dist/src/schemas/llm/types.d.ts.map +1 -1
  168. package/dist/src/schemas/llm/utils.d.ts +2 -2
  169. package/dist/src/schemas/llm/utils.d.ts.map +1 -1
  170. package/dist/src/schemas/llm/vercel/messagePartSchemas.d.ts +13 -105
  171. package/dist/src/schemas/llm/vercel/messagePartSchemas.d.ts.map +1 -1
  172. package/dist/src/schemas/llm/vercel/messageSchemas.d.ts +20 -137
  173. package/dist/src/schemas/llm/vercel/messageSchemas.d.ts.map +1 -1
  174. package/dist/src/schemas/llm/vercel/toolChoiceSchemas.d.ts +2 -8
  175. package/dist/src/schemas/llm/vercel/toolChoiceSchemas.d.ts.map +1 -1
  176. package/dist/src/schemas/llm/vercel/toolSchemas.d.ts +2 -26
  177. package/dist/src/schemas/llm/vercel/toolSchemas.d.ts.map +1 -1
  178. package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
  179. package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
  180. package/dist/src/utils/schemaMatches.d.ts +1 -1
  181. package/dist/src/utils/schemaMatches.d.ts.map +1 -1
  182. package/dist/tsconfig.tsbuildinfo +1 -1
  183. package/package.json +4 -5
  184. package/src/__generated__/api/v1.ts +190 -0
  185. package/src/schemas/jsonLiteralSchema.ts +1 -1
  186. package/src/schemas/jsonSchema.ts +18 -25
  187. package/src/schemas/llm/anthropic/messageSchemas.ts +6 -15
  188. package/src/schemas/llm/converters.ts +40 -16
  189. package/src/schemas/llm/openai/messageSchemas.ts +35 -47
  190. package/src/schemas/llm/openai/toolCallSchemas.ts +2 -3
  191. package/src/schemas/llm/openai/toolSchemas.ts +22 -25
  192. package/src/schemas/llm/phoenixPrompt/messagePartSchemas.ts +1 -1
  193. package/src/schemas/llm/phoenixPrompt/responseFormatSchema.ts +1 -1
  194. package/src/schemas/llm/phoenixPrompt/toolSchemas.ts +1 -1
  195. package/src/schemas/llm/schemas.ts +2 -2
  196. package/src/schemas/llm/types.ts +13 -13
  197. package/src/schemas/llm/utils.ts +7 -7
  198. package/src/utils/schemaMatches.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/phoenix-client",
3
- "version": "5.9.0",
3
+ "version": "6.0.0",
4
4
  "description": "A client for the Phoenix API",
5
5
  "keywords": [
6
6
  "arize",
@@ -70,10 +70,9 @@
70
70
  "async": "^3.2.6",
71
71
  "openapi-fetch": "^0.12.5",
72
72
  "tiny-invariant": "^1.3.3",
73
- "zod": "^3.24.3",
74
- "zod-to-json-schema": "^3.24.3",
73
+ "zod": "^4.0.14",
75
74
  "@arizeai/phoenix-config": "0.1.1",
76
- "@arizeai/phoenix-otel": "0.4.1"
75
+ "@arizeai/phoenix-otel": "0.4.2"
77
76
  },
78
77
  "devDependencies": {
79
78
  "@ai-sdk/openai": "^3.0.29",
@@ -85,7 +84,7 @@
85
84
  "openapi-typescript": "^7.6.1",
86
85
  "tsx": "^4.19.3",
87
86
  "vitest": "^4.0.10",
88
- "@arizeai/phoenix-evals": "0.10.0"
87
+ "@arizeai/phoenix-evals": "1.0.0"
89
88
  },
90
89
  "optionalDependencies": {
91
90
  "@anthropic-ai/sdk": "^0.35.0",
@@ -776,6 +776,40 @@ export interface paths {
776
776
  patch?: never;
777
777
  trace?: never;
778
778
  };
779
+ "/v1/sessions/{session_identifier}": {
780
+ parameters: {
781
+ query?: never;
782
+ header?: never;
783
+ path?: never;
784
+ cookie?: never;
785
+ };
786
+ /** Get session by ID or session_id */
787
+ get: operations["getSession"];
788
+ put?: never;
789
+ post?: never;
790
+ delete?: never;
791
+ options?: never;
792
+ head?: never;
793
+ patch?: never;
794
+ trace?: never;
795
+ };
796
+ "/v1/projects/{project_identifier}/sessions": {
797
+ parameters: {
798
+ query?: never;
799
+ header?: never;
800
+ path?: never;
801
+ cookie?: never;
802
+ };
803
+ /** List sessions for a project */
804
+ get: operations["listProjectSessions"];
805
+ put?: never;
806
+ post?: never;
807
+ delete?: never;
808
+ options?: never;
809
+ head?: never;
810
+ patch?: never;
811
+ trace?: never;
812
+ };
779
813
  "/v1/session_annotations": {
780
814
  parameters: {
781
815
  query?: never;
@@ -1481,6 +1515,17 @@ export interface components {
1481
1515
  /** Next Cursor */
1482
1516
  next_cursor: string | null;
1483
1517
  };
1518
+ /** GetSessionResponseBody */
1519
+ GetSessionResponseBody: {
1520
+ data: components["schemas"]["SessionData"];
1521
+ };
1522
+ /** GetSessionsResponseBody */
1523
+ GetSessionsResponseBody: {
1524
+ /** Data */
1525
+ data: components["schemas"]["SessionData"][];
1526
+ /** Next Cursor */
1527
+ next_cursor: string | null;
1528
+ };
1484
1529
  /** GetUsersResponseBody */
1485
1530
  GetUsersResponseBody: {
1486
1531
  /** Data */
@@ -2515,6 +2560,44 @@ export interface components {
2515
2560
  /** Next Cursor */
2516
2561
  next_cursor: string | null;
2517
2562
  };
2563
+ /** SessionData */
2564
+ SessionData: {
2565
+ /** Id */
2566
+ id: string;
2567
+ /** Session Id */
2568
+ session_id: string;
2569
+ /** Project Id */
2570
+ project_id: string;
2571
+ /**
2572
+ * Start Time
2573
+ * Format: date-time
2574
+ */
2575
+ start_time: string;
2576
+ /**
2577
+ * End Time
2578
+ * Format: date-time
2579
+ */
2580
+ end_time: string;
2581
+ /** Traces */
2582
+ traces: components["schemas"]["SessionTraceData"][];
2583
+ };
2584
+ /** SessionTraceData */
2585
+ SessionTraceData: {
2586
+ /** Id */
2587
+ id: string;
2588
+ /** Trace Id */
2589
+ trace_id: string;
2590
+ /**
2591
+ * Start Time
2592
+ * Format: date-time
2593
+ */
2594
+ start_time: string;
2595
+ /**
2596
+ * End Time
2597
+ * Format: date-time
2598
+ */
2599
+ end_time: string;
2600
+ };
2518
2601
  /** Span */
2519
2602
  Span: {
2520
2603
  /**
@@ -5618,6 +5701,113 @@ export interface operations {
5618
5701
  };
5619
5702
  };
5620
5703
  };
5704
+ getSession: {
5705
+ parameters: {
5706
+ query?: never;
5707
+ header?: never;
5708
+ path: {
5709
+ /** @description The session identifier: either a GlobalID or user-provided session_id string. */
5710
+ session_identifier: string;
5711
+ };
5712
+ cookie?: never;
5713
+ };
5714
+ requestBody?: never;
5715
+ responses: {
5716
+ /** @description Successful Response */
5717
+ 200: {
5718
+ headers: {
5719
+ [name: string]: unknown;
5720
+ };
5721
+ content: {
5722
+ "application/json": components["schemas"]["GetSessionResponseBody"];
5723
+ };
5724
+ };
5725
+ /** @description Forbidden */
5726
+ 403: {
5727
+ headers: {
5728
+ [name: string]: unknown;
5729
+ };
5730
+ content: {
5731
+ "text/plain": string;
5732
+ };
5733
+ };
5734
+ /** @description Not Found */
5735
+ 404: {
5736
+ headers: {
5737
+ [name: string]: unknown;
5738
+ };
5739
+ content: {
5740
+ "text/plain": string;
5741
+ };
5742
+ };
5743
+ /** @description Unprocessable Entity */
5744
+ 422: {
5745
+ headers: {
5746
+ [name: string]: unknown;
5747
+ };
5748
+ content: {
5749
+ "text/plain": string;
5750
+ };
5751
+ };
5752
+ };
5753
+ };
5754
+ listProjectSessions: {
5755
+ parameters: {
5756
+ query?: {
5757
+ /** @description Cursor for pagination (session ID) */
5758
+ cursor?: string | null;
5759
+ /** @description The max number of sessions to return at a time. */
5760
+ limit?: number;
5761
+ /** @description Sort order by ID: 'asc' (ascending) or 'desc' (descending). */
5762
+ order?: "asc" | "desc";
5763
+ };
5764
+ header?: never;
5765
+ path: {
5766
+ /** @description The project identifier: either project ID or project name. */
5767
+ project_identifier: string;
5768
+ };
5769
+ cookie?: never;
5770
+ };
5771
+ requestBody?: never;
5772
+ responses: {
5773
+ /** @description Successful Response */
5774
+ 200: {
5775
+ headers: {
5776
+ [name: string]: unknown;
5777
+ };
5778
+ content: {
5779
+ "application/json": components["schemas"]["GetSessionsResponseBody"];
5780
+ };
5781
+ };
5782
+ /** @description Forbidden */
5783
+ 403: {
5784
+ headers: {
5785
+ [name: string]: unknown;
5786
+ };
5787
+ content: {
5788
+ "text/plain": string;
5789
+ };
5790
+ };
5791
+ /** @description Not Found */
5792
+ 404: {
5793
+ headers: {
5794
+ [name: string]: unknown;
5795
+ };
5796
+ content: {
5797
+ "text/plain": string;
5798
+ };
5799
+ };
5800
+ /** @description Unprocessable Entity */
5801
+ 422: {
5802
+ headers: {
5803
+ [name: string]: unknown;
5804
+ };
5805
+ content: {
5806
+ "text/plain": string;
5807
+ };
5808
+ };
5809
+ };
5810
+ };
5621
5811
  annotateSessions: {
5622
5812
  parameters: {
5623
5813
  query?: {
@@ -24,6 +24,6 @@ export const jsonLiteralSchema: z.ZodType<JSONLiteral> = z.lazy(() =>
24
24
  z.union([
25
25
  literalSchema,
26
26
  z.array(jsonLiteralSchema),
27
- z.record(jsonLiteralSchema),
27
+ z.record(z.string(), jsonLiteralSchema),
28
28
  ])
29
29
  );
@@ -1,7 +1,7 @@
1
1
  import z from "zod";
2
2
 
3
3
  const jsonSchemaPropertiesSchema = z
4
- .object({
4
+ .looseObject({
5
5
  type: z
6
6
  .enum([
7
7
  "string",
@@ -19,29 +19,22 @@ const jsonSchemaPropertiesSchema = z
19
19
  .describe("A description of the parameter"),
20
20
  enum: z.array(z.string()).optional().describe("The allowed values"),
21
21
  })
22
- .passthrough()
23
22
  .describe("A map of parameter names to their definitions");
24
23
 
25
- export const jsonSchemaZodSchema = z
26
- .object({
27
- type: z.literal("object"),
28
- properties: z.record(
29
- z.union([
30
- jsonSchemaPropertiesSchema,
31
- z
32
- .object({ anyOf: z.array(jsonSchemaPropertiesSchema) })
33
- .describe("A list of possible parameter names to their definitions"),
34
- ])
35
- ),
36
- required: z
37
- .array(z.string())
38
- .optional()
39
- .describe("The required parameters"),
40
- additionalProperties: z
41
- .boolean()
42
- .optional()
43
- .describe(
44
- "Whether or not additional properties are allowed in the schema"
45
- ),
46
- })
47
- .passthrough();
24
+ export const jsonSchemaZodSchema = z.looseObject({
25
+ type: z.literal("object"),
26
+ properties: z.record(
27
+ z.string(),
28
+ z.union([
29
+ jsonSchemaPropertiesSchema,
30
+ z
31
+ .object({ anyOf: z.array(jsonSchemaPropertiesSchema) })
32
+ .describe("A list of possible parameter names to their definitions"),
33
+ ])
34
+ ),
35
+ required: z.array(z.string()).optional().describe("The required parameters"),
36
+ additionalProperties: z
37
+ .boolean()
38
+ .optional()
39
+ .describe("Whether or not additional properties are allowed in the schema"),
40
+ });
@@ -1,5 +1,4 @@
1
1
  import z from "zod";
2
- import zodToJsonSchema from "zod-to-json-schema";
3
2
 
4
3
  import { anthropicMessagePartSchema } from "./messagePartSchemas";
5
4
 
@@ -15,23 +14,15 @@ export type AnthropicMessageRole = z.infer<typeof anthropicMessageRoleSchema>;
15
14
  /**
16
15
  * TODO: rewrite as discriminated union
17
16
  */
18
- export const anthropicMessageSchema = z
19
- .object({
20
- role: anthropicMessageRoleSchema,
21
- content: z.union([z.string(), z.array(anthropicMessagePartSchema)]),
22
- })
23
- .passthrough();
17
+ export const anthropicMessageSchema = z.looseObject({
18
+ role: anthropicMessageRoleSchema,
19
+ content: z.union([z.string(), z.array(anthropicMessagePartSchema)]),
20
+ });
24
21
 
25
22
  export type AnthropicMessage = z.infer<typeof anthropicMessageSchema>;
26
23
 
27
24
  export const anthropicMessagesSchema = z.array(anthropicMessageSchema);
28
25
 
29
- // Type assertion needed due to TypeScript's deep type instantiation limits with complex recursive schemas
30
- // This is safe because zodToJsonSchema works correctly at runtime regardless of TypeScript's type analysis
31
- export const anthropicMessagesJSONSchema = zodToJsonSchema(
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- anthropicMessagesSchema as any, // TODO: use zod4 toJSONSchema instead
34
- {
35
- removeAdditionalStrategy: "passthrough",
36
- }
26
+ export const anthropicMessagesJSONSchema = z.toJSONSchema(
27
+ anthropicMessagesSchema
37
28
  );
@@ -179,6 +179,11 @@ export const toOpenAIMessage = (message: unknown): OpenAIMessage | null => {
179
179
  /**
180
180
  * Convert from OpenAI message format to any other format
181
181
  */
182
+ // Casts to ReturnType below are unavoidable: TypeScript cannot narrow a generic
183
+ // type parameter (TargetProviderSDK) through switch/case control flow, so the
184
+ // indexed access type remains unresolved in each branch. The casts are sound
185
+ // because each branch accesses the correct provider's converter and
186
+ // assertUnreachable ensures exhaustive coverage.
182
187
  export const fromOpenAIMessage = <
183
188
  TargetProviderSDK extends NonNullable<PromptSDKFormat>,
184
189
  >({
@@ -190,20 +195,27 @@ export const fromOpenAIMessage = <
190
195
  }): z.infer<
191
196
  (typeof SDKProviderConverterMap)[TargetProviderSDK]["messages"]["fromOpenAI"]
192
197
  > => {
198
+ type ReturnType = z.infer<
199
+ (typeof SDKProviderConverterMap)[TargetProviderSDK]["messages"]["fromOpenAI"]
200
+ >;
193
201
  switch (targetProvider) {
194
202
  case "AZURE_OPENAI":
195
203
  case "OPENAI":
196
- return SDKProviderConverterMap.OPENAI.messages.fromOpenAI.parse(message);
204
+ return SDKProviderConverterMap.OPENAI.messages.fromOpenAI.parse(
205
+ message
206
+ ) as ReturnType;
197
207
  case "ANTHROPIC":
198
208
  return SDKProviderConverterMap.ANTHROPIC.messages.fromOpenAI.parse(
199
209
  message
200
- );
210
+ ) as ReturnType;
201
211
  case "PHOENIX":
202
- return SDKProviderConverterMap.PHOENIX.messages.fromOpenAI.parse(message);
212
+ return SDKProviderConverterMap.PHOENIX.messages.fromOpenAI.parse(
213
+ message
214
+ ) as ReturnType;
203
215
  case "VERCEL_AI":
204
216
  return SDKProviderConverterMap.VERCEL_AI.messages.fromOpenAI.parse(
205
217
  message
206
- );
218
+ ) as ReturnType;
207
219
  default:
208
220
  return assertUnreachable(targetProvider);
209
221
  }
@@ -248,6 +260,7 @@ export const toOpenAIToolCall = (
248
260
  * @param params.targetProvider the provider to convert the tool call to
249
261
  * @returns the tool call in the target provider format
250
262
  */
263
+ // See comment on fromOpenAIMessage for why `as ReturnType` casts are needed.
251
264
  export const fromOpenAIToolCall = <
252
265
  TargetProviderSDK extends NonNullable<PromptSDKFormat>,
253
266
  >({
@@ -259,24 +272,27 @@ export const fromOpenAIToolCall = <
259
272
  }): z.infer<
260
273
  (typeof SDKProviderConverterMap)[TargetProviderSDK]["toolCalls"]["fromOpenAI"]
261
274
  > => {
275
+ type ReturnType = z.infer<
276
+ (typeof SDKProviderConverterMap)[TargetProviderSDK]["toolCalls"]["fromOpenAI"]
277
+ >;
262
278
  switch (targetProvider) {
263
279
  case "AZURE_OPENAI":
264
280
  case "OPENAI":
265
281
  return SDKProviderConverterMap.OPENAI.toolCalls.fromOpenAI.parse(
266
282
  toolCall
267
- );
283
+ ) as ReturnType;
268
284
  case "ANTHROPIC":
269
285
  return SDKProviderConverterMap.ANTHROPIC.toolCalls.fromOpenAI.parse(
270
286
  toolCall
271
- );
287
+ ) as ReturnType;
272
288
  case "PHOENIX":
273
289
  return SDKProviderConverterMap.PHOENIX.toolCalls.fromOpenAI.parse(
274
290
  toolCall
275
- );
291
+ ) as ReturnType;
276
292
  case "VERCEL_AI":
277
293
  return SDKProviderConverterMap.VERCEL_AI.toolCalls.fromOpenAI.parse(
278
294
  toolCall
279
- );
295
+ ) as ReturnType;
280
296
  default:
281
297
  assertUnreachable(targetProvider);
282
298
  }
@@ -323,6 +339,7 @@ export const toOpenAIToolChoice = (
323
339
  * @param params.targetProvider the provider to convert the tool choice to
324
340
  * @returns the tool choice in the target provider format
325
341
  */
342
+ // See comment on fromOpenAIMessage for why `as ReturnType` casts are needed.
326
343
  export const fromOpenAIToolChoice = <
327
344
  TargetProviderSDK extends NonNullable<PromptSDKFormat>,
328
345
  >({
@@ -334,24 +351,27 @@ export const fromOpenAIToolChoice = <
334
351
  }): z.infer<
335
352
  (typeof SDKProviderConverterMap)[TargetProviderSDK]["toolChoices"]["fromOpenAI"]
336
353
  > => {
354
+ type ReturnType = z.infer<
355
+ (typeof SDKProviderConverterMap)[TargetProviderSDK]["toolChoices"]["fromOpenAI"]
356
+ >;
337
357
  switch (targetProvider) {
338
358
  case "AZURE_OPENAI":
339
359
  case "OPENAI":
340
360
  return SDKProviderConverterMap.OPENAI.toolChoices.fromOpenAI.parse(
341
361
  toolChoice
342
- );
362
+ ) as ReturnType;
343
363
  case "ANTHROPIC":
344
364
  return SDKProviderConverterMap.ANTHROPIC.toolChoices.fromOpenAI.parse(
345
365
  toolChoice
346
- );
366
+ ) as ReturnType;
347
367
  case "PHOENIX":
348
368
  return SDKProviderConverterMap.PHOENIX.toolChoices.fromOpenAI.parse(
349
369
  toolChoice
350
- );
370
+ ) as ReturnType;
351
371
  case "VERCEL_AI":
352
372
  return SDKProviderConverterMap.VERCEL_AI.toolChoices.fromOpenAI.parse(
353
373
  toolChoice
354
- );
374
+ ) as ReturnType;
355
375
  default:
356
376
  assertUnreachable(targetProvider);
357
377
  }
@@ -393,6 +413,7 @@ export const toOpenAIToolDefinition = (
393
413
  /**
394
414
  * Convert from OpenAI tool call format to any other format
395
415
  */
416
+ // See comment on fromOpenAIMessage for why `as ReturnType` casts are needed.
396
417
  export const fromOpenAIToolDefinition = <
397
418
  TargetProviderSDK extends NonNullable<PromptSDKFormat>,
398
419
  >({
@@ -404,24 +425,27 @@ export const fromOpenAIToolDefinition = <
404
425
  }): z.infer<
405
426
  (typeof SDKProviderConverterMap)[TargetProviderSDK]["toolDefinitions"]["fromOpenAI"]
406
427
  > => {
428
+ type ReturnType = z.infer<
429
+ (typeof SDKProviderConverterMap)[TargetProviderSDK]["toolDefinitions"]["fromOpenAI"]
430
+ >;
407
431
  switch (targetProvider) {
408
432
  case "AZURE_OPENAI":
409
433
  case "OPENAI":
410
434
  return SDKProviderConverterMap.OPENAI.toolDefinitions.fromOpenAI.parse(
411
435
  toolDefinition
412
- );
436
+ ) as ReturnType;
413
437
  case "ANTHROPIC":
414
438
  return SDKProviderConverterMap.ANTHROPIC.toolDefinitions.fromOpenAI.parse(
415
439
  toolDefinition
416
- );
440
+ ) as ReturnType;
417
441
  case "PHOENIX":
418
442
  return SDKProviderConverterMap.PHOENIX.toolDefinitions.fromOpenAI.parse(
419
443
  toolDefinition
420
- );
444
+ ) as ReturnType;
421
445
  case "VERCEL_AI":
422
446
  return SDKProviderConverterMap.VERCEL_AI.toolDefinitions.fromOpenAI.parse(
423
447
  toolDefinition
424
- );
448
+ ) as ReturnType;
425
449
  default:
426
450
  assertUnreachable(targetProvider);
427
451
  }
@@ -24,53 +24,41 @@ export const openAIMessageRoleSchema = z.enum([
24
24
  export type OpenAIMessageRole = z.infer<typeof openAIMessageRoleSchema>;
25
25
 
26
26
  export const openAIMessageSchema = z.discriminatedUnion("role", [
27
- z
28
- .object({
29
- role: z.literal("assistant"),
30
- content: z.union([openaiChatPartTextSchema.array(), z.string()]),
31
- name: z.string().optional(),
32
- tool_call_id: z.string().optional(),
33
- tool_calls: z.array(openAIToolCallSchema).optional(),
34
- })
35
- .passthrough(),
36
- z
37
- .object({
38
- role: z.literal("tool"),
39
- content: z.union([openaiChatPartTextSchema.array(), z.string()]),
40
- tool_call_id: z.string(),
41
- })
42
- .passthrough(),
43
- z
44
- .object({
45
- role: z.literal("function"),
46
- content: z.string().nullable(),
47
- name: z.string(),
48
- })
49
- .passthrough(),
50
- z
51
- .object({
52
- role: z.literal("user"),
53
- content: z.union([
54
- z.array(z.union([openaiChatPartTextSchema, openaiChatPartImageSchema])),
55
- z.string(),
56
- ]),
57
- name: z.string().optional(),
58
- })
59
- .passthrough(),
60
- z
61
- .object({
62
- role: z.literal("system"),
63
- content: z.union([openaiChatPartTextSchema.array(), z.string()]),
64
- name: z.string().optional(),
65
- })
66
- .passthrough(),
67
- z
68
- .object({
69
- role: z.literal("developer"),
70
- content: z.union([openaiChatPartTextSchema.array(), z.string()]),
71
- name: z.string().optional(),
72
- })
73
- .passthrough(),
27
+ z.looseObject({
28
+ role: z.literal("assistant"),
29
+ content: z.union([openaiChatPartTextSchema.array(), z.string()]),
30
+ name: z.string().optional(),
31
+ tool_call_id: z.string().optional(),
32
+ tool_calls: z.array(openAIToolCallSchema).optional(),
33
+ }),
34
+ z.looseObject({
35
+ role: z.literal("tool"),
36
+ content: z.union([openaiChatPartTextSchema.array(), z.string()]),
37
+ tool_call_id: z.string(),
38
+ }),
39
+ z.looseObject({
40
+ role: z.literal("function"),
41
+ content: z.string().nullable(),
42
+ name: z.string(),
43
+ }),
44
+ z.looseObject({
45
+ role: z.literal("user"),
46
+ content: z.union([
47
+ z.array(z.union([openaiChatPartTextSchema, openaiChatPartImageSchema])),
48
+ z.string(),
49
+ ]),
50
+ name: z.string().optional(),
51
+ }),
52
+ z.looseObject({
53
+ role: z.literal("system"),
54
+ content: z.union([openaiChatPartTextSchema.array(), z.string()]),
55
+ name: z.string().optional(),
56
+ }),
57
+ z.looseObject({
58
+ role: z.literal("developer"),
59
+ content: z.union([openaiChatPartTextSchema.array(), z.string()]),
60
+ name: z.string().optional(),
61
+ }),
74
62
  ]);
75
63
 
76
64
  export type OpenAIMessage = z.infer<typeof openAIMessageSchema>;
@@ -14,12 +14,11 @@ export const openAIToolCallSchema = z.object({
14
14
  .transform(() => "function" as const),
15
15
  id: z.string().describe("The ID of the tool call"),
16
16
  function: z
17
- .object({
17
+ .looseObject({
18
18
  name: z.string().describe("The name of the function"),
19
19
  arguments: z.string().describe("The arguments for the function"),
20
20
  })
21
- .describe("The function that is being called")
22
- .passthrough(),
21
+ .describe("The function that is being called"),
23
22
  });
24
23
 
25
24
  /**
@@ -10,31 +10,28 @@ import { jsonSchemaZodSchema } from "../../jsonSchema";
10
10
  * allow for extra keys when the zod schema is used for parsing. This is to allow more flexibility for users
11
11
  * to define their own tools according
12
12
  */
13
- export const openAIToolDefinitionSchema = z
14
- .object({
15
- type: z.literal("function").describe("The type of the tool"),
16
- function: z
17
- .object({
18
- name: z.string().describe("The name of the function"),
19
- description: z
20
- .string()
21
- .optional()
22
- .describe("A description of the function"),
23
- parameters: jsonSchemaZodSchema
24
- .extend({
25
- strict: z
26
- .boolean()
27
- .optional()
28
- .describe(
29
- "Whether or not the arguments should exactly match the function definition, only supported for OpenAI models"
30
- ),
31
- })
32
- .describe("The parameters that the function accepts"),
33
- })
34
- .passthrough()
35
- .describe("The function definition"),
36
- })
37
- .passthrough();
13
+ export const openAIToolDefinitionSchema = z.looseObject({
14
+ type: z.literal("function").describe("The type of the tool"),
15
+ function: z
16
+ .looseObject({
17
+ name: z.string().describe("The name of the function"),
18
+ description: z
19
+ .string()
20
+ .optional()
21
+ .describe("A description of the function"),
22
+ parameters: jsonSchemaZodSchema
23
+ .extend({
24
+ strict: z
25
+ .boolean()
26
+ .optional()
27
+ .describe(
28
+ "Whether or not the arguments should exactly match the function definition, only supported for OpenAI models"
29
+ ),
30
+ })
31
+ .describe("The parameters that the function accepts"),
32
+ })
33
+ .describe("The function definition"),
34
+ });
38
35
 
39
36
  /**
40
37
  * The type of an OpenAI tool definition
@@ -41,7 +41,7 @@ export const toolResultPartSchema = schemaMatches<
41
41
  z.number(),
42
42
  z.boolean(),
43
43
  z.null(),
44
- z.record(z.unknown()),
44
+ z.record(z.string(), z.unknown()),
45
45
  z.array(z.unknown()),
46
46
  ]),
47
47
  })