@arizeai/phoenix-client 6.10.1 → 6.11.1

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 (214) hide show
  1. package/README.md +62 -0
  2. package/dist/esm/__generated__/api/v1.d.ts +254 -2
  3. package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
  4. package/dist/esm/jest/index.d.ts +5 -0
  5. package/dist/esm/jest/index.d.ts.map +1 -0
  6. package/dist/esm/jest/index.js +49 -0
  7. package/dist/esm/jest/index.js.map +1 -0
  8. package/dist/esm/jest/reporter.d.ts +13 -0
  9. package/dist/esm/jest/reporter.d.ts.map +1 -0
  10. package/dist/esm/jest/reporter.js +19 -0
  11. package/dist/esm/jest/reporter.js.map +1 -0
  12. package/dist/esm/prompts/sdks/toAI.d.ts +2 -2
  13. package/dist/esm/prompts/sdks/toAI.d.ts.map +1 -1
  14. package/dist/esm/prompts/sdks/toAI.js.map +1 -1
  15. package/dist/esm/prompts/sdks/toAnthropic.d.ts +2 -2
  16. package/dist/esm/prompts/sdks/toAnthropic.d.ts.map +1 -1
  17. package/dist/esm/prompts/sdks/toAnthropic.js.map +1 -1
  18. package/dist/esm/prompts/sdks/toOpenAI.d.ts +2 -2
  19. package/dist/esm/prompts/sdks/toOpenAI.d.ts.map +1 -1
  20. package/dist/esm/prompts/sdks/toOpenAI.js.map +1 -1
  21. package/dist/esm/prompts/sdks/toSDK.d.ts +8 -8
  22. package/dist/esm/prompts/sdks/toSDK.d.ts.map +1 -1
  23. package/dist/esm/prompts/sdks/toSDK.js.map +1 -1
  24. package/dist/esm/prompts/sdks/types.d.ts +2 -2
  25. package/dist/esm/prompts/sdks/types.d.ts.map +1 -1
  26. package/dist/esm/schemas/llm/anthropic/converters.d.ts +8 -8
  27. package/dist/esm/schemas/llm/anthropic/messagePartSchemas.d.ts +4 -4
  28. package/dist/esm/schemas/llm/anthropic/messageSchemas.d.ts +6 -6
  29. package/dist/esm/schemas/llm/constants.d.ts +3 -3
  30. package/dist/esm/schemas/llm/converters.d.ts +12 -12
  31. package/dist/esm/schemas/llm/openai/converters.d.ts +3 -3
  32. package/dist/esm/schemas/llm/schemas.d.ts +2 -2
  33. package/dist/esm/testing/acceptance.d.ts +20 -0
  34. package/dist/esm/testing/acceptance.d.ts.map +1 -0
  35. package/dist/esm/testing/acceptance.js +129 -0
  36. package/dist/esm/testing/acceptance.js.map +1 -0
  37. package/dist/esm/testing/define-api.d.ts +157 -0
  38. package/dist/esm/testing/define-api.d.ts.map +1 -0
  39. package/dist/esm/testing/define-api.js +78 -0
  40. package/dist/esm/testing/define-api.js.map +1 -0
  41. package/dist/esm/testing/helpers.d.ts +55 -0
  42. package/dist/esm/testing/helpers.d.ts.map +1 -0
  43. package/dist/esm/testing/helpers.js +179 -0
  44. package/dist/esm/testing/helpers.js.map +1 -0
  45. package/dist/esm/testing/phoenix-test-tracking.d.ts +68 -0
  46. package/dist/esm/testing/phoenix-test-tracking.d.ts.map +1 -0
  47. package/dist/esm/testing/phoenix-test-tracking.js +521 -0
  48. package/dist/esm/testing/phoenix-test-tracking.js.map +1 -0
  49. package/dist/esm/testing/report-artifacts.d.ts +45 -0
  50. package/dist/esm/testing/report-artifacts.d.ts.map +1 -0
  51. package/dist/esm/testing/report-artifacts.js +218 -0
  52. package/dist/esm/testing/report-artifacts.js.map +1 -0
  53. package/dist/esm/testing/report-run.d.ts +22 -0
  54. package/dist/esm/testing/report-run.d.ts.map +1 -0
  55. package/dist/esm/testing/report-run.js +41 -0
  56. package/dist/esm/testing/report-run.js.map +1 -0
  57. package/dist/esm/testing/reporter-format.d.ts +83 -0
  58. package/dist/esm/testing/reporter-format.d.ts.map +1 -0
  59. package/dist/esm/testing/reporter-format.js +852 -0
  60. package/dist/esm/testing/reporter-format.js.map +1 -0
  61. package/dist/esm/testing/runner.d.ts +31 -0
  62. package/dist/esm/testing/runner.d.ts.map +1 -0
  63. package/dist/esm/testing/runner.js +238 -0
  64. package/dist/esm/testing/runner.js.map +1 -0
  65. package/dist/esm/testing/state.d.ts +138 -0
  66. package/dist/esm/testing/state.d.ts.map +1 -0
  67. package/dist/esm/testing/state.js +31 -0
  68. package/dist/esm/testing/state.js.map +1 -0
  69. package/dist/esm/testing/types.d.ts +319 -0
  70. package/dist/esm/testing/types.d.ts.map +1 -0
  71. package/dist/esm/testing/types.js +9 -0
  72. package/dist/esm/testing/types.js.map +1 -0
  73. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  74. package/dist/esm/utils/channel.d.ts +7 -7
  75. package/dist/esm/utils/channel.d.ts.map +1 -1
  76. package/dist/esm/utils/channel.js +1 -1
  77. package/dist/esm/utils/channel.js.map +1 -1
  78. package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
  79. package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
  80. package/dist/esm/utils/promisifyResult.d.ts +1 -1
  81. package/dist/esm/utils/promisifyResult.d.ts.map +1 -1
  82. package/dist/esm/utils/promisifyResult.js.map +1 -1
  83. package/dist/esm/utils/schemaMatches.d.ts +5 -5
  84. package/dist/esm/utils/schemaMatches.d.ts.map +1 -1
  85. package/dist/esm/utils/schemaMatches.js.map +1 -1
  86. package/dist/esm/vitest/index.d.ts +5 -0
  87. package/dist/esm/vitest/index.d.ts.map +1 -0
  88. package/dist/esm/vitest/index.js +15 -0
  89. package/dist/esm/vitest/index.js.map +1 -0
  90. package/dist/esm/vitest/reporter.d.ts +19 -0
  91. package/dist/esm/vitest/reporter.d.ts.map +1 -0
  92. package/dist/esm/vitest/reporter.js +27 -0
  93. package/dist/esm/vitest/reporter.js.map +1 -0
  94. package/dist/src/__generated__/api/v1.d.ts +254 -2
  95. package/dist/src/__generated__/api/v1.d.ts.map +1 -1
  96. package/dist/src/jest/index.d.ts +5 -0
  97. package/dist/src/jest/index.d.ts.map +1 -0
  98. package/dist/src/jest/index.js +58 -0
  99. package/dist/src/jest/index.js.map +1 -0
  100. package/dist/src/jest/reporter.d.ts +13 -0
  101. package/dist/src/jest/reporter.d.ts.map +1 -0
  102. package/dist/src/jest/reporter.js +23 -0
  103. package/dist/src/jest/reporter.js.map +1 -0
  104. package/dist/src/prompts/sdks/toAI.d.ts +2 -2
  105. package/dist/src/prompts/sdks/toAI.d.ts.map +1 -1
  106. package/dist/src/prompts/sdks/toAI.js.map +1 -1
  107. package/dist/src/prompts/sdks/toAnthropic.d.ts +2 -2
  108. package/dist/src/prompts/sdks/toAnthropic.d.ts.map +1 -1
  109. package/dist/src/prompts/sdks/toAnthropic.js.map +1 -1
  110. package/dist/src/prompts/sdks/toOpenAI.d.ts +2 -2
  111. package/dist/src/prompts/sdks/toOpenAI.d.ts.map +1 -1
  112. package/dist/src/prompts/sdks/toOpenAI.js.map +1 -1
  113. package/dist/src/prompts/sdks/toSDK.d.ts +8 -8
  114. package/dist/src/prompts/sdks/toSDK.d.ts.map +1 -1
  115. package/dist/src/prompts/sdks/toSDK.js.map +1 -1
  116. package/dist/src/prompts/sdks/types.d.ts +2 -2
  117. package/dist/src/prompts/sdks/types.d.ts.map +1 -1
  118. package/dist/src/schemas/llm/anthropic/converters.d.ts +8 -8
  119. package/dist/src/schemas/llm/anthropic/messagePartSchemas.d.ts +4 -4
  120. package/dist/src/schemas/llm/anthropic/messageSchemas.d.ts +6 -6
  121. package/dist/src/schemas/llm/constants.d.ts +3 -3
  122. package/dist/src/schemas/llm/converters.d.ts +12 -12
  123. package/dist/src/schemas/llm/openai/converters.d.ts +3 -3
  124. package/dist/src/schemas/llm/schemas.d.ts +2 -2
  125. package/dist/src/testing/acceptance.d.ts +20 -0
  126. package/dist/src/testing/acceptance.d.ts.map +1 -0
  127. package/dist/src/testing/acceptance.js +114 -0
  128. package/dist/src/testing/acceptance.js.map +1 -0
  129. package/dist/src/testing/define-api.d.ts +157 -0
  130. package/dist/src/testing/define-api.d.ts.map +1 -0
  131. package/dist/src/testing/define-api.js +81 -0
  132. package/dist/src/testing/define-api.js.map +1 -0
  133. package/dist/src/testing/helpers.d.ts +55 -0
  134. package/dist/src/testing/helpers.d.ts.map +1 -0
  135. package/dist/src/testing/helpers.js +182 -0
  136. package/dist/src/testing/helpers.js.map +1 -0
  137. package/dist/src/testing/phoenix-test-tracking.d.ts +68 -0
  138. package/dist/src/testing/phoenix-test-tracking.d.ts.map +1 -0
  139. package/dist/src/testing/phoenix-test-tracking.js +530 -0
  140. package/dist/src/testing/phoenix-test-tracking.js.map +1 -0
  141. package/dist/src/testing/report-artifacts.d.ts +45 -0
  142. package/dist/src/testing/report-artifacts.d.ts.map +1 -0
  143. package/dist/src/testing/report-artifacts.js +225 -0
  144. package/dist/src/testing/report-artifacts.js.map +1 -0
  145. package/dist/src/testing/report-run.d.ts +22 -0
  146. package/dist/src/testing/report-run.d.ts.map +1 -0
  147. package/dist/src/testing/report-run.js +47 -0
  148. package/dist/src/testing/report-run.js.map +1 -0
  149. package/dist/src/testing/reporter-format.d.ts +83 -0
  150. package/dist/src/testing/reporter-format.d.ts.map +1 -0
  151. package/dist/src/testing/reporter-format.js +870 -0
  152. package/dist/src/testing/reporter-format.js.map +1 -0
  153. package/dist/src/testing/runner.d.ts +31 -0
  154. package/dist/src/testing/runner.d.ts.map +1 -0
  155. package/dist/src/testing/runner.js +258 -0
  156. package/dist/src/testing/runner.js.map +1 -0
  157. package/dist/src/testing/state.d.ts +138 -0
  158. package/dist/src/testing/state.d.ts.map +1 -0
  159. package/dist/src/testing/state.js +38 -0
  160. package/dist/src/testing/state.js.map +1 -0
  161. package/dist/src/testing/types.d.ts +319 -0
  162. package/dist/src/testing/types.d.ts.map +1 -0
  163. package/dist/src/testing/types.js +13 -0
  164. package/dist/src/testing/types.js.map +1 -0
  165. package/dist/src/utils/channel.d.ts +7 -7
  166. package/dist/src/utils/channel.d.ts.map +1 -1
  167. package/dist/src/utils/channel.js +1 -1
  168. package/dist/src/utils/channel.js.map +1 -1
  169. package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
  170. package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
  171. package/dist/src/utils/promisifyResult.d.ts +1 -1
  172. package/dist/src/utils/promisifyResult.d.ts.map +1 -1
  173. package/dist/src/utils/promisifyResult.js.map +1 -1
  174. package/dist/src/utils/schemaMatches.d.ts +5 -5
  175. package/dist/src/utils/schemaMatches.d.ts.map +1 -1
  176. package/dist/src/utils/schemaMatches.js.map +1 -1
  177. package/dist/src/vitest/index.d.ts +5 -0
  178. package/dist/src/vitest/index.d.ts.map +1 -0
  179. package/dist/src/vitest/index.js +23 -0
  180. package/dist/src/vitest/index.js.map +1 -0
  181. package/dist/src/vitest/reporter.d.ts +19 -0
  182. package/dist/src/vitest/reporter.d.ts.map +1 -0
  183. package/dist/src/vitest/reporter.js +34 -0
  184. package/dist/src/vitest/reporter.js.map +1 -0
  185. package/dist/tsconfig.tsbuildinfo +1 -1
  186. package/docs/ci-evals-annotations.mdx +190 -0
  187. package/docs/ci-evals-jest.mdx +78 -0
  188. package/docs/ci-evals-vitest.mdx +240 -0
  189. package/docs/ci-evals.mdx +263 -0
  190. package/docs/overview.mdx +9 -1
  191. package/package.json +49 -17
  192. package/src/__generated__/api/v1.ts +254 -2
  193. package/src/jest/index.ts +124 -0
  194. package/src/jest/reporter.ts +22 -0
  195. package/src/prompts/sdks/toAI.ts +4 -3
  196. package/src/prompts/sdks/toAnthropic.ts +4 -3
  197. package/src/prompts/sdks/toOpenAI.ts +4 -3
  198. package/src/prompts/sdks/toSDK.ts +16 -11
  199. package/src/prompts/sdks/types.ts +2 -2
  200. package/src/testing/acceptance.ts +190 -0
  201. package/src/testing/define-api.ts +279 -0
  202. package/src/testing/helpers.ts +251 -0
  203. package/src/testing/phoenix-test-tracking.ts +637 -0
  204. package/src/testing/report-artifacts.ts +272 -0
  205. package/src/testing/report-run.ts +44 -0
  206. package/src/testing/reporter-format.ts +1072 -0
  207. package/src/testing/runner.ts +350 -0
  208. package/src/testing/state.ts +165 -0
  209. package/src/testing/types.ts +366 -0
  210. package/src/utils/channel.ts +17 -15
  211. package/src/utils/promisifyResult.ts +6 -4
  212. package/src/utils/schemaMatches.ts +12 -10
  213. package/src/vitest/index.ts +57 -0
  214. package/src/vitest/reporter.ts +32 -0
@@ -388,7 +388,11 @@ export interface paths {
388
388
  delete: operations["deleteExperiment"];
389
389
  options?: never;
390
390
  head?: never;
391
- patch?: never;
391
+ /**
392
+ * Update an experiment by ID
393
+ * @description Partially update an experiment's name, description, and/or metadata. Only the fields included in the request body are changed; omitted fields are left as-is. Patching an ephemeral experiment refreshes its last-update timestamp, which extends the window before it is swept away.
394
+ */
395
+ patch: operations["updateExperiment"];
392
396
  trace?: never;
393
397
  };
394
398
  "/v1/experiments/{experiment_id}/incomplete-runs": {
@@ -1294,6 +1298,23 @@ export interface paths {
1294
1298
  patch?: never;
1295
1299
  trace?: never;
1296
1300
  };
1301
+ "/agents/server/sessions/{session_id}/chat": {
1302
+ parameters: {
1303
+ query?: never;
1304
+ header?: never;
1305
+ path?: never;
1306
+ cookie?: never;
1307
+ };
1308
+ get?: never;
1309
+ put?: never;
1310
+ /** Run Server Agent */
1311
+ post: operations["run_server_agent_agents_server_sessions__session_id__chat_post"];
1312
+ delete?: never;
1313
+ options?: never;
1314
+ head?: never;
1315
+ patch?: never;
1316
+ trace?: never;
1317
+ };
1297
1318
  "/agents/{agent_id}/sessions/{session_id}/chat": {
1298
1319
  parameters: {
1299
1320
  query?: never;
@@ -1610,7 +1631,7 @@ export interface components {
1610
1631
  * ChatContext
1611
1632
  * @description Discriminated union of every UI-state context the agent understands.
1612
1633
  */
1613
- ChatContext: components["schemas"]["AppContext"] | components["schemas"]["ProjectContext"] | components["schemas"]["TraceContext"] | components["schemas"]["AgentSpanContext"] | components["schemas"]["PlaygroundContext"] | components["schemas"]["CodeEvaluatorContext"] | components["schemas"]["LlmEvaluatorContext"] | components["schemas"]["DatasetContext"] | components["schemas"]["GraphQLContext"] | components["schemas"]["WebAccessContext"];
1634
+ ChatContext: components["schemas"]["AppContext"] | components["schemas"]["ProjectContext"] | components["schemas"]["TraceContext"] | components["schemas"]["SessionContext"] | components["schemas"]["PromptContext"] | components["schemas"]["PromptVersionContext"] | components["schemas"]["AgentSpanContext"] | components["schemas"]["PlaygroundContext"] | components["schemas"]["CodeEvaluatorContext"] | components["schemas"]["LlmEvaluatorContext"] | components["schemas"]["DatasetContext"] | components["schemas"]["GraphQLContext"] | components["schemas"]["WebAccessContext"] | components["schemas"]["SubagentsContext"];
1614
1635
  /**
1615
1636
  * ChatRegenerateMessage
1616
1637
  * @description Regenerate message extended with Phoenix-specific fields.
@@ -1637,6 +1658,12 @@ export interface components {
1637
1658
  * @default false
1638
1659
  */
1639
1660
  exportRemoteTraces?: boolean;
1661
+ /**
1662
+ * Attachuserid
1663
+ * @description When true and the request is authenticated as a PhoenixUser, attaches the user's email as the OpenInference ``user.id`` span attribute on all traced work for this request.
1664
+ * @default false
1665
+ */
1666
+ attachUserId?: boolean;
1640
1667
  /** Contexts */
1641
1668
  contexts?: components["schemas"]["ChatContext"][];
1642
1669
  /**
@@ -1684,6 +1711,12 @@ export interface components {
1684
1711
  * @default false
1685
1712
  */
1686
1713
  exportRemoteTraces?: boolean;
1714
+ /**
1715
+ * Attachuserid
1716
+ * @description When true and the request is authenticated as a PhoenixUser, attaches the user's email as the OpenInference ``user.id`` span attribute on all traced work for this request.
1717
+ * @default false
1718
+ */
1719
+ attachUserId?: boolean;
1687
1720
  /** Contexts */
1688
1721
  contexts?: components["schemas"]["ChatContext"][];
1689
1722
  /**
@@ -2355,6 +2388,16 @@ export interface components {
2355
2388
  * @description The ID of the dataset version associated with the experiment
2356
2389
  */
2357
2390
  dataset_version_id: string;
2391
+ /**
2392
+ * Name
2393
+ * @description The name of the experiment
2394
+ */
2395
+ name: string;
2396
+ /**
2397
+ * Description
2398
+ * @description The description of the experiment
2399
+ */
2400
+ description: string | null;
2358
2401
  /**
2359
2402
  * Repetitions
2360
2403
  * @description Number of times the experiment is repeated
@@ -3175,6 +3218,7 @@ export interface components {
3175
3218
  * @default 1
3176
3219
  */
3177
3220
  repetitions?: number;
3221
+ nextExperimentScaffold?: components["schemas"]["PlaygroundExperimentScaffoldContext"] | null;
3178
3222
  /** Instances */
3179
3223
  instances?: components["schemas"]["PlaygroundInstanceContext"][];
3180
3224
  /** Evaluators */
@@ -3219,6 +3263,37 @@ export interface components {
3219
3263
  /** Isapplied */
3220
3264
  isApplied: boolean;
3221
3265
  };
3266
+ /**
3267
+ * PlaygroundExperimentScaffoldContext
3268
+ * @description Experiment name/description/metadata the user has staged for the playground's
3269
+ * *next* dataset-backed run, before that run has started.
3270
+ *
3271
+ * The playground UI lets the user pre-set how the next recorded run's experiment
3272
+ * will be named, described, and tagged (via the ``set_playground_experiment_recording``
3273
+ * tool or the recording form). That staged state is surfaced here so the agent can
3274
+ * see what is already set and avoid re-staging it.
3275
+ *
3276
+ * Field semantics:
3277
+ * - ``name`` / ``description``: the staged values, surfaced to the model verbatim,
3278
+ * or ``None`` when the user has not staged them.
3279
+ * - ``has_metadata``: a presence flag, not the value. Only *whether* metadata has
3280
+ * been staged is model-relevant (so the agent knows not to re-attach it); the
3281
+ * metadata object itself is deliberately kept out of the prompt.
3282
+ *
3283
+ * A field left unstaged (``None`` / ``False``) falls back to the server default when
3284
+ * the run starts. The scaffold is consumed once that next run begins.
3285
+ */
3286
+ PlaygroundExperimentScaffoldContext: {
3287
+ /** Name */
3288
+ name?: string | null;
3289
+ /** Description */
3290
+ description?: string | null;
3291
+ /**
3292
+ * Hasmetadata
3293
+ * @default false
3294
+ */
3295
+ hasMetadata?: boolean;
3296
+ };
3222
3297
  /**
3223
3298
  * PlaygroundInstanceContext
3224
3299
  * @description One mounted playground instance and its current model selection.
@@ -3460,6 +3535,19 @@ export interface components {
3460
3535
  /** Messages */
3461
3536
  messages: components["schemas"]["PromptMessage"][];
3462
3537
  };
3538
+ /**
3539
+ * PromptContext
3540
+ * @description Prompt the user is currently viewing.
3541
+ */
3542
+ PromptContext: {
3543
+ /**
3544
+ * @description discriminator enum property added by openapi-typescript
3545
+ * @enum {string}
3546
+ */
3547
+ type: "prompt";
3548
+ /** Promptnodeid */
3549
+ promptNodeId: string;
3550
+ };
3463
3551
  /** PromptData */
3464
3552
  PromptData: {
3465
3553
  name: components["schemas"]["Identifier"];
@@ -3960,6 +4048,21 @@ export interface components {
3960
4048
  /** Id */
3961
4049
  id: string;
3962
4050
  };
4051
+ /**
4052
+ * PromptVersionContext
4053
+ * @description Prompt version the user is currently viewing.
4054
+ */
4055
+ PromptVersionContext: {
4056
+ /**
4057
+ * @description discriminator enum property added by openapi-typescript
4058
+ * @enum {string}
4059
+ */
4060
+ type: "prompt_version";
4061
+ /** Promptnodeid */
4062
+ promptNodeId: string;
4063
+ /** Promptversionnodeid */
4064
+ promptVersionNodeId: string;
4065
+ };
3963
4066
  /** PromptVersionData */
3964
4067
  PromptVersionData: {
3965
4068
  /** Description */
@@ -4161,6 +4264,21 @@ export interface components {
4161
4264
  /** Next Cursor */
4162
4265
  next_cursor: string | null;
4163
4266
  };
4267
+ /**
4268
+ * SessionContext
4269
+ * @description Session the user is currently viewing.
4270
+ */
4271
+ SessionContext: {
4272
+ /**
4273
+ * @description discriminator enum property added by openapi-typescript
4274
+ * @enum {string}
4275
+ */
4276
+ type: "session";
4277
+ /** Projectnodeid */
4278
+ projectNodeId: string;
4279
+ /** Sessionnodeid */
4280
+ sessionNodeId: string;
4281
+ };
4164
4282
  /** SessionData */
4165
4283
  SessionData: {
4166
4284
  /** Id */
@@ -4587,6 +4705,19 @@ export interface components {
4587
4705
  */
4588
4706
  type?: "step-start";
4589
4707
  };
4708
+ /**
4709
+ * SubagentsContext
4710
+ * @description User's per-turn request to expose the subagent-spawning tool.
4711
+ */
4712
+ SubagentsContext: {
4713
+ /**
4714
+ * @description discriminator enum property added by openapi-typescript
4715
+ * @enum {string}
4716
+ */
4717
+ type: "subagents";
4718
+ /** Enabled */
4719
+ enabled: boolean;
4720
+ };
4590
4721
  /** TextContentPart */
4591
4722
  TextContentPart: {
4592
4723
  /**
@@ -5106,6 +5237,33 @@ export interface components {
5106
5237
  /** Data */
5107
5238
  data: components["schemas"]["CategoricalAnnotationConfig"] | components["schemas"]["ContinuousAnnotationConfig"] | components["schemas"]["FreeformAnnotationConfig"];
5108
5239
  };
5240
+ /**
5241
+ * UpdateExperimentRequestBody
5242
+ * @description Fields to update on an experiment. Omit a field to leave it unchanged.
5243
+ */
5244
+ UpdateExperimentRequestBody: {
5245
+ /**
5246
+ * Name
5247
+ * @description New name for the experiment (null is rejected; name is required)
5248
+ */
5249
+ name?: string | null;
5250
+ /**
5251
+ * Description
5252
+ * @description New description for the experiment (null clears the description)
5253
+ */
5254
+ description?: string | null;
5255
+ /**
5256
+ * Metadata
5257
+ * @description New metadata object for the experiment (replaces the existing metadata as a whole; null is rejected)
5258
+ */
5259
+ metadata?: {
5260
+ [key: string]: unknown;
5261
+ } | null;
5262
+ };
5263
+ /** UpdateExperimentResponseBody */
5264
+ UpdateExperimentResponseBody: {
5265
+ data: components["schemas"]["Experiment"];
5266
+ };
5109
5267
  /** UpdateProjectRequestBody */
5110
5268
  UpdateProjectRequestBody: {
5111
5269
  /** Description */
@@ -5256,6 +5414,12 @@ export interface components {
5256
5414
  * @default false
5257
5415
  */
5258
5416
  exportRemoteTraces?: boolean;
5417
+ /**
5418
+ * Attachuserid
5419
+ * @description When true and the request is authenticated as a PhoenixUser, attaches the user's email as the OpenInference ``user.id`` span attribute on all traced work for this request.
5420
+ * @default false
5421
+ */
5422
+ attachUserId?: boolean;
5259
5423
  /** Messages */
5260
5424
  messages: components["schemas"]["UIMessage"][];
5261
5425
  /** Model */
@@ -6578,6 +6742,59 @@ export interface operations {
6578
6742
  };
6579
6743
  };
6580
6744
  };
6745
+ updateExperiment: {
6746
+ parameters: {
6747
+ query?: never;
6748
+ header?: never;
6749
+ path: {
6750
+ experiment_id: string;
6751
+ };
6752
+ cookie?: never;
6753
+ };
6754
+ requestBody: {
6755
+ content: {
6756
+ "application/json": components["schemas"]["UpdateExperimentRequestBody"];
6757
+ };
6758
+ };
6759
+ responses: {
6760
+ /** @description Experiment updated successfully */
6761
+ 200: {
6762
+ headers: {
6763
+ [name: string]: unknown;
6764
+ };
6765
+ content: {
6766
+ "application/json": components["schemas"]["UpdateExperimentResponseBody"];
6767
+ };
6768
+ };
6769
+ /** @description Forbidden */
6770
+ 403: {
6771
+ headers: {
6772
+ [name: string]: unknown;
6773
+ };
6774
+ content: {
6775
+ "text/plain": string;
6776
+ };
6777
+ };
6778
+ /** @description Experiment not found */
6779
+ 404: {
6780
+ headers: {
6781
+ [name: string]: unknown;
6782
+ };
6783
+ content: {
6784
+ "text/plain": string;
6785
+ };
6786
+ };
6787
+ /** @description Invalid experiment ID or request body */
6788
+ 422: {
6789
+ headers: {
6790
+ [name: string]: unknown;
6791
+ };
6792
+ content: {
6793
+ "text/plain": string;
6794
+ };
6795
+ };
6796
+ };
6797
+ };
6581
6798
  getIncompleteExperimentRuns: {
6582
6799
  parameters: {
6583
6800
  query?: {
@@ -9088,6 +9305,41 @@ export interface operations {
9088
9305
  };
9089
9306
  };
9090
9307
  };
9308
+ run_server_agent_agents_server_sessions__session_id__chat_post: {
9309
+ parameters: {
9310
+ query?: never;
9311
+ header?: never;
9312
+ path: {
9313
+ session_id: string;
9314
+ };
9315
+ cookie?: never;
9316
+ };
9317
+ requestBody: {
9318
+ content: {
9319
+ "application/json": components["schemas"]["ChatRequest"];
9320
+ };
9321
+ };
9322
+ responses: {
9323
+ /** @description Successful Response */
9324
+ 200: {
9325
+ headers: {
9326
+ [name: string]: unknown;
9327
+ };
9328
+ content: {
9329
+ "application/json": unknown;
9330
+ };
9331
+ };
9332
+ /** @description Validation Error */
9333
+ 422: {
9334
+ headers: {
9335
+ [name: string]: unknown;
9336
+ };
9337
+ content: {
9338
+ "application/json": components["schemas"]["HTTPValidationError"];
9339
+ };
9340
+ };
9341
+ };
9342
+ };
9091
9343
  chat_agents__agent_id__sessions__session_id__chat_post: {
9092
9344
  parameters: {
9093
9345
  query?: never;
@@ -0,0 +1,124 @@
1
+ import { createTestApi } from "../testing/define-api";
2
+ import type { RunnerHooks } from "../testing/runner";
3
+
4
+ export type {
5
+ PhoenixDescribe,
6
+ PhoenixTest,
7
+ PhoenixTestApi,
8
+ PhoenixTestEach,
9
+ } from "../testing/define-api";
10
+
11
+ export type {
12
+ AcceptanceCriterion,
13
+ AcceptanceMetric,
14
+ AcceptanceResult,
15
+ Annotation,
16
+ AnnotatorKind,
17
+ EvaluationParams,
18
+ EvaluationResult,
19
+ Evaluator,
20
+ EvaluatorResult,
21
+ KVMap,
22
+ ReferenceOutput,
23
+ SuiteConfig,
24
+ TestArgs,
25
+ TestConfig,
26
+ TestEachRow,
27
+ TestFn,
28
+ TestParams,
29
+ TestParamsBase,
30
+ } from "../testing/types";
31
+
32
+ export {
33
+ evaluate,
34
+ logAnnotation,
35
+ logOutput,
36
+ traceEvaluator,
37
+ } from "../testing/helpers";
38
+
39
+ /**
40
+ * Resolve jest globals lazily. Jest injects `describe`, `test`, `it`,
41
+ * `beforeAll`, `afterAll` onto the global object during test runs; we read
42
+ * them off `globalThis` so importing this module outside of a jest run
43
+ * doesn't error.
44
+ */
45
+ function getJestGlobals(): {
46
+ describe: JestDescribe;
47
+ test: JestTest;
48
+ beforeAll: (fn: () => unknown | Promise<unknown>) => void;
49
+ afterAll: (fn: () => unknown | Promise<unknown>) => void;
50
+ } {
51
+ const g = globalThis as unknown as {
52
+ describe?: JestDescribe;
53
+ test?: JestTest;
54
+ it?: JestTest;
55
+ beforeAll?: (fn: () => unknown | Promise<unknown>) => void;
56
+ afterAll?: (fn: () => unknown | Promise<unknown>) => void;
57
+ };
58
+ if (!g.describe || !g.beforeAll || !g.afterAll) {
59
+ throw new Error(
60
+ "@arizeai/phoenix-client/jest could not find Jest globals. Make sure this module " +
61
+ "is imported from inside a Jest test file."
62
+ );
63
+ }
64
+ const test = g.test ?? g.it;
65
+ if (!test) {
66
+ throw new Error(
67
+ "@arizeai/phoenix-client/jest could not find Jest's test/it."
68
+ );
69
+ }
70
+ return {
71
+ describe: g.describe,
72
+ test,
73
+ beforeAll: g.beforeAll,
74
+ afterAll: g.afterAll,
75
+ };
76
+ }
77
+
78
+ interface JestDescribe {
79
+ (name: string, fn: () => void): void;
80
+ only: (name: string, fn: () => void) => void;
81
+ skip: (name: string, fn: () => void) => void;
82
+ }
83
+
84
+ interface JestTest {
85
+ (
86
+ name: string,
87
+ fn: (...args: unknown[]) => unknown | Promise<unknown>,
88
+ timeout?: number
89
+ ): void;
90
+ only: (
91
+ name: string,
92
+ fn: (...args: unknown[]) => unknown | Promise<unknown>,
93
+ timeout?: number
94
+ ) => void;
95
+ skip: (
96
+ name: string,
97
+ fn: (...args: unknown[]) => unknown | Promise<unknown>,
98
+ timeout?: number
99
+ ) => void;
100
+ }
101
+
102
+ /**
103
+ * Build the runner hooks from the (lazily-resolved) jest globals. Memoized so
104
+ * repeated declarations don't re-read `globalThis` on every call; jest injects
105
+ * its globals once per worker before any test file is evaluated.
106
+ */
107
+ let cachedHooks: RunnerHooks | undefined;
108
+ function getHooks(): RunnerHooks {
109
+ if (cachedHooks) return cachedHooks;
110
+ const g = getJestGlobals();
111
+ cachedHooks = {
112
+ describe: (name, fn) => g.describe(name, fn),
113
+ describeOnly: (name, fn) => g.describe.only(name, fn),
114
+ describeSkip: (name, fn) => g.describe.skip(name, fn),
115
+ test: (name, fn, timeout) => g.test(name, fn, timeout),
116
+ testOnly: (name, fn, timeout) => g.test.only(name, fn, timeout),
117
+ testSkip: (name, fn, timeout) => g.test.skip(name, fn, timeout),
118
+ beforeAll: (fn) => g.beforeAll(fn),
119
+ afterAll: (fn) => g.afterAll(fn),
120
+ };
121
+ return cachedHooks;
122
+ }
123
+
124
+ export const { describe, test, it } = createTestApi(getHooks);
@@ -0,0 +1,22 @@
1
+ import { SuiteSummaryReportRun } from "../testing/report-run";
2
+
3
+ /**
4
+ * Jest reporter for `@arizeai/phoenix-client/jest`.
5
+ *
6
+ * Like the Vitest reporter, this does not replace Jest's default output. It
7
+ * appends a Phoenix summary block at the end of the run.
8
+ */
9
+ export default class PhoenixJestReporter {
10
+ private readonly report = new SuiteSummaryReportRun();
11
+
12
+ // jest passes globalConfig + reporterOptions; we ignore both
13
+ constructor(_globalConfig?: unknown, _reporterOptions?: unknown) {}
14
+
15
+ onRunStart(): void {
16
+ this.report.begin();
17
+ }
18
+
19
+ onRunComplete(): void {
20
+ this.report.finish();
21
+ }
22
+ }
@@ -40,7 +40,8 @@ The tool choice strategy. Default: 'auto'.
40
40
  toolChoice?: ToolChoice<ToolSet>;
41
41
  };
42
42
 
43
- export type ToAIParams<V extends Variables> = toSDKParamsBase<V>;
43
+ export type ToAIParams<PromptVariables extends Variables> =
44
+ toSDKParamsBase<PromptVariables>;
44
45
 
45
46
  /**
46
47
  * Converts a Phoenix prompt to Vercel AI sdk params.
@@ -48,10 +49,10 @@ export type ToAIParams<V extends Variables> = toSDKParamsBase<V>;
48
49
  * - note: To use response format, you must pass `prompt.response_format.json_schema.schema` to generateObject or streamObject
49
50
  * via `jsonSchema()`, through the `schema` argument.
50
51
  */
51
- export const toAI = <V extends Variables>({
52
+ export const toAI = <PromptVariables extends Variables>({
52
53
  prompt,
53
54
  variables,
54
- }: ToAIParams<V>): PartialAIParams | null => {
55
+ }: ToAIParams<PromptVariables>): PartialAIParams | null => {
55
56
  // eslint-disable-next-line no-console
56
57
  console.warn(
57
58
  "Prompt invocation parameters not currently supported in AI SDK, falling back to default invocation parameters"
@@ -14,15 +14,16 @@ import type { toSDKParamsBase, Variables } from "./types";
14
14
  // We must re-export these types so that they are included in the phoenix-client distribution
15
15
  export type { MessageCreateParams };
16
16
 
17
- export type ToAnthropicParams<V extends Variables> = toSDKParamsBase<V>;
17
+ export type ToAnthropicParams<PromptVariables extends Variables> =
18
+ toSDKParamsBase<PromptVariables>;
18
19
 
19
20
  /**
20
21
  * Convert a Phoenix prompt to Anthropic client sdk's message create parameters
21
22
  */
22
- export const toAnthropic = <V extends Variables = Variables>({
23
+ export const toAnthropic = <PromptVariables extends Variables = Variables>({
23
24
  prompt,
24
25
  variables,
25
- }: ToAnthropicParams<V>): MessageCreateParams | null => {
26
+ }: ToAnthropicParams<PromptVariables>): MessageCreateParams | null => {
26
27
  try {
27
28
  let invocationParameters: { max_tokens: number } | undefined;
28
29
  if (prompt.invocation_parameters.type === "anthropic") {
@@ -23,17 +23,18 @@ export type {
23
23
  ResponseFormatJSONSchema,
24
24
  };
25
25
 
26
- export type ToOpenAIParams<V extends Variables> = toSDKParamsBase<V>;
26
+ export type ToOpenAIParams<PromptVariables extends Variables> =
27
+ toSDKParamsBase<PromptVariables>;
27
28
 
28
29
  /**
29
30
  * Convert a Phoenix prompt to OpenAI client sdk's chat completion parameters
30
31
  *
31
32
  * @returns The converted chat completion parameters
32
33
  */
33
- export const toOpenAI = <V extends Variables = Variables>({
34
+ export const toOpenAI = <PromptVariables extends Variables = Variables>({
34
35
  prompt,
35
36
  variables,
36
- }: ToOpenAIParams<V>): ChatCompletionCreateParams | null => {
37
+ }: ToOpenAIParams<PromptVariables>): ChatCompletionCreateParams | null => {
37
38
  try {
38
39
  let invocationParameters: Partial<ChatCompletionCreateParams>;
39
40
  switch (prompt.invocation_parameters.type) {
@@ -15,10 +15,10 @@ import type { SupportedSDK, toSDKParamsBase, Variables } from "./types";
15
15
  * toOpenAI(params)
16
16
  * ```
17
17
  */
18
- export type SDKParams<T extends SupportedSDK> = Parameters<
19
- (typeof PROVIDER_TO_SDK)[T]
18
+ export type SDKParams<SDK extends SupportedSDK> = Parameters<
19
+ (typeof PROVIDER_TO_SDK)[SDK]
20
20
  >[number] extends toSDKParamsBase
21
- ? Parameters<(typeof PROVIDER_TO_SDK)[T]>[number]
21
+ ? Parameters<(typeof PROVIDER_TO_SDK)[SDK]>[number]
22
22
  : never;
23
23
 
24
24
  /**
@@ -33,7 +33,7 @@ export const PROVIDER_TO_SDK = {
33
33
  /**
34
34
  * Get the conversion function for a specific SDK name
35
35
  */
36
- const getTargetSDK = <T extends SupportedSDK>(sdk: T) => {
36
+ const getTargetSDK = <SDK extends SupportedSDK>(sdk: SDK) => {
37
37
  switch (sdk) {
38
38
  case "openai":
39
39
  return PROVIDER_TO_SDK.openai;
@@ -50,19 +50,19 @@ const getTargetSDK = <T extends SupportedSDK>(sdk: T) => {
50
50
  * Parameters specific to the toSDK function
51
51
  */
52
52
  export type ToSDKParams<
53
- T extends SupportedSDK,
54
- V extends Variables = Variables,
53
+ SDK extends SupportedSDK,
54
+ PromptVariables extends Variables = Variables,
55
55
  > = {
56
56
  /**
57
57
  * String representing the SDK to convert to
58
58
  */
59
- sdk: T;
59
+ sdk: SDK;
60
60
  /**
61
61
  * Optional variables to format the prompt with
62
62
  * Keys are the variable names, values are the variable values
63
63
  * The variable format is determined via prompt.template_format
64
64
  */
65
- variables?: V;
65
+ variables?: PromptVariables;
66
66
  };
67
67
 
68
68
  /**
@@ -86,11 +86,16 @@ export type ToSDKParams<
86
86
  * @param params - The parameters to convert a prompt to an SDK's parameters
87
87
  * @returns The SDK's parameters
88
88
  */
89
- export const toSDK = <T extends SupportedSDK, V extends Variables = Variables>({
89
+ export const toSDK = <
90
+ SDK extends SupportedSDK,
91
+ PromptVariables extends Variables = Variables,
92
+ >({
90
93
  sdk: _sdk,
91
94
  ...rest
92
- }: ToSDKParams<T, V> & SDKParams<T>) => {
95
+ }: ToSDKParams<SDK, PromptVariables> & SDKParams<SDK>) => {
93
96
  const sdk = getTargetSDK(_sdk);
94
97
  invariant(sdk, `No SDK found for provider ${_sdk}`);
95
- return sdk<V>(rest) as ReturnType<(typeof PROVIDER_TO_SDK)[T]>;
98
+ return sdk<PromptVariables>(rest) as ReturnType<
99
+ (typeof PROVIDER_TO_SDK)[SDK]
100
+ >;
96
101
  };
@@ -11,7 +11,7 @@ export type Variables = Record<string, string | { toString: () => string }>;
11
11
  /**
12
12
  * Base parameters for an SDK conversion function
13
13
  */
14
- export type toSDKParamsBase<V extends Variables = Variables> = {
14
+ export type toSDKParamsBase<PromptVariables extends Variables = Variables> = {
15
15
  /**
16
16
  * The Phoenix prompt to convert
17
17
  */
@@ -19,7 +19,7 @@ export type toSDKParamsBase<V extends Variables = Variables> = {
19
19
  /**
20
20
  * The variables to use in the prompt
21
21
  */
22
- variables?: V;
22
+ variables?: PromptVariables;
23
23
  };
24
24
 
25
25
  /**