@arizeai/phoenix-client 2.3.4 → 2.4.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/dist/esm/client.d.ts +3 -4
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/datasets/getDataset.d.ts +5 -2
- package/dist/esm/datasets/getDataset.d.ts.map +1 -1
- package/dist/esm/datasets/getDataset.js +5 -3
- package/dist/esm/datasets/getDataset.js.map +1 -1
- package/dist/esm/datasets/getDatasetExamples.d.ts +5 -2
- package/dist/esm/datasets/getDatasetExamples.d.ts.map +1 -1
- package/dist/esm/datasets/getDatasetExamples.js +9 -2
- package/dist/esm/datasets/getDatasetExamples.js.map +1 -1
- package/dist/esm/datasets/getDatasetInfo.d.ts +1 -0
- package/dist/esm/datasets/getDatasetInfo.d.ts.map +1 -1
- package/dist/esm/datasets/getDatasetInfo.js +1 -0
- package/dist/esm/datasets/getDatasetInfo.js.map +1 -1
- package/dist/esm/datasets/index.d.ts +0 -1
- package/dist/esm/datasets/index.d.ts.map +1 -1
- package/dist/esm/datasets/index.js +0 -1
- package/dist/esm/datasets/index.js.map +1 -1
- package/dist/esm/datasets/listDatasets.d.ts +1 -2
- package/dist/esm/datasets/listDatasets.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.d.ts +4 -2
- package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
- package/dist/esm/experiments/runExperiment.js +4 -2
- package/dist/esm/experiments/runExperiment.js.map +1 -1
- package/dist/esm/prompts/createPrompt.d.ts +9 -9
- package/dist/esm/prompts/createPrompt.d.ts.map +1 -1
- package/dist/esm/prompts/sdks/toSDK.d.ts +2 -3
- package/dist/esm/prompts/sdks/toSDK.d.ts.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/jsonLiteralSchema.d.ts +2 -3
- package/dist/esm/schemas/jsonLiteralSchema.d.ts.map +1 -1
- package/dist/esm/schemas/jsonLiteralSchema.js +6 -1
- package/dist/esm/schemas/jsonLiteralSchema.js.map +1 -1
- package/dist/esm/schemas/llm/converters.d.ts +9 -7
- package/dist/esm/schemas/llm/converters.d.ts.map +1 -1
- package/dist/esm/schemas/llm/converters.js +9 -7
- package/dist/esm/schemas/llm/converters.js.map +1 -1
- package/dist/esm/spans/addSpanAnnotation.d.ts +1 -2
- package/dist/esm/spans/addSpanAnnotation.d.ts.map +1 -1
- package/dist/esm/spans/getSpanAnnotations.d.ts +2 -3
- package/dist/esm/spans/getSpanAnnotations.d.ts.map +1 -1
- package/dist/esm/spans/getSpans.d.ts +2 -3
- package/dist/esm/spans/getSpans.d.ts.map +1 -1
- package/dist/esm/spans/logSpanAnnotations.d.ts +1 -2
- package/dist/esm/spans/logSpanAnnotations.d.ts.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/datasets.d.ts +22 -2
- package/dist/esm/types/datasets.d.ts.map +1 -1
- package/dist/esm/utils/urlUtils.d.ts +10 -7
- package/dist/esm/utils/urlUtils.d.ts.map +1 -1
- package/dist/esm/utils/urlUtils.js +10 -7
- package/dist/esm/utils/urlUtils.js.map +1 -1
- package/dist/src/client.d.ts +3 -4
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/datasets/getDataset.d.ts +5 -2
- package/dist/src/datasets/getDataset.d.ts.map +1 -1
- package/dist/src/datasets/getDataset.js +5 -3
- package/dist/src/datasets/getDataset.js.map +1 -1
- package/dist/src/datasets/getDatasetExamples.d.ts +5 -2
- package/dist/src/datasets/getDatasetExamples.d.ts.map +1 -1
- package/dist/src/datasets/getDatasetExamples.js +9 -2
- package/dist/src/datasets/getDatasetExamples.js.map +1 -1
- package/dist/src/datasets/getDatasetInfo.d.ts +1 -0
- package/dist/src/datasets/getDatasetInfo.d.ts.map +1 -1
- package/dist/src/datasets/getDatasetInfo.js +1 -0
- package/dist/src/datasets/getDatasetInfo.js.map +1 -1
- package/dist/src/datasets/index.d.ts +0 -1
- package/dist/src/datasets/index.d.ts.map +1 -1
- package/dist/src/datasets/index.js +0 -1
- package/dist/src/datasets/index.js.map +1 -1
- package/dist/src/datasets/listDatasets.d.ts +1 -2
- package/dist/src/datasets/listDatasets.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.d.ts +4 -2
- package/dist/src/experiments/runExperiment.d.ts.map +1 -1
- package/dist/src/experiments/runExperiment.js +4 -2
- package/dist/src/experiments/runExperiment.js.map +1 -1
- package/dist/src/prompts/createPrompt.d.ts +9 -9
- package/dist/src/prompts/createPrompt.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toSDK.d.ts +2 -3
- package/dist/src/prompts/sdks/toSDK.d.ts.map +1 -1
- package/dist/src/prompts/sdks/toSDK.js +5 -5
- package/dist/src/prompts/sdks/toSDK.js.map +1 -1
- package/dist/src/schemas/jsonLiteralSchema.d.ts +2 -3
- package/dist/src/schemas/jsonLiteralSchema.d.ts.map +1 -1
- package/dist/src/schemas/jsonLiteralSchema.js +8 -3
- package/dist/src/schemas/jsonLiteralSchema.js.map +1 -1
- package/dist/src/schemas/llm/converters.d.ts +9 -7
- package/dist/src/schemas/llm/converters.d.ts.map +1 -1
- package/dist/src/schemas/llm/converters.js +9 -7
- package/dist/src/schemas/llm/converters.js.map +1 -1
- package/dist/src/spans/addSpanAnnotation.d.ts +1 -2
- package/dist/src/spans/addSpanAnnotation.d.ts.map +1 -1
- package/dist/src/spans/getSpanAnnotations.d.ts +2 -3
- package/dist/src/spans/getSpanAnnotations.d.ts.map +1 -1
- package/dist/src/spans/getSpans.d.ts +2 -3
- package/dist/src/spans/getSpans.d.ts.map +1 -1
- package/dist/src/spans/logSpanAnnotations.d.ts +1 -2
- package/dist/src/spans/logSpanAnnotations.d.ts.map +1 -1
- package/dist/src/types/datasets.d.ts +22 -2
- package/dist/src/types/datasets.d.ts.map +1 -1
- package/dist/src/utils/urlUtils.d.ts +10 -7
- package/dist/src/utils/urlUtils.d.ts.map +1 -1
- package/dist/src/utils/urlUtils.js +10 -7
- package/dist/src/utils/urlUtils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -7
- package/src/client.ts +3 -3
- package/src/datasets/getDataset.ts +6 -2
- package/src/datasets/getDatasetExamples.ts +14 -1
- package/src/datasets/getDatasetInfo.ts +2 -0
- package/src/datasets/index.ts +0 -1
- package/src/datasets/listDatasets.ts +1 -1
- package/src/experiments/runExperiment.ts +4 -2
- package/src/prompts/createPrompt.ts +9 -9
- package/src/prompts/sdks/toSDK.ts +5 -2
- package/src/schemas/jsonLiteralSchema.ts +7 -2
- package/src/schemas/llm/converters.ts +9 -7
- package/src/spans/addSpanAnnotation.ts +1 -1
- package/src/spans/getSpanAnnotations.ts +2 -2
- package/src/spans/getSpans.ts +2 -2
- package/src/spans/logSpanAnnotations.ts +1 -1
- package/src/types/datasets.ts +25 -2
- package/src/utils/urlUtils.ts +10 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arizeai/phoenix-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A client for the Phoenix API",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -40,8 +40,17 @@
|
|
|
40
40
|
"src",
|
|
41
41
|
"package.json"
|
|
42
42
|
],
|
|
43
|
-
"keywords": [
|
|
44
|
-
|
|
43
|
+
"keywords": [
|
|
44
|
+
"phoenix",
|
|
45
|
+
"arize",
|
|
46
|
+
"llm",
|
|
47
|
+
"tracing",
|
|
48
|
+
"evaluation",
|
|
49
|
+
"prompts",
|
|
50
|
+
"datasets",
|
|
51
|
+
"experiments"
|
|
52
|
+
],
|
|
53
|
+
"author": "oss@arize.com",
|
|
45
54
|
"license": "ELv2",
|
|
46
55
|
"devDependencies": {
|
|
47
56
|
"@ai-sdk/openai": "^1.1.15",
|
|
@@ -52,7 +61,6 @@
|
|
|
52
61
|
"openai": "^4.77.0",
|
|
53
62
|
"openapi-typescript": "^7.6.1",
|
|
54
63
|
"tsx": "^4.19.3",
|
|
55
|
-
"typedoc": "^0.27.9",
|
|
56
64
|
"vitest": "^2.1.9"
|
|
57
65
|
},
|
|
58
66
|
"dependencies": {
|
|
@@ -86,8 +94,6 @@
|
|
|
86
94
|
"build": "tsc --build tsconfig.json tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
|
|
87
95
|
"postbuild": "echo '{\"type\": \"module\"}' > ./dist/esm/package.json && rimraf dist/test dist/examples",
|
|
88
96
|
"type:check": "tsc --noEmit",
|
|
89
|
-
"test": "vitest --typecheck"
|
|
90
|
-
"docs": "typedoc",
|
|
91
|
-
"docs:preview": "pnpx http-server ./docs -p 8080 -o"
|
|
97
|
+
"test": "vitest --typecheck"
|
|
92
98
|
}
|
|
93
99
|
}
|
package/src/client.ts
CHANGED
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
makeDefaultClientOptions,
|
|
10
10
|
} from "./config";
|
|
11
11
|
|
|
12
|
-
type pathsV1 = oapiPathsV1;
|
|
13
|
-
type componentsV1 = oapiComponentsV1;
|
|
14
|
-
type operationsV1 = oapiOperationsV1;
|
|
12
|
+
export type pathsV1 = oapiPathsV1;
|
|
13
|
+
export type componentsV1 = oapiComponentsV1;
|
|
14
|
+
export type operationsV1 = oapiOperationsV1;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Generated openapi types for the Phoenix client, by API version.
|
|
@@ -6,19 +6,23 @@ import { getDatasetInfo } from "./getDatasetInfo";
|
|
|
6
6
|
|
|
7
7
|
export type GetDatasetParams = ClientFn & {
|
|
8
8
|
dataset: DatasetSelector;
|
|
9
|
+
versionId?: string;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* Get dataset info and
|
|
13
|
+
* Get dataset info and examples from the dataset
|
|
14
|
+
* @param dataset - Dataset selector (ID or name)
|
|
15
|
+
* @param versionId - Optional specific version ID (if omitted, returns data from the latest version)
|
|
13
16
|
*/
|
|
14
17
|
export async function getDataset({
|
|
15
18
|
client: _client,
|
|
16
19
|
dataset,
|
|
20
|
+
versionId,
|
|
17
21
|
}: GetDatasetParams): Promise<Dataset> {
|
|
18
22
|
const client = _client || createClient();
|
|
19
23
|
const [datasetInfo, datasetExamples] = await Promise.all([
|
|
20
24
|
getDatasetInfo({ client, dataset }),
|
|
21
|
-
getDatasetExamples({ client, dataset }),
|
|
25
|
+
getDatasetExamples({ client, dataset, versionId }),
|
|
22
26
|
]);
|
|
23
27
|
return {
|
|
24
28
|
...datasetInfo,
|
|
@@ -6,17 +6,23 @@ import { getDatasetInfoByName } from "./getDatasetInfoByName";
|
|
|
6
6
|
|
|
7
7
|
export type GetDatasetExamplesParams = ClientFn & {
|
|
8
8
|
dataset: DatasetSelector;
|
|
9
|
+
versionId?: string;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* Get
|
|
13
|
+
* Get examples from a dataset
|
|
14
|
+
* @param dataset - Dataset selector (ID, name, or version ID)
|
|
15
|
+
* @param versionId - Optional specific version ID (ignored if dataset selector is datasetVersionId)
|
|
13
16
|
*/
|
|
14
17
|
export async function getDatasetExamples({
|
|
15
18
|
client: _client,
|
|
16
19
|
dataset,
|
|
20
|
+
versionId,
|
|
17
21
|
}: GetDatasetExamplesParams): Promise<DatasetExamples> {
|
|
18
22
|
const client = _client || createClient();
|
|
23
|
+
|
|
19
24
|
let datasetId: string;
|
|
25
|
+
|
|
20
26
|
if ("datasetName" in dataset) {
|
|
21
27
|
const datasetInfo = await getDatasetInfoByName({
|
|
22
28
|
client,
|
|
@@ -26,13 +32,20 @@ export async function getDatasetExamples({
|
|
|
26
32
|
} else {
|
|
27
33
|
datasetId = dataset.datasetId;
|
|
28
34
|
}
|
|
35
|
+
|
|
29
36
|
const response = await client.GET("/v1/datasets/{id}/examples", {
|
|
30
37
|
params: {
|
|
31
38
|
path: {
|
|
32
39
|
id: datasetId,
|
|
33
40
|
},
|
|
41
|
+
query: versionId
|
|
42
|
+
? {
|
|
43
|
+
version_id: versionId,
|
|
44
|
+
}
|
|
45
|
+
: undefined,
|
|
34
46
|
},
|
|
35
47
|
});
|
|
48
|
+
|
|
36
49
|
invariant(response.data?.data, "Failed to get dataset examples");
|
|
37
50
|
const examplesData = response.data.data;
|
|
38
51
|
return {
|
|
@@ -11,12 +11,14 @@ export type GetDatasetInfoParams = ClientFn & {
|
|
|
11
11
|
/**
|
|
12
12
|
* Get an overview of the information in a dataset
|
|
13
13
|
* Note: this does not include the examples contained in the dataset
|
|
14
|
+
* Dataset info is not version-specific, only examples are versioned
|
|
14
15
|
*/
|
|
15
16
|
export async function getDatasetInfo({
|
|
16
17
|
client: _client,
|
|
17
18
|
dataset,
|
|
18
19
|
}: GetDatasetInfoParams): Promise<DatasetInfo> {
|
|
19
20
|
const client = _client || createClient();
|
|
21
|
+
|
|
20
22
|
if ("datasetName" in dataset) {
|
|
21
23
|
return await getDatasetInfoByName({
|
|
22
24
|
client,
|
package/src/datasets/index.ts
CHANGED
|
@@ -684,8 +684,10 @@ async function runEvaluator({
|
|
|
684
684
|
*
|
|
685
685
|
* @experimental This feature is not complete, and will change in the future.
|
|
686
686
|
*
|
|
687
|
-
* @param
|
|
688
|
-
* @param
|
|
687
|
+
* @param params - The parameters for creating the evaluator
|
|
688
|
+
* @param params.name - The name of the evaluator.
|
|
689
|
+
* @param params.kind - The kind of evaluator (e.g., "CODE", "LLM")
|
|
690
|
+
* @param params.evaluate - The evaluator function.
|
|
689
691
|
* @returns The evaluator object.
|
|
690
692
|
*/
|
|
691
693
|
export function asEvaluator({
|
|
@@ -82,17 +82,17 @@ interface PromptVersionInputBase {
|
|
|
82
82
|
templateFormat?: PromptVersionData["template_format"];
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
interface OpenAIPromptVersionInput extends PromptVersionInputBase {
|
|
85
|
+
export interface OpenAIPromptVersionInput extends PromptVersionInputBase {
|
|
86
86
|
modelProvider: "OPENAI";
|
|
87
87
|
invocationParameters?: OpenAIInvocationParameters;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
interface AzureOpenAIPromptVersionInput extends PromptVersionInputBase {
|
|
90
|
+
export interface AzureOpenAIPromptVersionInput extends PromptVersionInputBase {
|
|
91
91
|
modelProvider: "AZURE_OPENAI";
|
|
92
92
|
invocationParameters?: AzureOpenAIInvocationParameters;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
interface AnthropicPromptVersionInput extends PromptVersionInputBase {
|
|
95
|
+
export interface AnthropicPromptVersionInput extends PromptVersionInputBase {
|
|
96
96
|
modelProvider: "ANTHROPIC";
|
|
97
97
|
/**
|
|
98
98
|
* The invocation parameters for the prompt version.
|
|
@@ -101,32 +101,32 @@ interface AnthropicPromptVersionInput extends PromptVersionInputBase {
|
|
|
101
101
|
invocationParameters: AnthropicInvocationParameters;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
interface GooglePromptVersionInput extends PromptVersionInputBase {
|
|
104
|
+
export interface GooglePromptVersionInput extends PromptVersionInputBase {
|
|
105
105
|
modelProvider: "GOOGLE";
|
|
106
106
|
invocationParameters?: GoogleInvocationParameters;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
interface DeepSeekPromptVersionInput extends PromptVersionInputBase {
|
|
109
|
+
export interface DeepSeekPromptVersionInput extends PromptVersionInputBase {
|
|
110
110
|
modelProvider: "DEEPSEEK";
|
|
111
111
|
invocationParameters?: DeepSeekInvocationParameters;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
interface XAIPromptVersionInput extends PromptVersionInputBase {
|
|
114
|
+
export interface XAIPromptVersionInput extends PromptVersionInputBase {
|
|
115
115
|
modelProvider: "XAI";
|
|
116
116
|
invocationParameters?: XAIInvocationParameters;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
interface OllamaPromptVersionInput extends PromptVersionInputBase {
|
|
119
|
+
export interface OllamaPromptVersionInput extends PromptVersionInputBase {
|
|
120
120
|
modelProvider: "OLLAMA";
|
|
121
121
|
invocationParameters?: OllamaInvocationParameters;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
interface AwsPromptVersionInput extends PromptVersionInputBase {
|
|
124
|
+
export interface AwsPromptVersionInput extends PromptVersionInputBase {
|
|
125
125
|
modelProvider: "AWS";
|
|
126
126
|
invocationParameters?: AwsInvocationParameters;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
type PromptVersionInput =
|
|
129
|
+
export type PromptVersionInput =
|
|
130
130
|
| OpenAIPromptVersionInput
|
|
131
131
|
| AzureOpenAIPromptVersionInput
|
|
132
132
|
| AnthropicPromptVersionInput
|
|
@@ -23,7 +23,7 @@ export type SDKParams<T extends SupportedSDK> = Parameters<
|
|
|
23
23
|
/**
|
|
24
24
|
* Map of SDK names to their corresponding conversion functions
|
|
25
25
|
*/
|
|
26
|
-
const PROVIDER_TO_SDK = {
|
|
26
|
+
export const PROVIDER_TO_SDK = {
|
|
27
27
|
openai: toOpenAI,
|
|
28
28
|
anthropic: toAnthropic,
|
|
29
29
|
ai: toAI,
|
|
@@ -48,7 +48,10 @@ const getTargetSDK = <T extends SupportedSDK>(sdk: T) => {
|
|
|
48
48
|
/**
|
|
49
49
|
* Parameters specific to the toSDK function
|
|
50
50
|
*/
|
|
51
|
-
type ToSDKParams<
|
|
51
|
+
export type ToSDKParams<
|
|
52
|
+
T extends SupportedSDK,
|
|
53
|
+
V extends Variables = Variables,
|
|
54
|
+
> = {
|
|
52
55
|
/**
|
|
53
56
|
* String representing the SDK to convert to
|
|
54
57
|
*/
|
|
@@ -4,8 +4,13 @@ import z from "zod";
|
|
|
4
4
|
* The zod schema for JSON literal primitives
|
|
5
5
|
* @see {@link https://zod.dev/?id=json-type|Zod Documentation}
|
|
6
6
|
*/
|
|
7
|
-
const literalSchema = z.union([
|
|
8
|
-
|
|
7
|
+
export const literalSchema = z.union([
|
|
8
|
+
z.string(),
|
|
9
|
+
z.number(),
|
|
10
|
+
z.boolean(),
|
|
11
|
+
z.null(),
|
|
12
|
+
]);
|
|
13
|
+
export type Literal = z.infer<typeof literalSchema>;
|
|
9
14
|
export type JSONLiteral =
|
|
10
15
|
| Literal
|
|
11
16
|
| { [key: string]: JSONLiteral }
|
|
@@ -211,7 +211,7 @@ export const fromOpenAIMessage = <
|
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
213
|
* Converts a tool call to the OpenAI format if possible
|
|
214
|
-
* @param
|
|
214
|
+
* @param maybeToolCall a tool call from an unknown LlmProvider
|
|
215
215
|
* @returns the tool call parsed to the OpenAI format
|
|
216
216
|
*/
|
|
217
217
|
export const toOpenAIToolCall = (
|
|
@@ -243,8 +243,9 @@ export const toOpenAIToolCall = (
|
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
245
|
* Converts a tool call to a target provider format
|
|
246
|
-
* @param
|
|
247
|
-
* @param
|
|
246
|
+
* @param params the parameters object
|
|
247
|
+
* @param params.toolCall the tool call to convert
|
|
248
|
+
* @param params.targetProvider the provider to convert the tool call to
|
|
248
249
|
* @returns the tool call in the target provider format
|
|
249
250
|
*/
|
|
250
251
|
export const fromOpenAIToolCall = <
|
|
@@ -316,10 +317,11 @@ export const toOpenAIToolChoice = (
|
|
|
316
317
|
};
|
|
317
318
|
|
|
318
319
|
/**
|
|
319
|
-
* Converts a tool
|
|
320
|
-
* @param
|
|
321
|
-
* @param
|
|
322
|
-
* @
|
|
320
|
+
* Converts a tool choice to a target provider format
|
|
321
|
+
* @param params the parameters object
|
|
322
|
+
* @param params.toolChoice the tool choice to convert
|
|
323
|
+
* @param params.targetProvider the provider to convert the tool choice to
|
|
324
|
+
* @returns the tool choice in the target provider format
|
|
323
325
|
*/
|
|
324
326
|
export const fromOpenAIToolChoice = <
|
|
325
327
|
TargetProviderSDK extends NonNullable<PromptSDKFormat>,
|
|
@@ -5,7 +5,7 @@ import { SpanAnnotation, toSpanAnnotationData } from "./types";
|
|
|
5
5
|
/**
|
|
6
6
|
* Parameters to add a span annotation
|
|
7
7
|
*/
|
|
8
|
-
interface AddSpanAnnotationParams extends ClientFn {
|
|
8
|
+
export interface AddSpanAnnotationParams extends ClientFn {
|
|
9
9
|
spanAnnotation: SpanAnnotation;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -6,7 +6,7 @@ import { ProjectSelector } from "../types/projects";
|
|
|
6
6
|
/**
|
|
7
7
|
* Parameters to get span annotations from a project using auto-generated types
|
|
8
8
|
*/
|
|
9
|
-
interface GetSpanAnnotationsParams extends ClientFn {
|
|
9
|
+
export interface GetSpanAnnotationsParams extends ClientFn {
|
|
10
10
|
/** The project to get span annotations from */
|
|
11
11
|
project: ProjectSelector;
|
|
12
12
|
/** One or more span IDs to fetch annotations for */
|
|
@@ -21,7 +21,7 @@ interface GetSpanAnnotationsParams extends ClientFn {
|
|
|
21
21
|
limit?: number;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
type GetSpanAnnotationsResponse =
|
|
24
|
+
export type GetSpanAnnotationsResponse =
|
|
25
25
|
operations["listSpanAnnotationsBySpanIds"]["responses"]["200"];
|
|
26
26
|
|
|
27
27
|
export type GetSpanAnnotationsResult = {
|
package/src/spans/getSpans.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ProjectSelector } from "../types/projects";
|
|
|
6
6
|
/**
|
|
7
7
|
* Parameters to get spans from a project using auto-generated types
|
|
8
8
|
*/
|
|
9
|
-
interface GetSpansParams extends ClientFn {
|
|
9
|
+
export interface GetSpansParams extends ClientFn {
|
|
10
10
|
/** The project to get spans from */
|
|
11
11
|
project: ProjectSelector;
|
|
12
12
|
/** Inclusive lower bound time. Must be a valid ISO 8601 string or Date object. */
|
|
@@ -19,7 +19,7 @@ interface GetSpansParams extends ClientFn {
|
|
|
19
19
|
limit?: number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
type GetSpansResponse = operations["getSpans"]["responses"]["200"];
|
|
22
|
+
export type GetSpansResponse = operations["getSpans"]["responses"]["200"];
|
|
23
23
|
|
|
24
24
|
export type GetSpansResult = {
|
|
25
25
|
spans: GetSpansResponse["content"]["application/json"]["data"];
|
|
@@ -5,7 +5,7 @@ import { SpanAnnotation, toSpanAnnotationData } from "./types";
|
|
|
5
5
|
/**
|
|
6
6
|
* Parameters to log multiple span annotations
|
|
7
7
|
*/
|
|
8
|
-
interface LogSpanAnnotationsParams extends ClientFn {
|
|
8
|
+
export interface LogSpanAnnotationsParams extends ClientFn {
|
|
9
9
|
/**
|
|
10
10
|
* The span annotations to log
|
|
11
11
|
*/
|
package/src/types/datasets.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { Node } from "./core";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A dataset can be identified by its datasetId
|
|
5
|
-
* TODO: add support for datasetVersionId via discriminated union
|
|
4
|
+
* A dataset can be identified by its datasetId, datasetName, or datasetVersionId
|
|
6
5
|
*/
|
|
7
6
|
export type DatasetSelector = { datasetId: string } | { datasetName: string };
|
|
8
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Parameters for selecting a specific version of a dataset
|
|
10
|
+
*/
|
|
11
|
+
export interface DatasetVersionSelector {
|
|
12
|
+
dataset: DatasetSelector;
|
|
13
|
+
versionId?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* Overview information about a dataset
|
|
11
18
|
*/
|
|
@@ -15,6 +22,15 @@ export interface DatasetInfo extends Node {
|
|
|
15
22
|
metadata?: Record<string, unknown>;
|
|
16
23
|
}
|
|
17
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Information about a dataset version
|
|
27
|
+
*/
|
|
28
|
+
export interface DatasetVersionInfo extends Node {
|
|
29
|
+
description?: string | null;
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
/**
|
|
19
35
|
* A dataset's examples
|
|
20
36
|
*/
|
|
@@ -46,3 +62,10 @@ export interface ExampleWithId extends Example, Node {
|
|
|
46
62
|
* A dataset is a collection of examples for an AI task
|
|
47
63
|
*/
|
|
48
64
|
export interface Dataset extends DatasetInfo, DatasetExamples, Node {}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A dataset with its version information
|
|
68
|
+
*/
|
|
69
|
+
export interface DatasetWithVersion extends Dataset {
|
|
70
|
+
versionInfo: DatasetVersionInfo;
|
|
71
|
+
}
|
package/src/utils/urlUtils.ts
CHANGED
|
@@ -13,9 +13,10 @@ function getWebBaseUrl(baseUrl: string): string {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Get the URL to view a specific experiment in the Phoenix web UI
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
16
|
+
* @param params - The parameters for generating the experiment URL
|
|
17
|
+
* @param params.baseUrl - The base URL of the Phoenix API
|
|
18
|
+
* @param params.datasetId - The ID of the dataset
|
|
19
|
+
* @param params.experimentId - The ID of the experiment
|
|
19
20
|
* @returns The URL to view the experiment
|
|
20
21
|
*/
|
|
21
22
|
export function getExperimentUrl({
|
|
@@ -32,8 +33,9 @@ export function getExperimentUrl({
|
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* Get the URL to view experiments for a dataset in the Phoenix web UI
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
36
|
+
* @param params - The parameters for generating the dataset experiments URL
|
|
37
|
+
* @param params.baseUrl - The base URL of the Phoenix API
|
|
38
|
+
* @param params.datasetId - The ID of the dataset
|
|
37
39
|
* @returns The URL to view dataset experiments
|
|
38
40
|
*/
|
|
39
41
|
export function getDatasetExperimentsUrl({
|
|
@@ -48,8 +50,9 @@ export function getDatasetExperimentsUrl({
|
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* Get the URL to view a dataset in the Phoenix web UI
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
+
* @param params - The parameters for generating the dataset URL
|
|
54
|
+
* @param params.baseUrl - The base URL of the Phoenix API
|
|
55
|
+
* @param params.datasetId - The ID of the dataset
|
|
53
56
|
* @returns The URL to view the dataset
|
|
54
57
|
*/
|
|
55
58
|
export function getDatasetUrl({
|