@arizeai/phoenix-client 6.10.1 → 6.11.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.
- package/README.md +62 -0
- package/dist/esm/__generated__/api/v1.d.ts +202 -2
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/jest/index.d.ts +5 -0
- package/dist/esm/jest/index.d.ts.map +1 -0
- package/dist/esm/jest/index.js +49 -0
- package/dist/esm/jest/index.js.map +1 -0
- package/dist/esm/jest/reporter.d.ts +13 -0
- package/dist/esm/jest/reporter.d.ts.map +1 -0
- package/dist/esm/jest/reporter.js +19 -0
- package/dist/esm/jest/reporter.js.map +1 -0
- package/dist/esm/prompts/sdks/toAI.d.ts +2 -2
- package/dist/esm/prompts/sdks/toAI.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toAI.js.map +1 -1
- package/dist/esm/prompts/sdks/toAnthropic.d.ts +2 -2
- package/dist/esm/prompts/sdks/toAnthropic.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toAnthropic.js.map +1 -1
- package/dist/esm/prompts/sdks/toOpenAI.d.ts +2 -2
- package/dist/esm/prompts/sdks/toOpenAI.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toOpenAI.js.map +1 -1
- package/dist/esm/prompts/sdks/toSDK.d.ts +8 -8
- package/dist/esm/prompts/sdks/toSDK.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toSDK.js.map +1 -1
- package/dist/esm/prompts/sdks/types.d.ts +2 -2
- package/dist/esm/prompts/sdks/types.d.ts.map +1 -1
- package/dist/esm/schemas/llm/anthropic/converters.d.ts +8 -8
- package/dist/esm/schemas/llm/anthropic/messagePartSchemas.d.ts +4 -4
- package/dist/esm/schemas/llm/anthropic/messageSchemas.d.ts +6 -6
- package/dist/esm/schemas/llm/constants.d.ts +3 -3
- package/dist/esm/schemas/llm/converters.d.ts +12 -12
- package/dist/esm/schemas/llm/openai/converters.d.ts +3 -3
- package/dist/esm/schemas/llm/schemas.d.ts +2 -2
- package/dist/esm/testing/acceptance.d.ts +20 -0
- package/dist/esm/testing/acceptance.d.ts.map +1 -0
- package/dist/esm/testing/acceptance.js +129 -0
- package/dist/esm/testing/acceptance.js.map +1 -0
- package/dist/esm/testing/define-api.d.ts +157 -0
- package/dist/esm/testing/define-api.d.ts.map +1 -0
- package/dist/esm/testing/define-api.js +78 -0
- package/dist/esm/testing/define-api.js.map +1 -0
- package/dist/esm/testing/helpers.d.ts +55 -0
- package/dist/esm/testing/helpers.d.ts.map +1 -0
- package/dist/esm/testing/helpers.js +179 -0
- package/dist/esm/testing/helpers.js.map +1 -0
- package/dist/esm/testing/phoenix-test-tracking.d.ts +68 -0
- package/dist/esm/testing/phoenix-test-tracking.d.ts.map +1 -0
- package/dist/esm/testing/phoenix-test-tracking.js +521 -0
- package/dist/esm/testing/phoenix-test-tracking.js.map +1 -0
- package/dist/esm/testing/report-artifacts.d.ts +45 -0
- package/dist/esm/testing/report-artifacts.d.ts.map +1 -0
- package/dist/esm/testing/report-artifacts.js +218 -0
- package/dist/esm/testing/report-artifacts.js.map +1 -0
- package/dist/esm/testing/report-run.d.ts +22 -0
- package/dist/esm/testing/report-run.d.ts.map +1 -0
- package/dist/esm/testing/report-run.js +41 -0
- package/dist/esm/testing/report-run.js.map +1 -0
- package/dist/esm/testing/reporter-format.d.ts +83 -0
- package/dist/esm/testing/reporter-format.d.ts.map +1 -0
- package/dist/esm/testing/reporter-format.js +852 -0
- package/dist/esm/testing/reporter-format.js.map +1 -0
- package/dist/esm/testing/runner.d.ts +31 -0
- package/dist/esm/testing/runner.d.ts.map +1 -0
- package/dist/esm/testing/runner.js +238 -0
- package/dist/esm/testing/runner.js.map +1 -0
- package/dist/esm/testing/state.d.ts +138 -0
- package/dist/esm/testing/state.d.ts.map +1 -0
- package/dist/esm/testing/state.js +31 -0
- package/dist/esm/testing/state.js.map +1 -0
- package/dist/esm/testing/types.d.ts +319 -0
- package/dist/esm/testing/types.d.ts.map +1 -0
- package/dist/esm/testing/types.js +9 -0
- package/dist/esm/testing/types.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/channel.d.ts +7 -7
- package/dist/esm/utils/channel.d.ts.map +1 -1
- package/dist/esm/utils/channel.js +1 -1
- package/dist/esm/utils/channel.js.map +1 -1
- package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/esm/utils/promisifyResult.d.ts +1 -1
- package/dist/esm/utils/promisifyResult.d.ts.map +1 -1
- package/dist/esm/utils/promisifyResult.js.map +1 -1
- package/dist/esm/utils/schemaMatches.d.ts +5 -5
- package/dist/esm/utils/schemaMatches.d.ts.map +1 -1
- package/dist/esm/utils/schemaMatches.js.map +1 -1
- package/dist/esm/vitest/index.d.ts +5 -0
- package/dist/esm/vitest/index.d.ts.map +1 -0
- package/dist/esm/vitest/index.js +15 -0
- package/dist/esm/vitest/index.js.map +1 -0
- package/dist/esm/vitest/reporter.d.ts +19 -0
- package/dist/esm/vitest/reporter.d.ts.map +1 -0
- package/dist/esm/vitest/reporter.js +27 -0
- package/dist/esm/vitest/reporter.js.map +1 -0
- package/dist/src/__generated__/api/v1.d.ts +202 -2
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/jest/index.d.ts +5 -0
- package/dist/src/jest/index.d.ts.map +1 -0
- package/dist/src/jest/index.js +58 -0
- package/dist/src/jest/index.js.map +1 -0
- package/dist/src/jest/reporter.d.ts +13 -0
- package/dist/src/jest/reporter.d.ts.map +1 -0
- package/dist/src/jest/reporter.js +23 -0
- package/dist/src/jest/reporter.js.map +1 -0
- package/dist/src/prompts/sdks/toAI.d.ts +2 -2
- package/dist/src/prompts/sdks/toAI.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toAI.js.map +1 -1
- package/dist/src/prompts/sdks/toAnthropic.d.ts +2 -2
- package/dist/src/prompts/sdks/toAnthropic.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toAnthropic.js.map +1 -1
- package/dist/src/prompts/sdks/toOpenAI.d.ts +2 -2
- package/dist/src/prompts/sdks/toOpenAI.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toOpenAI.js.map +1 -1
- package/dist/src/prompts/sdks/toSDK.d.ts +8 -8
- package/dist/src/prompts/sdks/toSDK.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toSDK.js.map +1 -1
- package/dist/src/prompts/sdks/types.d.ts +2 -2
- package/dist/src/prompts/sdks/types.d.ts.map +1 -1
- package/dist/src/schemas/llm/anthropic/converters.d.ts +8 -8
- package/dist/src/schemas/llm/anthropic/messagePartSchemas.d.ts +4 -4
- package/dist/src/schemas/llm/anthropic/messageSchemas.d.ts +6 -6
- package/dist/src/schemas/llm/constants.d.ts +3 -3
- package/dist/src/schemas/llm/converters.d.ts +12 -12
- package/dist/src/schemas/llm/openai/converters.d.ts +3 -3
- package/dist/src/schemas/llm/schemas.d.ts +2 -2
- package/dist/src/testing/acceptance.d.ts +20 -0
- package/dist/src/testing/acceptance.d.ts.map +1 -0
- package/dist/src/testing/acceptance.js +114 -0
- package/dist/src/testing/acceptance.js.map +1 -0
- package/dist/src/testing/define-api.d.ts +157 -0
- package/dist/src/testing/define-api.d.ts.map +1 -0
- package/dist/src/testing/define-api.js +81 -0
- package/dist/src/testing/define-api.js.map +1 -0
- package/dist/src/testing/helpers.d.ts +55 -0
- package/dist/src/testing/helpers.d.ts.map +1 -0
- package/dist/src/testing/helpers.js +182 -0
- package/dist/src/testing/helpers.js.map +1 -0
- package/dist/src/testing/phoenix-test-tracking.d.ts +68 -0
- package/dist/src/testing/phoenix-test-tracking.d.ts.map +1 -0
- package/dist/src/testing/phoenix-test-tracking.js +530 -0
- package/dist/src/testing/phoenix-test-tracking.js.map +1 -0
- package/dist/src/testing/report-artifacts.d.ts +45 -0
- package/dist/src/testing/report-artifacts.d.ts.map +1 -0
- package/dist/src/testing/report-artifacts.js +225 -0
- package/dist/src/testing/report-artifacts.js.map +1 -0
- package/dist/src/testing/report-run.d.ts +22 -0
- package/dist/src/testing/report-run.d.ts.map +1 -0
- package/dist/src/testing/report-run.js +47 -0
- package/dist/src/testing/report-run.js.map +1 -0
- package/dist/src/testing/reporter-format.d.ts +83 -0
- package/dist/src/testing/reporter-format.d.ts.map +1 -0
- package/dist/src/testing/reporter-format.js +870 -0
- package/dist/src/testing/reporter-format.js.map +1 -0
- package/dist/src/testing/runner.d.ts +31 -0
- package/dist/src/testing/runner.d.ts.map +1 -0
- package/dist/src/testing/runner.js +258 -0
- package/dist/src/testing/runner.js.map +1 -0
- package/dist/src/testing/state.d.ts +138 -0
- package/dist/src/testing/state.d.ts.map +1 -0
- package/dist/src/testing/state.js +38 -0
- package/dist/src/testing/state.js.map +1 -0
- package/dist/src/testing/types.d.ts +319 -0
- package/dist/src/testing/types.d.ts.map +1 -0
- package/dist/src/testing/types.js +13 -0
- package/dist/src/testing/types.js.map +1 -0
- package/dist/src/utils/channel.d.ts +7 -7
- package/dist/src/utils/channel.d.ts.map +1 -1
- package/dist/src/utils/channel.js +1 -1
- package/dist/src/utils/channel.js.map +1 -1
- package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/src/utils/promisifyResult.d.ts +1 -1
- package/dist/src/utils/promisifyResult.d.ts.map +1 -1
- package/dist/src/utils/promisifyResult.js.map +1 -1
- package/dist/src/utils/schemaMatches.d.ts +5 -5
- package/dist/src/utils/schemaMatches.d.ts.map +1 -1
- package/dist/src/utils/schemaMatches.js.map +1 -1
- package/dist/src/vitest/index.d.ts +5 -0
- package/dist/src/vitest/index.d.ts.map +1 -0
- package/dist/src/vitest/index.js +23 -0
- package/dist/src/vitest/index.js.map +1 -0
- package/dist/src/vitest/reporter.d.ts +19 -0
- package/dist/src/vitest/reporter.d.ts.map +1 -0
- package/dist/src/vitest/reporter.js +34 -0
- package/dist/src/vitest/reporter.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/ci-evals-annotations.mdx +190 -0
- package/docs/ci-evals-jest.mdx +78 -0
- package/docs/ci-evals-vitest.mdx +240 -0
- package/docs/ci-evals.mdx +263 -0
- package/docs/overview.mdx +9 -1
- package/package.json +49 -17
- package/src/__generated__/api/v1.ts +202 -2
- package/src/jest/index.ts +124 -0
- package/src/jest/reporter.ts +22 -0
- package/src/prompts/sdks/toAI.ts +4 -3
- package/src/prompts/sdks/toAnthropic.ts +4 -3
- package/src/prompts/sdks/toOpenAI.ts +4 -3
- package/src/prompts/sdks/toSDK.ts +16 -11
- package/src/prompts/sdks/types.ts +2 -2
- package/src/testing/acceptance.ts +190 -0
- package/src/testing/define-api.ts +279 -0
- package/src/testing/helpers.ts +251 -0
- package/src/testing/phoenix-test-tracking.ts +637 -0
- package/src/testing/report-artifacts.ts +272 -0
- package/src/testing/report-run.ts +44 -0
- package/src/testing/reporter-format.ts +1072 -0
- package/src/testing/runner.ts +350 -0
- package/src/testing/state.ts +165 -0
- package/src/testing/types.ts +366 -0
- package/src/utils/channel.ts +17 -15
- package/src/utils/promisifyResult.ts +6 -4
- package/src/utils/schemaMatches.ts +12 -10
- package/src/vitest/index.ts +57 -0
- 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
|
-
|
|
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": {
|
|
@@ -1610,7 +1614,7 @@ export interface components {
|
|
|
1610
1614
|
* ChatContext
|
|
1611
1615
|
* @description Discriminated union of every UI-state context the agent understands.
|
|
1612
1616
|
*/
|
|
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"];
|
|
1617
|
+
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
1618
|
/**
|
|
1615
1619
|
* ChatRegenerateMessage
|
|
1616
1620
|
* @description Regenerate message extended with Phoenix-specific fields.
|
|
@@ -1637,6 +1641,12 @@ export interface components {
|
|
|
1637
1641
|
* @default false
|
|
1638
1642
|
*/
|
|
1639
1643
|
exportRemoteTraces?: boolean;
|
|
1644
|
+
/**
|
|
1645
|
+
* Attachuserid
|
|
1646
|
+
* @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.
|
|
1647
|
+
* @default false
|
|
1648
|
+
*/
|
|
1649
|
+
attachUserId?: boolean;
|
|
1640
1650
|
/** Contexts */
|
|
1641
1651
|
contexts?: components["schemas"]["ChatContext"][];
|
|
1642
1652
|
/**
|
|
@@ -1684,6 +1694,12 @@ export interface components {
|
|
|
1684
1694
|
* @default false
|
|
1685
1695
|
*/
|
|
1686
1696
|
exportRemoteTraces?: boolean;
|
|
1697
|
+
/**
|
|
1698
|
+
* Attachuserid
|
|
1699
|
+
* @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.
|
|
1700
|
+
* @default false
|
|
1701
|
+
*/
|
|
1702
|
+
attachUserId?: boolean;
|
|
1687
1703
|
/** Contexts */
|
|
1688
1704
|
contexts?: components["schemas"]["ChatContext"][];
|
|
1689
1705
|
/**
|
|
@@ -2355,6 +2371,16 @@ export interface components {
|
|
|
2355
2371
|
* @description The ID of the dataset version associated with the experiment
|
|
2356
2372
|
*/
|
|
2357
2373
|
dataset_version_id: string;
|
|
2374
|
+
/**
|
|
2375
|
+
* Name
|
|
2376
|
+
* @description The name of the experiment
|
|
2377
|
+
*/
|
|
2378
|
+
name: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* Description
|
|
2381
|
+
* @description The description of the experiment
|
|
2382
|
+
*/
|
|
2383
|
+
description: string | null;
|
|
2358
2384
|
/**
|
|
2359
2385
|
* Repetitions
|
|
2360
2386
|
* @description Number of times the experiment is repeated
|
|
@@ -3175,6 +3201,7 @@ export interface components {
|
|
|
3175
3201
|
* @default 1
|
|
3176
3202
|
*/
|
|
3177
3203
|
repetitions?: number;
|
|
3204
|
+
nextExperimentScaffold?: components["schemas"]["PlaygroundExperimentScaffoldContext"] | null;
|
|
3178
3205
|
/** Instances */
|
|
3179
3206
|
instances?: components["schemas"]["PlaygroundInstanceContext"][];
|
|
3180
3207
|
/** Evaluators */
|
|
@@ -3219,6 +3246,37 @@ export interface components {
|
|
|
3219
3246
|
/** Isapplied */
|
|
3220
3247
|
isApplied: boolean;
|
|
3221
3248
|
};
|
|
3249
|
+
/**
|
|
3250
|
+
* PlaygroundExperimentScaffoldContext
|
|
3251
|
+
* @description Experiment name/description/metadata the user has staged for the playground's
|
|
3252
|
+
* *next* dataset-backed run, before that run has started.
|
|
3253
|
+
*
|
|
3254
|
+
* The playground UI lets the user pre-set how the next recorded run's experiment
|
|
3255
|
+
* will be named, described, and tagged (via the ``set_playground_experiment_recording``
|
|
3256
|
+
* tool or the recording form). That staged state is surfaced here so the agent can
|
|
3257
|
+
* see what is already set and avoid re-staging it.
|
|
3258
|
+
*
|
|
3259
|
+
* Field semantics:
|
|
3260
|
+
* - ``name`` / ``description``: the staged values, surfaced to the model verbatim,
|
|
3261
|
+
* or ``None`` when the user has not staged them.
|
|
3262
|
+
* - ``has_metadata``: a presence flag, not the value. Only *whether* metadata has
|
|
3263
|
+
* been staged is model-relevant (so the agent knows not to re-attach it); the
|
|
3264
|
+
* metadata object itself is deliberately kept out of the prompt.
|
|
3265
|
+
*
|
|
3266
|
+
* A field left unstaged (``None`` / ``False``) falls back to the server default when
|
|
3267
|
+
* the run starts. The scaffold is consumed once that next run begins.
|
|
3268
|
+
*/
|
|
3269
|
+
PlaygroundExperimentScaffoldContext: {
|
|
3270
|
+
/** Name */
|
|
3271
|
+
name?: string | null;
|
|
3272
|
+
/** Description */
|
|
3273
|
+
description?: string | null;
|
|
3274
|
+
/**
|
|
3275
|
+
* Hasmetadata
|
|
3276
|
+
* @default false
|
|
3277
|
+
*/
|
|
3278
|
+
hasMetadata?: boolean;
|
|
3279
|
+
};
|
|
3222
3280
|
/**
|
|
3223
3281
|
* PlaygroundInstanceContext
|
|
3224
3282
|
* @description One mounted playground instance and its current model selection.
|
|
@@ -3460,6 +3518,19 @@ export interface components {
|
|
|
3460
3518
|
/** Messages */
|
|
3461
3519
|
messages: components["schemas"]["PromptMessage"][];
|
|
3462
3520
|
};
|
|
3521
|
+
/**
|
|
3522
|
+
* PromptContext
|
|
3523
|
+
* @description Prompt the user is currently viewing.
|
|
3524
|
+
*/
|
|
3525
|
+
PromptContext: {
|
|
3526
|
+
/**
|
|
3527
|
+
* @description discriminator enum property added by openapi-typescript
|
|
3528
|
+
* @enum {string}
|
|
3529
|
+
*/
|
|
3530
|
+
type: "prompt";
|
|
3531
|
+
/** Promptnodeid */
|
|
3532
|
+
promptNodeId: string;
|
|
3533
|
+
};
|
|
3463
3534
|
/** PromptData */
|
|
3464
3535
|
PromptData: {
|
|
3465
3536
|
name: components["schemas"]["Identifier"];
|
|
@@ -3960,6 +4031,21 @@ export interface components {
|
|
|
3960
4031
|
/** Id */
|
|
3961
4032
|
id: string;
|
|
3962
4033
|
};
|
|
4034
|
+
/**
|
|
4035
|
+
* PromptVersionContext
|
|
4036
|
+
* @description Prompt version the user is currently viewing.
|
|
4037
|
+
*/
|
|
4038
|
+
PromptVersionContext: {
|
|
4039
|
+
/**
|
|
4040
|
+
* @description discriminator enum property added by openapi-typescript
|
|
4041
|
+
* @enum {string}
|
|
4042
|
+
*/
|
|
4043
|
+
type: "prompt_version";
|
|
4044
|
+
/** Promptnodeid */
|
|
4045
|
+
promptNodeId: string;
|
|
4046
|
+
/** Promptversionnodeid */
|
|
4047
|
+
promptVersionNodeId: string;
|
|
4048
|
+
};
|
|
3963
4049
|
/** PromptVersionData */
|
|
3964
4050
|
PromptVersionData: {
|
|
3965
4051
|
/** Description */
|
|
@@ -4161,6 +4247,21 @@ export interface components {
|
|
|
4161
4247
|
/** Next Cursor */
|
|
4162
4248
|
next_cursor: string | null;
|
|
4163
4249
|
};
|
|
4250
|
+
/**
|
|
4251
|
+
* SessionContext
|
|
4252
|
+
* @description Session the user is currently viewing.
|
|
4253
|
+
*/
|
|
4254
|
+
SessionContext: {
|
|
4255
|
+
/**
|
|
4256
|
+
* @description discriminator enum property added by openapi-typescript
|
|
4257
|
+
* @enum {string}
|
|
4258
|
+
*/
|
|
4259
|
+
type: "session";
|
|
4260
|
+
/** Projectnodeid */
|
|
4261
|
+
projectNodeId: string;
|
|
4262
|
+
/** Sessionnodeid */
|
|
4263
|
+
sessionNodeId: string;
|
|
4264
|
+
};
|
|
4164
4265
|
/** SessionData */
|
|
4165
4266
|
SessionData: {
|
|
4166
4267
|
/** Id */
|
|
@@ -4587,6 +4688,19 @@ export interface components {
|
|
|
4587
4688
|
*/
|
|
4588
4689
|
type?: "step-start";
|
|
4589
4690
|
};
|
|
4691
|
+
/**
|
|
4692
|
+
* SubagentsContext
|
|
4693
|
+
* @description User's per-turn request to expose the subagent-spawning tool.
|
|
4694
|
+
*/
|
|
4695
|
+
SubagentsContext: {
|
|
4696
|
+
/**
|
|
4697
|
+
* @description discriminator enum property added by openapi-typescript
|
|
4698
|
+
* @enum {string}
|
|
4699
|
+
*/
|
|
4700
|
+
type: "subagents";
|
|
4701
|
+
/** Enabled */
|
|
4702
|
+
enabled: boolean;
|
|
4703
|
+
};
|
|
4590
4704
|
/** TextContentPart */
|
|
4591
4705
|
TextContentPart: {
|
|
4592
4706
|
/**
|
|
@@ -5106,6 +5220,33 @@ export interface components {
|
|
|
5106
5220
|
/** Data */
|
|
5107
5221
|
data: components["schemas"]["CategoricalAnnotationConfig"] | components["schemas"]["ContinuousAnnotationConfig"] | components["schemas"]["FreeformAnnotationConfig"];
|
|
5108
5222
|
};
|
|
5223
|
+
/**
|
|
5224
|
+
* UpdateExperimentRequestBody
|
|
5225
|
+
* @description Fields to update on an experiment. Omit a field to leave it unchanged.
|
|
5226
|
+
*/
|
|
5227
|
+
UpdateExperimentRequestBody: {
|
|
5228
|
+
/**
|
|
5229
|
+
* Name
|
|
5230
|
+
* @description New name for the experiment (null is rejected; name is required)
|
|
5231
|
+
*/
|
|
5232
|
+
name?: string | null;
|
|
5233
|
+
/**
|
|
5234
|
+
* Description
|
|
5235
|
+
* @description New description for the experiment (null clears the description)
|
|
5236
|
+
*/
|
|
5237
|
+
description?: string | null;
|
|
5238
|
+
/**
|
|
5239
|
+
* Metadata
|
|
5240
|
+
* @description New metadata object for the experiment (replaces the existing metadata as a whole; null is rejected)
|
|
5241
|
+
*/
|
|
5242
|
+
metadata?: {
|
|
5243
|
+
[key: string]: unknown;
|
|
5244
|
+
} | null;
|
|
5245
|
+
};
|
|
5246
|
+
/** UpdateExperimentResponseBody */
|
|
5247
|
+
UpdateExperimentResponseBody: {
|
|
5248
|
+
data: components["schemas"]["Experiment"];
|
|
5249
|
+
};
|
|
5109
5250
|
/** UpdateProjectRequestBody */
|
|
5110
5251
|
UpdateProjectRequestBody: {
|
|
5111
5252
|
/** Description */
|
|
@@ -5256,6 +5397,12 @@ export interface components {
|
|
|
5256
5397
|
* @default false
|
|
5257
5398
|
*/
|
|
5258
5399
|
exportRemoteTraces?: boolean;
|
|
5400
|
+
/**
|
|
5401
|
+
* Attachuserid
|
|
5402
|
+
* @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.
|
|
5403
|
+
* @default false
|
|
5404
|
+
*/
|
|
5405
|
+
attachUserId?: boolean;
|
|
5259
5406
|
/** Messages */
|
|
5260
5407
|
messages: components["schemas"]["UIMessage"][];
|
|
5261
5408
|
/** Model */
|
|
@@ -6578,6 +6725,59 @@ export interface operations {
|
|
|
6578
6725
|
};
|
|
6579
6726
|
};
|
|
6580
6727
|
};
|
|
6728
|
+
updateExperiment: {
|
|
6729
|
+
parameters: {
|
|
6730
|
+
query?: never;
|
|
6731
|
+
header?: never;
|
|
6732
|
+
path: {
|
|
6733
|
+
experiment_id: string;
|
|
6734
|
+
};
|
|
6735
|
+
cookie?: never;
|
|
6736
|
+
};
|
|
6737
|
+
requestBody: {
|
|
6738
|
+
content: {
|
|
6739
|
+
"application/json": components["schemas"]["UpdateExperimentRequestBody"];
|
|
6740
|
+
};
|
|
6741
|
+
};
|
|
6742
|
+
responses: {
|
|
6743
|
+
/** @description Experiment updated successfully */
|
|
6744
|
+
200: {
|
|
6745
|
+
headers: {
|
|
6746
|
+
[name: string]: unknown;
|
|
6747
|
+
};
|
|
6748
|
+
content: {
|
|
6749
|
+
"application/json": components["schemas"]["UpdateExperimentResponseBody"];
|
|
6750
|
+
};
|
|
6751
|
+
};
|
|
6752
|
+
/** @description Forbidden */
|
|
6753
|
+
403: {
|
|
6754
|
+
headers: {
|
|
6755
|
+
[name: string]: unknown;
|
|
6756
|
+
};
|
|
6757
|
+
content: {
|
|
6758
|
+
"text/plain": string;
|
|
6759
|
+
};
|
|
6760
|
+
};
|
|
6761
|
+
/** @description Experiment not found */
|
|
6762
|
+
404: {
|
|
6763
|
+
headers: {
|
|
6764
|
+
[name: string]: unknown;
|
|
6765
|
+
};
|
|
6766
|
+
content: {
|
|
6767
|
+
"text/plain": string;
|
|
6768
|
+
};
|
|
6769
|
+
};
|
|
6770
|
+
/** @description Invalid experiment ID or request body */
|
|
6771
|
+
422: {
|
|
6772
|
+
headers: {
|
|
6773
|
+
[name: string]: unknown;
|
|
6774
|
+
};
|
|
6775
|
+
content: {
|
|
6776
|
+
"text/plain": string;
|
|
6777
|
+
};
|
|
6778
|
+
};
|
|
6779
|
+
};
|
|
6780
|
+
};
|
|
6581
6781
|
getIncompleteExperimentRuns: {
|
|
6582
6782
|
parameters: {
|
|
6583
6783
|
query?: {
|
|
@@ -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
|
+
}
|
package/src/prompts/sdks/toAI.ts
CHANGED
|
@@ -40,7 +40,8 @@ The tool choice strategy. Default: 'auto'.
|
|
|
40
40
|
toolChoice?: ToolChoice<ToolSet>;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export type ToAIParams<
|
|
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 = <
|
|
52
|
+
export const toAI = <PromptVariables extends Variables>({
|
|
52
53
|
prompt,
|
|
53
54
|
variables,
|
|
54
|
-
}: ToAIParams<
|
|
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<
|
|
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 = <
|
|
23
|
+
export const toAnthropic = <PromptVariables extends Variables = Variables>({
|
|
23
24
|
prompt,
|
|
24
25
|
variables,
|
|
25
|
-
}: ToAnthropicParams<
|
|
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<
|
|
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 = <
|
|
34
|
+
export const toOpenAI = <PromptVariables extends Variables = Variables>({
|
|
34
35
|
prompt,
|
|
35
36
|
variables,
|
|
36
|
-
}: ToOpenAIParams<
|
|
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<
|
|
19
|
-
(typeof PROVIDER_TO_SDK)[
|
|
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)[
|
|
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 = <
|
|
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
|
-
|
|
54
|
-
|
|
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:
|
|
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?:
|
|
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 = <
|
|
89
|
+
export const toSDK = <
|
|
90
|
+
SDK extends SupportedSDK,
|
|
91
|
+
PromptVariables extends Variables = Variables,
|
|
92
|
+
>({
|
|
90
93
|
sdk: _sdk,
|
|
91
94
|
...rest
|
|
92
|
-
}: ToSDKParams<
|
|
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<
|
|
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<
|
|
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?:
|
|
22
|
+
variables?: PromptVariables;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|