@arizeai/phoenix-client 7.1.1 → 7.3.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 +28 -2
- package/dist/esm/__generated__/api/v1.d.ts +315 -9
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/client.d.ts +10 -2
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +6 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/config.d.ts +10 -0
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +13 -9
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/experiments/getExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/getExperiment.js.map +1 -1
- package/dist/esm/experiments/resumeEvaluation.d.ts.map +1 -1
- package/dist/esm/experiments/resumeEvaluation.js +5 -5
- package/dist/esm/experiments/resumeEvaluation.js.map +1 -1
- package/dist/esm/experiments/resumeExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/resumeExperiment.js +5 -5
- package/dist/esm/experiments/resumeExperiment.js.map +1 -1
- package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.js +5 -5
- package/dist/esm/experiments/runExperiment.js.map +1 -1
- package/dist/esm/experiments/tracing.d.ts +27 -0
- package/dist/esm/experiments/tracing.d.ts.map +1 -1
- package/dist/esm/experiments/tracing.js +27 -0
- package/dist/esm/experiments/tracing.js.map +1 -1
- package/dist/esm/projects/getProjects.d.ts +31 -0
- package/dist/esm/projects/getProjects.d.ts.map +1 -0
- package/dist/esm/projects/getProjects.js +45 -0
- package/dist/esm/projects/getProjects.js.map +1 -0
- package/dist/esm/projects/index.d.ts +2 -0
- package/dist/esm/projects/index.d.ts.map +1 -0
- package/dist/esm/projects/index.js +2 -0
- package/dist/esm/projects/index.js.map +1 -0
- package/dist/esm/prompts/createPrompt.js +1 -1
- package/dist/esm/prompts/createPrompt.js.map +1 -1
- package/dist/esm/prompts/sdks/toSDK.js +1 -1
- package/dist/esm/prompts/sdks/toSDK.js.map +1 -1
- package/dist/esm/schemas/llm/converters.js +5 -5
- package/dist/esm/schemas/llm/converters.js.map +1 -1
- package/dist/esm/schemas/llm/openai/converters.js +3 -3
- package/dist/esm/schemas/llm/openai/converters.js.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/converters.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/converters.js +2 -0
- package/dist/esm/schemas/llm/phoenixPrompt/converters.js.map +1 -1
- package/dist/esm/testing/phoenix-test-tracking.d.ts.map +1 -1
- package/dist/esm/testing/phoenix-test-tracking.js +9 -9
- package/dist/esm/testing/phoenix-test-tracking.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/projects.d.ts +5 -0
- package/dist/esm/types/projects.d.ts.map +1 -1
- package/dist/esm/types/projects.js.map +1 -1
- package/dist/esm/utils/serverVersionUtils.d.ts.map +1 -1
- package/dist/esm/utils/serverVersionUtils.js +3 -0
- package/dist/esm/utils/serverVersionUtils.js.map +1 -1
- package/dist/src/__generated__/api/v1.d.ts +315 -9
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/client.d.ts +10 -2
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +6 -1
- package/dist/src/client.js.map +1 -1
- package/dist/src/config.d.ts +10 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +11 -7
- package/dist/src/config.js.map +1 -1
- package/dist/src/experiments/getExperiment.d.ts.map +1 -1
- package/dist/src/experiments/getExperiment.js.map +1 -1
- package/dist/src/experiments/resumeEvaluation.d.ts.map +1 -1
- package/dist/src/experiments/resumeEvaluation.js +4 -4
- package/dist/src/experiments/resumeEvaluation.js.map +1 -1
- package/dist/src/experiments/resumeExperiment.d.ts.map +1 -1
- package/dist/src/experiments/resumeExperiment.js +4 -4
- package/dist/src/experiments/resumeExperiment.js.map +1 -1
- package/dist/src/experiments/runExperiment.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.js +4 -4
- package/dist/src/experiments/runExperiment.js.map +1 -1
- package/dist/src/experiments/tracing.d.ts +27 -0
- package/dist/src/experiments/tracing.d.ts.map +1 -1
- package/dist/src/experiments/tracing.js +30 -0
- package/dist/src/experiments/tracing.js.map +1 -1
- package/dist/src/projects/getProjects.d.ts +31 -0
- package/dist/src/projects/getProjects.d.ts.map +1 -0
- package/dist/src/projects/getProjects.js +53 -0
- package/dist/src/projects/getProjects.js.map +1 -0
- package/dist/src/projects/index.d.ts +2 -0
- package/dist/src/projects/index.d.ts.map +1 -0
- package/dist/src/projects/index.js +18 -0
- package/dist/src/projects/index.js.map +1 -0
- package/dist/src/prompts/createPrompt.js +1 -1
- package/dist/src/prompts/createPrompt.js.map +1 -1
- package/dist/src/prompts/sdks/toSDK.js +1 -1
- package/dist/src/prompts/sdks/toSDK.js.map +1 -1
- package/dist/src/schemas/llm/converters.js +5 -5
- package/dist/src/schemas/llm/converters.js.map +1 -1
- package/dist/src/schemas/llm/openai/converters.js +3 -3
- package/dist/src/schemas/llm/openai/converters.js.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/converters.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/converters.js +2 -0
- package/dist/src/schemas/llm/phoenixPrompt/converters.js.map +1 -1
- package/dist/src/testing/phoenix-test-tracking.d.ts.map +1 -1
- package/dist/src/testing/phoenix-test-tracking.js +8 -8
- package/dist/src/testing/phoenix-test-tracking.js.map +1 -1
- package/dist/src/types/projects.d.ts +5 -0
- package/dist/src/types/projects.d.ts.map +1 -1
- package/dist/src/types/projects.js.map +1 -1
- package/dist/src/utils/serverVersionUtils.d.ts.map +1 -1
- package/dist/src/utils/serverVersionUtils.js +3 -0
- package/dist/src/utils/serverVersionUtils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/ci-evals-jest.mdx +1 -1
- package/docs/ci-evals-vitest.mdx +1 -1
- package/docs/ci-evals.mdx +1 -1
- package/docs/overview.mdx +5 -5
- package/package.json +15 -11
- package/src/__generated__/api/v1.ts +315 -9
- package/src/client.ts +17 -1
- package/src/config.ts +28 -11
- package/src/experiments/getExperiment.ts +4 -7
- package/src/experiments/resumeEvaluation.ts +11 -9
- package/src/experiments/resumeExperiment.ts +11 -9
- package/src/experiments/runExperiment.ts +9 -11
- package/src/experiments/tracing.ts +35 -0
- package/src/projects/getProjects.ts +69 -0
- package/src/projects/index.ts +1 -0
- package/src/prompts/createPrompt.ts +1 -1
- package/src/prompts/sdks/toSDK.ts +1 -1
- package/src/schemas/llm/converters.ts +5 -5
- package/src/schemas/llm/openai/converters.ts +3 -3
- package/src/schemas/llm/phoenixPrompt/converters.ts +2 -0
- package/src/testing/phoenix-test-tracking.ts +12 -9
- package/src/types/projects.ts +7 -0
- package/src/utils/serverVersionUtils.ts +3 -0
package/docs/ci-evals-jest.mdx
CHANGED
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
|
23
23
|
- `testMatch` keeps eval suites separate from regular tests.
|
|
24
24
|
- `reporters` keeps Jest's default reporter and adds the Phoenix
|
|
25
25
|
summary block at the end of the run.
|
|
26
|
-
- `setupFiles: ["dotenv/config"]` loads `
|
|
26
|
+
- `setupFiles: ["dotenv/config"]` loads `PHOENIX_ENDPOINT`, `PHOENIX_API_KEY`,
|
|
27
27
|
and other env vars from `.env`.
|
|
28
28
|
- `testTimeout` is bumped because LLM calls can be slow.
|
|
29
29
|
|
package/docs/ci-evals-vitest.mdx
CHANGED
|
@@ -28,7 +28,7 @@ export default defineConfig({
|
|
|
28
28
|
`*.eval.ts` convention.
|
|
29
29
|
- `reporters` keeps Vitest's default diagnostics and enables the Phoenix
|
|
30
30
|
summary block.
|
|
31
|
-
- `setupFiles: ["dotenv/config"]` loads `
|
|
31
|
+
- `setupFiles: ["dotenv/config"]` loads `PHOENIX_ENDPOINT`, `PHOENIX_API_KEY`,
|
|
32
32
|
and any other env vars from `.env`.
|
|
33
33
|
- `testTimeout` is bumped because LLM calls can be slow.
|
|
34
34
|
|
package/docs/ci-evals.mdx
CHANGED
|
@@ -94,7 +94,7 @@ standard Phoenix env vars.
|
|
|
94
94
|
|
|
95
95
|
| Variable | Purpose |
|
|
96
96
|
| --- | --- |
|
|
97
|
-
| `
|
|
97
|
+
| `PHOENIX_ENDPOINT` | Phoenix base URL |
|
|
98
98
|
| `PHOENIX_API_KEY` | Bearer token for Phoenix |
|
|
99
99
|
| `PHOENIX_CLIENT_HEADERS` | Optional JSON headers forwarded to the Phoenix client and tracer |
|
|
100
100
|
| `PHOENIX_TEST_TRACKING=false` | Disable sync to Phoenix for the current run (tracking is on by default) |
|
package/docs/overview.mdx
CHANGED
|
@@ -50,18 +50,18 @@ That gives the agent version-matched docs plus the exact implementation and gene
|
|
|
50
50
|
|
|
51
51
|
## Configuration
|
|
52
52
|
|
|
53
|
-
`createClient()` resolves Phoenix client options in this order: library defaults, environment variables, then explicit options. In most applications, the normal setup is to set `
|
|
53
|
+
`createClient()` resolves Phoenix client options in this order: library defaults, environment variables, then explicit options. In most applications, the normal setup is to set `PHOENIX_ENDPOINT` and `PHOENIX_API_KEY` in the environment and call `createClient()` with no overrides.
|
|
54
54
|
|
|
55
55
|
### Recommended Setup
|
|
56
56
|
|
|
57
57
|
Use the environment-driven path unless you have a specific reason to override client options in code.
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
|
-
export
|
|
60
|
+
export PHOENIX_ENDPOINT=http://localhost:6006
|
|
61
61
|
export PHOENIX_API_KEY=<your-api-key>
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
For a remote deployment, `
|
|
64
|
+
For a remote deployment, `PHOENIX_ENDPOINT` is that instance's base URL, e.g. `https://your-phoenix.example.com`.
|
|
65
65
|
|
|
66
66
|
```ts
|
|
67
67
|
import { createClient } from "@arizeai/phoenix-client";
|
|
@@ -103,7 +103,7 @@ These are the Phoenix-specific options this package resolves before creating the
|
|
|
103
103
|
|
|
104
104
|
| Option | Type | Description |
|
|
105
105
|
|--------|------|-------------|
|
|
106
|
-
| `baseUrl` | `string` | Base Phoenix URL. Defaults to `http://localhost:6006`, or `
|
|
106
|
+
| `baseUrl` | `string` | Base Phoenix URL. Defaults to `http://localhost:6006`, or `PHOENIX_ENDPOINT` when that environment variable is set. |
|
|
107
107
|
| `headers` | `ClientOptions["headers"]` | Headers sent on every request. `PHOENIX_API_KEY` populates `Authorization` automatically. Explicit `headers` replace environment-derived headers. |
|
|
108
108
|
|
|
109
109
|
### Header Override Rule
|
|
@@ -124,7 +124,7 @@ const client = createClient({
|
|
|
124
124
|
|
|
125
125
|
| Variable | Maps to | Description |
|
|
126
126
|
|--------|---------|-------------|
|
|
127
|
-
| `
|
|
127
|
+
| `PHOENIX_ENDPOINT` | `options.baseUrl` | Base Phoenix URL, for example `http://localhost:6006`. |
|
|
128
128
|
| `PHOENIX_API_KEY` | `options.headers.Authorization` | Bearer token for authenticated environments. |
|
|
129
129
|
| `PHOENIX_CLIENT_HEADERS` | `options.headers` | Optional JSON-encoded object of additional headers to send on every request. Most setups do not need this. |
|
|
130
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arizeai/phoenix-client",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "A client for the Phoenix API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arize",
|
|
@@ -53,6 +53,10 @@
|
|
|
53
53
|
"import": "./dist/esm/sessions/index.js",
|
|
54
54
|
"require": "./dist/src/sessions/index.js"
|
|
55
55
|
},
|
|
56
|
+
"./projects": {
|
|
57
|
+
"import": "./dist/esm/projects/index.js",
|
|
58
|
+
"require": "./dist/src/projects/index.js"
|
|
59
|
+
},
|
|
56
60
|
"./traces": {
|
|
57
61
|
"import": "./dist/esm/traces/index.js",
|
|
58
62
|
"require": "./dist/src/traces/index.js"
|
|
@@ -95,31 +99,31 @@
|
|
|
95
99
|
}
|
|
96
100
|
},
|
|
97
101
|
"dependencies": {
|
|
98
|
-
"@arizeai/openinference-semantic-conventions": "^2.
|
|
102
|
+
"@arizeai/openinference-semantic-conventions": "^2.6.0",
|
|
99
103
|
"async": "^3.2.6",
|
|
100
104
|
"openapi-fetch": "^0.17.0",
|
|
101
105
|
"tiny-invariant": "^1.3.3",
|
|
102
106
|
"zod": "^4.4.3",
|
|
103
|
-
"@arizeai/phoenix-config": "0.
|
|
104
|
-
"@arizeai/phoenix-otel": "2.
|
|
107
|
+
"@arizeai/phoenix-config": "0.5.0",
|
|
108
|
+
"@arizeai/phoenix-otel": "2.2.0"
|
|
105
109
|
},
|
|
106
110
|
"devDependencies": {
|
|
107
|
-
"@ai-sdk/openai": "^4.0.
|
|
108
|
-
"@ai-sdk/otel": "^1.0.
|
|
111
|
+
"@ai-sdk/openai": "^4.0.27",
|
|
112
|
+
"@ai-sdk/otel": "^1.0.47",
|
|
109
113
|
"@anthropic-ai/sdk": "^0.111.0",
|
|
110
114
|
"@opentelemetry/api": "^1.9.1",
|
|
111
|
-
"@opentelemetry/sdk-trace-node": "^2.
|
|
115
|
+
"@opentelemetry/sdk-trace-node": "^2.10.0",
|
|
112
116
|
"@types/async": "^3.2.25",
|
|
113
|
-
"@types/node": "^26.1.
|
|
114
|
-
"ai": "^7.0.
|
|
117
|
+
"@types/node": "^26.1.2",
|
|
118
|
+
"ai": "^7.0.47",
|
|
115
119
|
"dotenv": "^17.4.2",
|
|
116
120
|
"jest": "^30.4.2",
|
|
117
|
-
"openai": "^6.
|
|
121
|
+
"openai": "^6.49.0",
|
|
118
122
|
"openapi-typescript": "^7.13.0",
|
|
119
123
|
"tsx": "^4.23.1",
|
|
120
124
|
"vitest": "^4.1.10",
|
|
121
125
|
"@arizeai/phoenix-testing": "0.0.0",
|
|
122
|
-
"@arizeai/phoenix-evals": "2.
|
|
126
|
+
"@arizeai/phoenix-evals": "2.2.0"
|
|
123
127
|
},
|
|
124
128
|
"peerDependencies": {
|
|
125
129
|
"@anthropic-ai/sdk": "^0.35.0",
|
|
@@ -1027,7 +1027,11 @@ export interface paths {
|
|
|
1027
1027
|
delete: operations["deletePrompt"];
|
|
1028
1028
|
options?: never;
|
|
1029
1029
|
head?: never;
|
|
1030
|
-
|
|
1030
|
+
/**
|
|
1031
|
+
* Update prompt metadata
|
|
1032
|
+
* @description Update a prompt's description and metadata by identifier.
|
|
1033
|
+
*/
|
|
1034
|
+
patch: operations["patchPrompt"];
|
|
1031
1035
|
trace?: never;
|
|
1032
1036
|
};
|
|
1033
1037
|
"/v1/projects": {
|
|
@@ -1390,6 +1394,28 @@ export interface paths {
|
|
|
1390
1394
|
patch?: never;
|
|
1391
1395
|
trace?: never;
|
|
1392
1396
|
};
|
|
1397
|
+
"/v1/chat/completions": {
|
|
1398
|
+
parameters: {
|
|
1399
|
+
query?: never;
|
|
1400
|
+
header?: never;
|
|
1401
|
+
path?: never;
|
|
1402
|
+
cookie?: never;
|
|
1403
|
+
};
|
|
1404
|
+
get?: never;
|
|
1405
|
+
put?: never;
|
|
1406
|
+
/**
|
|
1407
|
+
* OpenAI-compatible chat completions
|
|
1408
|
+
* @description Creates a chat completion using the OpenAI wire format, proxying to the selected provider with credentials resolved on the server (secret store first, environment second) — callers never handle provider API keys. Model must be '{provider}:{model_name}' for a built-in provider (one of anthropic, aws, azure_openai, cerebras, deepseek, fireworks, google, groq, moonshot, ollama, openai, perplexity, together, xai) or 'custom:{provider_id}:{model_name}' for a stored custom provider, e.g. 'openai:gpt-4o' or 'anthropic:claude-sonnet-4-5'. Set `stream: true` for server-sent events of `chat.completion.chunk` payloads terminated by `data: [DONE]`. Tool calling is not supported.
|
|
1409
|
+
*
|
|
1410
|
+
* **Phoenix is not an AI gateway.** The same server also takes on trace ingestion traffic, so routing production LLM calls through it competes with ingestion. Use this endpoint only to quickly try out different models in non-production environments.
|
|
1411
|
+
*/
|
|
1412
|
+
post: operations["createChatCompletion"];
|
|
1413
|
+
delete?: never;
|
|
1414
|
+
options?: never;
|
|
1415
|
+
head?: never;
|
|
1416
|
+
patch?: never;
|
|
1417
|
+
trace?: never;
|
|
1418
|
+
};
|
|
1393
1419
|
"/auth/login": {
|
|
1394
1420
|
parameters: {
|
|
1395
1421
|
query?: never;
|
|
@@ -1933,6 +1959,98 @@ export interface components {
|
|
|
1933
1959
|
/** Score */
|
|
1934
1960
|
score?: number | null;
|
|
1935
1961
|
};
|
|
1962
|
+
/** ChatCompletion */
|
|
1963
|
+
ChatCompletion: {
|
|
1964
|
+
/** Id */
|
|
1965
|
+
id: string;
|
|
1966
|
+
/**
|
|
1967
|
+
* Object
|
|
1968
|
+
* @default chat.completion
|
|
1969
|
+
* @constant
|
|
1970
|
+
*/
|
|
1971
|
+
object?: "chat.completion";
|
|
1972
|
+
/** Created */
|
|
1973
|
+
created: number;
|
|
1974
|
+
/** Model */
|
|
1975
|
+
model: string;
|
|
1976
|
+
/** Choices */
|
|
1977
|
+
choices: components["schemas"]["ChatCompletionChoice"][];
|
|
1978
|
+
usage: components["schemas"]["ChatCompletionUsage"];
|
|
1979
|
+
};
|
|
1980
|
+
/** ChatCompletionChoice */
|
|
1981
|
+
ChatCompletionChoice: {
|
|
1982
|
+
/**
|
|
1983
|
+
* Index
|
|
1984
|
+
* @default 0
|
|
1985
|
+
*/
|
|
1986
|
+
index?: number;
|
|
1987
|
+
message: components["schemas"]["ChatCompletionMessage"];
|
|
1988
|
+
/** Finish Reason */
|
|
1989
|
+
finish_reason: string;
|
|
1990
|
+
};
|
|
1991
|
+
/** ChatCompletionErrorDetail */
|
|
1992
|
+
ChatCompletionErrorDetail: {
|
|
1993
|
+
/** Message */
|
|
1994
|
+
message: string;
|
|
1995
|
+
/** Type */
|
|
1996
|
+
type: string;
|
|
1997
|
+
/** Param */
|
|
1998
|
+
param?: string | null;
|
|
1999
|
+
/** Code */
|
|
2000
|
+
code?: string | null;
|
|
2001
|
+
};
|
|
2002
|
+
/** ChatCompletionErrorResponse */
|
|
2003
|
+
ChatCompletionErrorResponse: {
|
|
2004
|
+
error: components["schemas"]["ChatCompletionErrorDetail"];
|
|
2005
|
+
};
|
|
2006
|
+
/** ChatCompletionMessage */
|
|
2007
|
+
ChatCompletionMessage: {
|
|
2008
|
+
/**
|
|
2009
|
+
* Role
|
|
2010
|
+
* @default assistant
|
|
2011
|
+
* @constant
|
|
2012
|
+
*/
|
|
2013
|
+
role?: "assistant";
|
|
2014
|
+
/** Content */
|
|
2015
|
+
content: string;
|
|
2016
|
+
};
|
|
2017
|
+
/** ChatCompletionRequestMessage */
|
|
2018
|
+
ChatCompletionRequestMessage: {
|
|
2019
|
+
/**
|
|
2020
|
+
* Role
|
|
2021
|
+
* @enum {string}
|
|
2022
|
+
*/
|
|
2023
|
+
role: "system" | "developer" | "user" | "assistant";
|
|
2024
|
+
/** Content */
|
|
2025
|
+
content: string | components["schemas"]["ChatCompletionTextPart"][];
|
|
2026
|
+
};
|
|
2027
|
+
/** ChatCompletionStreamOptions */
|
|
2028
|
+
ChatCompletionStreamOptions: {
|
|
2029
|
+
/**
|
|
2030
|
+
* Include Usage
|
|
2031
|
+
* @default false
|
|
2032
|
+
*/
|
|
2033
|
+
include_usage?: boolean;
|
|
2034
|
+
};
|
|
2035
|
+
/** ChatCompletionTextPart */
|
|
2036
|
+
ChatCompletionTextPart: {
|
|
2037
|
+
/**
|
|
2038
|
+
* Type
|
|
2039
|
+
* @constant
|
|
2040
|
+
*/
|
|
2041
|
+
type: "text";
|
|
2042
|
+
/** Text */
|
|
2043
|
+
text: string;
|
|
2044
|
+
};
|
|
2045
|
+
/** ChatCompletionUsage */
|
|
2046
|
+
ChatCompletionUsage: {
|
|
2047
|
+
/** Prompt Tokens */
|
|
2048
|
+
prompt_tokens: number;
|
|
2049
|
+
/** Completion Tokens */
|
|
2050
|
+
completion_tokens: number;
|
|
2051
|
+
/** Total Tokens */
|
|
2052
|
+
total_tokens: number;
|
|
2053
|
+
};
|
|
1936
2054
|
/**
|
|
1937
2055
|
* ChatContext
|
|
1938
2056
|
* @description Discriminated union of every UI-state context the agent understands.
|
|
@@ -2107,6 +2225,63 @@ export interface components {
|
|
|
2107
2225
|
CreateApiKeyResponseBody: {
|
|
2108
2226
|
data: components["schemas"]["CreatedApiKey"];
|
|
2109
2227
|
};
|
|
2228
|
+
/**
|
|
2229
|
+
* CreateChatCompletionRequestBody
|
|
2230
|
+
* @example {
|
|
2231
|
+
* "messages": [
|
|
2232
|
+
* {
|
|
2233
|
+
* "content": "You are a helpful assistant.",
|
|
2234
|
+
* "role": "system"
|
|
2235
|
+
* },
|
|
2236
|
+
* {
|
|
2237
|
+
* "content": "Say hello.",
|
|
2238
|
+
* "role": "user"
|
|
2239
|
+
* }
|
|
2240
|
+
* ],
|
|
2241
|
+
* "model": "openai:gpt-4o"
|
|
2242
|
+
* }
|
|
2243
|
+
*/
|
|
2244
|
+
CreateChatCompletionRequestBody: {
|
|
2245
|
+
/**
|
|
2246
|
+
* Model
|
|
2247
|
+
* @description Model must be '{provider}:{model_name}' for a built-in provider (one of anthropic, aws, azure_openai, cerebras, deepseek, fireworks, google, groq, moonshot, ollama, openai, perplexity, together, xai) or 'custom:{provider_id}:{model_name}' for a stored custom provider, e.g. 'openai:gpt-4o' or 'anthropic:claude-sonnet-4-5'.
|
|
2248
|
+
*/
|
|
2249
|
+
model: string;
|
|
2250
|
+
/** Messages */
|
|
2251
|
+
messages: components["schemas"]["ChatCompletionRequestMessage"][];
|
|
2252
|
+
/**
|
|
2253
|
+
* Stream
|
|
2254
|
+
* @default false
|
|
2255
|
+
*/
|
|
2256
|
+
stream?: boolean;
|
|
2257
|
+
/** Temperature */
|
|
2258
|
+
temperature?: number | null;
|
|
2259
|
+
/** Top P */
|
|
2260
|
+
top_p?: number | null;
|
|
2261
|
+
/** Max Tokens */
|
|
2262
|
+
max_tokens?: number | null;
|
|
2263
|
+
/** Max Completion Tokens */
|
|
2264
|
+
max_completion_tokens?: number | null;
|
|
2265
|
+
/** Stop */
|
|
2266
|
+
stop?: string | string[] | null;
|
|
2267
|
+
/** Frequency Penalty */
|
|
2268
|
+
frequency_penalty?: number | null;
|
|
2269
|
+
/** Presence Penalty */
|
|
2270
|
+
presence_penalty?: number | null;
|
|
2271
|
+
/** Seed */
|
|
2272
|
+
seed?: number | null;
|
|
2273
|
+
/** N */
|
|
2274
|
+
n?: number | null;
|
|
2275
|
+
stream_options?: components["schemas"]["ChatCompletionStreamOptions"] | null;
|
|
2276
|
+
/** Tools */
|
|
2277
|
+
tools?: unknown[] | null;
|
|
2278
|
+
/** Tool Choice */
|
|
2279
|
+
tool_choice?: unknown | null;
|
|
2280
|
+
/** Response Format */
|
|
2281
|
+
response_format?: {
|
|
2282
|
+
[key: string]: unknown;
|
|
2283
|
+
} | null;
|
|
2284
|
+
};
|
|
2110
2285
|
/** CreateDatasetLabelRequestBody */
|
|
2111
2286
|
CreateDatasetLabelRequestBody: {
|
|
2112
2287
|
/**
|
|
@@ -3596,6 +3771,28 @@ export interface components {
|
|
|
3596
3771
|
*/
|
|
3597
3772
|
message?: string | null;
|
|
3598
3773
|
};
|
|
3774
|
+
/**
|
|
3775
|
+
* PatchPromptRequestBody
|
|
3776
|
+
* @description Fields to update on a prompt. Omit a field to leave it unchanged.
|
|
3777
|
+
*/
|
|
3778
|
+
PatchPromptRequestBody: {
|
|
3779
|
+
/**
|
|
3780
|
+
* Description
|
|
3781
|
+
* @description New description for the prompt (null clears the description)
|
|
3782
|
+
*/
|
|
3783
|
+
description?: string | null;
|
|
3784
|
+
/**
|
|
3785
|
+
* Metadata
|
|
3786
|
+
* @description New metadata object for the prompt (replaces the existing metadata as a whole)
|
|
3787
|
+
*/
|
|
3788
|
+
metadata?: {
|
|
3789
|
+
[key: string]: unknown;
|
|
3790
|
+
};
|
|
3791
|
+
};
|
|
3792
|
+
/** PatchPromptResponseBody */
|
|
3793
|
+
PatchPromptResponseBody: {
|
|
3794
|
+
data: components["schemas"]["Prompt"];
|
|
3795
|
+
};
|
|
3599
3796
|
/**
|
|
3600
3797
|
* PhoenixUIMessage
|
|
3601
3798
|
* @description `UIMessage` with `metadata` narrowed to the Phoenix wire shapes.
|
|
@@ -3756,12 +3953,9 @@ export interface components {
|
|
|
3756
3953
|
*
|
|
3757
3954
|
* ``span_filter`` carries the project-scoped span filter expression when the
|
|
3758
3955
|
* span filter field is mounted — empty string when the field is mounted with
|
|
3759
|
-
* no condition applied, ``None`` when the field is not present at all.
|
|
3760
|
-
*
|
|
3761
|
-
*
|
|
3762
|
-
* all toggle when that toggle is mounted — ``True`` when the table is
|
|
3763
|
-
* restricted to root spans, ``False`` when it shows every span, ``None``
|
|
3764
|
-
* when the toggle is not present (e.g. on the traces tab).
|
|
3956
|
+
* no condition applied, ``None`` when the field is not present at all. It
|
|
3957
|
+
* describes the view in full, root-span scoping included (which is expressed
|
|
3958
|
+
* within the filter DSL as ``parent_id is None``).
|
|
3765
3959
|
*/
|
|
3766
3960
|
ProjectContext: {
|
|
3767
3961
|
/**
|
|
@@ -3773,8 +3967,6 @@ export interface components {
|
|
|
3773
3967
|
projectNodeId: string;
|
|
3774
3968
|
/** Spanfilter */
|
|
3775
3969
|
spanFilter?: string | null;
|
|
3776
|
-
/** Rootspansonly */
|
|
3777
|
-
rootSpansOnly?: boolean | null;
|
|
3778
3970
|
};
|
|
3779
3971
|
/** Prompt */
|
|
3780
3972
|
Prompt: {
|
|
@@ -9480,6 +9672,60 @@ export interface operations {
|
|
|
9480
9672
|
};
|
|
9481
9673
|
};
|
|
9482
9674
|
};
|
|
9675
|
+
patchPrompt: {
|
|
9676
|
+
parameters: {
|
|
9677
|
+
query?: never;
|
|
9678
|
+
header?: never;
|
|
9679
|
+
path: {
|
|
9680
|
+
/** @description The identifier of the prompt, i.e. name or ID. */
|
|
9681
|
+
prompt_identifier: string;
|
|
9682
|
+
};
|
|
9683
|
+
cookie?: never;
|
|
9684
|
+
};
|
|
9685
|
+
requestBody: {
|
|
9686
|
+
content: {
|
|
9687
|
+
"application/json": components["schemas"]["PatchPromptRequestBody"];
|
|
9688
|
+
};
|
|
9689
|
+
};
|
|
9690
|
+
responses: {
|
|
9691
|
+
/** @description The updated prompt */
|
|
9692
|
+
200: {
|
|
9693
|
+
headers: {
|
|
9694
|
+
[name: string]: unknown;
|
|
9695
|
+
};
|
|
9696
|
+
content: {
|
|
9697
|
+
"application/json": components["schemas"]["PatchPromptResponseBody"];
|
|
9698
|
+
};
|
|
9699
|
+
};
|
|
9700
|
+
/** @description Forbidden */
|
|
9701
|
+
403: {
|
|
9702
|
+
headers: {
|
|
9703
|
+
[name: string]: unknown;
|
|
9704
|
+
};
|
|
9705
|
+
content: {
|
|
9706
|
+
"text/plain": string;
|
|
9707
|
+
};
|
|
9708
|
+
};
|
|
9709
|
+
/** @description Not Found */
|
|
9710
|
+
404: {
|
|
9711
|
+
headers: {
|
|
9712
|
+
[name: string]: unknown;
|
|
9713
|
+
};
|
|
9714
|
+
content: {
|
|
9715
|
+
"text/plain": string;
|
|
9716
|
+
};
|
|
9717
|
+
};
|
|
9718
|
+
/** @description Unprocessable Entity */
|
|
9719
|
+
422: {
|
|
9720
|
+
headers: {
|
|
9721
|
+
[name: string]: unknown;
|
|
9722
|
+
};
|
|
9723
|
+
content: {
|
|
9724
|
+
"text/plain": string;
|
|
9725
|
+
};
|
|
9726
|
+
};
|
|
9727
|
+
};
|
|
9728
|
+
};
|
|
9483
9729
|
getProjects: {
|
|
9484
9730
|
parameters: {
|
|
9485
9731
|
query?: {
|
|
@@ -10679,6 +10925,66 @@ export interface operations {
|
|
|
10679
10925
|
};
|
|
10680
10926
|
};
|
|
10681
10927
|
};
|
|
10928
|
+
createChatCompletion: {
|
|
10929
|
+
parameters: {
|
|
10930
|
+
query?: never;
|
|
10931
|
+
header?: never;
|
|
10932
|
+
path?: never;
|
|
10933
|
+
cookie?: never;
|
|
10934
|
+
};
|
|
10935
|
+
requestBody: {
|
|
10936
|
+
content: {
|
|
10937
|
+
"application/json": components["schemas"]["CreateChatCompletionRequestBody"];
|
|
10938
|
+
};
|
|
10939
|
+
};
|
|
10940
|
+
responses: {
|
|
10941
|
+
/** @description Successful Response */
|
|
10942
|
+
200: {
|
|
10943
|
+
headers: {
|
|
10944
|
+
[name: string]: unknown;
|
|
10945
|
+
};
|
|
10946
|
+
content: {
|
|
10947
|
+
"application/json": components["schemas"]["ChatCompletion"];
|
|
10948
|
+
};
|
|
10949
|
+
};
|
|
10950
|
+
/** @description Bad Request */
|
|
10951
|
+
400: {
|
|
10952
|
+
headers: {
|
|
10953
|
+
[name: string]: unknown;
|
|
10954
|
+
};
|
|
10955
|
+
content: {
|
|
10956
|
+
"application/json": components["schemas"]["ChatCompletionErrorResponse"];
|
|
10957
|
+
};
|
|
10958
|
+
};
|
|
10959
|
+
/** @description Forbidden */
|
|
10960
|
+
403: {
|
|
10961
|
+
headers: {
|
|
10962
|
+
[name: string]: unknown;
|
|
10963
|
+
};
|
|
10964
|
+
content: {
|
|
10965
|
+
"text/plain": string;
|
|
10966
|
+
};
|
|
10967
|
+
};
|
|
10968
|
+
/** @description Not Found */
|
|
10969
|
+
404: {
|
|
10970
|
+
headers: {
|
|
10971
|
+
[name: string]: unknown;
|
|
10972
|
+
};
|
|
10973
|
+
content: {
|
|
10974
|
+
"application/json": components["schemas"]["ChatCompletionErrorResponse"];
|
|
10975
|
+
};
|
|
10976
|
+
};
|
|
10977
|
+
/** @description Unprocessable Entity */
|
|
10978
|
+
422: {
|
|
10979
|
+
headers: {
|
|
10980
|
+
[name: string]: unknown;
|
|
10981
|
+
};
|
|
10982
|
+
content: {
|
|
10983
|
+
"application/json": components["schemas"]["ChatCompletionErrorResponse"];
|
|
10984
|
+
};
|
|
10985
|
+
};
|
|
10986
|
+
};
|
|
10987
|
+
};
|
|
10682
10988
|
_login_auth_login_post: {
|
|
10683
10989
|
parameters: {
|
|
10684
10990
|
query?: never;
|
package/src/client.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
paths as oapiPathsV1,
|
|
10
10
|
} from "./__generated__/api/v1.d.ts";
|
|
11
11
|
import {
|
|
12
|
+
type BaseUrlSource,
|
|
12
13
|
defaultGetEnvironmentOptions,
|
|
13
14
|
makeDefaultClientOptions,
|
|
14
15
|
} from "./config";
|
|
@@ -36,6 +37,14 @@ export type Types = {
|
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* The client's resolved options, tagged with where the base URL came from so
|
|
42
|
+
* consumers can tell deliberate configuration from an ambient environment.
|
|
43
|
+
*/
|
|
44
|
+
export type PhoenixClientOptions = ClientOptions & {
|
|
45
|
+
baseUrlSource: BaseUrlSource;
|
|
46
|
+
};
|
|
47
|
+
|
|
39
48
|
/**
|
|
40
49
|
* Merge all configuration options according to priority:
|
|
41
50
|
* defaults < environment < explicit options
|
|
@@ -51,13 +60,20 @@ export const getMergedOptions = ({
|
|
|
51
60
|
}: {
|
|
52
61
|
options?: Partial<ClientOptions>;
|
|
53
62
|
getEnvironmentOptions?: () => Partial<ClientOptions>;
|
|
54
|
-
} = {}):
|
|
63
|
+
} = {}): PhoenixClientOptions => {
|
|
55
64
|
const defaultOptions = makeDefaultClientOptions();
|
|
56
65
|
const environmentOptions = getEnvironmentOptions();
|
|
66
|
+
const baseUrlSource: BaseUrlSource =
|
|
67
|
+
options.baseUrl !== undefined
|
|
68
|
+
? "explicit"
|
|
69
|
+
: environmentOptions.baseUrl !== undefined
|
|
70
|
+
? "environment"
|
|
71
|
+
: "default";
|
|
57
72
|
return {
|
|
58
73
|
...defaultOptions,
|
|
59
74
|
...environmentOptions,
|
|
60
75
|
...options,
|
|
76
|
+
baseUrlSource,
|
|
61
77
|
};
|
|
62
78
|
};
|
|
63
79
|
|
package/src/config.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import type { EnvironmentConfig } from "@arizeai/phoenix-config";
|
|
2
1
|
import {
|
|
3
2
|
DEFAULT_PHOENIX_BASE_URL,
|
|
4
|
-
|
|
3
|
+
getBaseUrlFromEnvironment,
|
|
4
|
+
getCredentialsFromEnvironment,
|
|
5
5
|
} from "@arizeai/phoenix-config";
|
|
6
6
|
import type { ClientOptions } from "openapi-fetch";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Convert
|
|
9
|
+
* Convert resolved Phoenix credentials into a ClientOptions object.
|
|
10
10
|
*
|
|
11
|
-
* @param
|
|
11
|
+
* @param credentials - The API key and headers resolved from the environment.
|
|
12
12
|
* @returns The converted ClientOptions object.
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const phoenixCredentialsToClientOptions = (
|
|
15
|
+
credentials: ReturnType<typeof getCredentialsFromEnvironment>
|
|
16
16
|
): Partial<ClientOptions> => {
|
|
17
17
|
const options: Partial<ClientOptions> = {
|
|
18
|
-
baseUrl: environment.PHOENIX_HOST,
|
|
19
18
|
headers: {
|
|
20
|
-
...(
|
|
21
|
-
...(
|
|
22
|
-
? { Authorization: `Bearer ${
|
|
19
|
+
...(credentials.headers ?? {}),
|
|
20
|
+
...(credentials.apiKey
|
|
21
|
+
? { Authorization: `Bearer ${credentials.apiKey}` }
|
|
23
22
|
: {}),
|
|
24
23
|
},
|
|
25
24
|
};
|
|
@@ -36,6 +35,17 @@ const phoenixEnvironmentToClientOptions = (
|
|
|
36
35
|
);
|
|
37
36
|
};
|
|
38
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Where a client's base URL came from: an explicit `baseUrl` option
|
|
40
|
+
* (`"explicit"`), a Phoenix environment variable (`"environment"`), or the
|
|
41
|
+
* built-in localhost default (`"default"`).
|
|
42
|
+
*
|
|
43
|
+
* Explicit configuration outranks the ambient environment, so this is what
|
|
44
|
+
* decides whether an environment variable may retarget the client's trace
|
|
45
|
+
* export.
|
|
46
|
+
*/
|
|
47
|
+
export type BaseUrlSource = "default" | "environment" | "explicit";
|
|
48
|
+
|
|
39
49
|
/**
|
|
40
50
|
* Get the environment options from the environment.
|
|
41
51
|
*
|
|
@@ -46,7 +56,14 @@ export const defaultGetEnvironmentOptions = (): Partial<ClientOptions> => {
|
|
|
46
56
|
if (typeof process !== "object" || typeof process.env !== "object") {
|
|
47
57
|
return {};
|
|
48
58
|
}
|
|
49
|
-
|
|
59
|
+
const options = phoenixCredentialsToClientOptions(
|
|
60
|
+
getCredentialsFromEnvironment()
|
|
61
|
+
);
|
|
62
|
+
// The base URL resolves as a tier group (PHOENIX_ENDPOINT first, inferring
|
|
63
|
+
// from the trace-export variables, then legacy PHOENIX_HOST) rather than
|
|
64
|
+
// variable by variable.
|
|
65
|
+
const baseUrl = getBaseUrlFromEnvironment();
|
|
66
|
+
return baseUrl !== undefined ? { ...options, baseUrl } : options;
|
|
50
67
|
};
|
|
51
68
|
|
|
52
69
|
/**
|
|
@@ -25,13 +25,10 @@ export async function getExperiment({
|
|
|
25
25
|
getExperimentRuns({ client, experimentId }),
|
|
26
26
|
]);
|
|
27
27
|
const experimentRunsMap: ExperimentRunsMap = {
|
|
28
|
-
runs: experimentRuns.runs.reduce(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
{} as ExperimentRunsMap["runs"]
|
|
34
|
-
),
|
|
28
|
+
runs: experimentRuns.runs.reduce<ExperimentRunsMap["runs"]>((acc, run) => {
|
|
29
|
+
acc[run.id] = run;
|
|
30
|
+
return acc;
|
|
31
|
+
}, {}),
|
|
35
32
|
};
|
|
36
33
|
return {
|
|
37
34
|
...experiment,
|