@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.
Files changed (124) hide show
  1. package/dist/esm/client.d.ts +3 -4
  2. package/dist/esm/client.d.ts.map +1 -1
  3. package/dist/esm/datasets/getDataset.d.ts +5 -2
  4. package/dist/esm/datasets/getDataset.d.ts.map +1 -1
  5. package/dist/esm/datasets/getDataset.js +5 -3
  6. package/dist/esm/datasets/getDataset.js.map +1 -1
  7. package/dist/esm/datasets/getDatasetExamples.d.ts +5 -2
  8. package/dist/esm/datasets/getDatasetExamples.d.ts.map +1 -1
  9. package/dist/esm/datasets/getDatasetExamples.js +9 -2
  10. package/dist/esm/datasets/getDatasetExamples.js.map +1 -1
  11. package/dist/esm/datasets/getDatasetInfo.d.ts +1 -0
  12. package/dist/esm/datasets/getDatasetInfo.d.ts.map +1 -1
  13. package/dist/esm/datasets/getDatasetInfo.js +1 -0
  14. package/dist/esm/datasets/getDatasetInfo.js.map +1 -1
  15. package/dist/esm/datasets/index.d.ts +0 -1
  16. package/dist/esm/datasets/index.d.ts.map +1 -1
  17. package/dist/esm/datasets/index.js +0 -1
  18. package/dist/esm/datasets/index.js.map +1 -1
  19. package/dist/esm/datasets/listDatasets.d.ts +1 -2
  20. package/dist/esm/datasets/listDatasets.d.ts.map +1 -1
  21. package/dist/esm/experiments/runExperiment.d.ts +4 -2
  22. package/dist/esm/experiments/runExperiment.d.ts.map +1 -1
  23. package/dist/esm/experiments/runExperiment.js +4 -2
  24. package/dist/esm/experiments/runExperiment.js.map +1 -1
  25. package/dist/esm/prompts/createPrompt.d.ts +9 -9
  26. package/dist/esm/prompts/createPrompt.d.ts.map +1 -1
  27. package/dist/esm/prompts/sdks/toSDK.d.ts +2 -3
  28. package/dist/esm/prompts/sdks/toSDK.d.ts.map +1 -1
  29. package/dist/esm/prompts/sdks/toSDK.js +1 -1
  30. package/dist/esm/prompts/sdks/toSDK.js.map +1 -1
  31. package/dist/esm/schemas/jsonLiteralSchema.d.ts +2 -3
  32. package/dist/esm/schemas/jsonLiteralSchema.d.ts.map +1 -1
  33. package/dist/esm/schemas/jsonLiteralSchema.js +6 -1
  34. package/dist/esm/schemas/jsonLiteralSchema.js.map +1 -1
  35. package/dist/esm/schemas/llm/converters.d.ts +9 -7
  36. package/dist/esm/schemas/llm/converters.d.ts.map +1 -1
  37. package/dist/esm/schemas/llm/converters.js +9 -7
  38. package/dist/esm/schemas/llm/converters.js.map +1 -1
  39. package/dist/esm/spans/addSpanAnnotation.d.ts +1 -2
  40. package/dist/esm/spans/addSpanAnnotation.d.ts.map +1 -1
  41. package/dist/esm/spans/getSpanAnnotations.d.ts +2 -3
  42. package/dist/esm/spans/getSpanAnnotations.d.ts.map +1 -1
  43. package/dist/esm/spans/getSpans.d.ts +2 -3
  44. package/dist/esm/spans/getSpans.d.ts.map +1 -1
  45. package/dist/esm/spans/logSpanAnnotations.d.ts +1 -2
  46. package/dist/esm/spans/logSpanAnnotations.d.ts.map +1 -1
  47. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  48. package/dist/esm/types/datasets.d.ts +22 -2
  49. package/dist/esm/types/datasets.d.ts.map +1 -1
  50. package/dist/esm/utils/urlUtils.d.ts +10 -7
  51. package/dist/esm/utils/urlUtils.d.ts.map +1 -1
  52. package/dist/esm/utils/urlUtils.js +10 -7
  53. package/dist/esm/utils/urlUtils.js.map +1 -1
  54. package/dist/src/client.d.ts +3 -4
  55. package/dist/src/client.d.ts.map +1 -1
  56. package/dist/src/datasets/getDataset.d.ts +5 -2
  57. package/dist/src/datasets/getDataset.d.ts.map +1 -1
  58. package/dist/src/datasets/getDataset.js +5 -3
  59. package/dist/src/datasets/getDataset.js.map +1 -1
  60. package/dist/src/datasets/getDatasetExamples.d.ts +5 -2
  61. package/dist/src/datasets/getDatasetExamples.d.ts.map +1 -1
  62. package/dist/src/datasets/getDatasetExamples.js +9 -2
  63. package/dist/src/datasets/getDatasetExamples.js.map +1 -1
  64. package/dist/src/datasets/getDatasetInfo.d.ts +1 -0
  65. package/dist/src/datasets/getDatasetInfo.d.ts.map +1 -1
  66. package/dist/src/datasets/getDatasetInfo.js +1 -0
  67. package/dist/src/datasets/getDatasetInfo.js.map +1 -1
  68. package/dist/src/datasets/index.d.ts +0 -1
  69. package/dist/src/datasets/index.d.ts.map +1 -1
  70. package/dist/src/datasets/index.js +0 -1
  71. package/dist/src/datasets/index.js.map +1 -1
  72. package/dist/src/datasets/listDatasets.d.ts +1 -2
  73. package/dist/src/datasets/listDatasets.d.ts.map +1 -1
  74. package/dist/src/experiments/runExperiment.d.ts +4 -2
  75. package/dist/src/experiments/runExperiment.d.ts.map +1 -1
  76. package/dist/src/experiments/runExperiment.js +4 -2
  77. package/dist/src/experiments/runExperiment.js.map +1 -1
  78. package/dist/src/prompts/createPrompt.d.ts +9 -9
  79. package/dist/src/prompts/createPrompt.d.ts.map +1 -1
  80. package/dist/src/prompts/sdks/toSDK.d.ts +2 -3
  81. package/dist/src/prompts/sdks/toSDK.d.ts.map +1 -1
  82. package/dist/src/prompts/sdks/toSDK.js +5 -5
  83. package/dist/src/prompts/sdks/toSDK.js.map +1 -1
  84. package/dist/src/schemas/jsonLiteralSchema.d.ts +2 -3
  85. package/dist/src/schemas/jsonLiteralSchema.d.ts.map +1 -1
  86. package/dist/src/schemas/jsonLiteralSchema.js +8 -3
  87. package/dist/src/schemas/jsonLiteralSchema.js.map +1 -1
  88. package/dist/src/schemas/llm/converters.d.ts +9 -7
  89. package/dist/src/schemas/llm/converters.d.ts.map +1 -1
  90. package/dist/src/schemas/llm/converters.js +9 -7
  91. package/dist/src/schemas/llm/converters.js.map +1 -1
  92. package/dist/src/spans/addSpanAnnotation.d.ts +1 -2
  93. package/dist/src/spans/addSpanAnnotation.d.ts.map +1 -1
  94. package/dist/src/spans/getSpanAnnotations.d.ts +2 -3
  95. package/dist/src/spans/getSpanAnnotations.d.ts.map +1 -1
  96. package/dist/src/spans/getSpans.d.ts +2 -3
  97. package/dist/src/spans/getSpans.d.ts.map +1 -1
  98. package/dist/src/spans/logSpanAnnotations.d.ts +1 -2
  99. package/dist/src/spans/logSpanAnnotations.d.ts.map +1 -1
  100. package/dist/src/types/datasets.d.ts +22 -2
  101. package/dist/src/types/datasets.d.ts.map +1 -1
  102. package/dist/src/utils/urlUtils.d.ts +10 -7
  103. package/dist/src/utils/urlUtils.d.ts.map +1 -1
  104. package/dist/src/utils/urlUtils.js +10 -7
  105. package/dist/src/utils/urlUtils.js.map +1 -1
  106. package/dist/tsconfig.tsbuildinfo +1 -1
  107. package/package.json +13 -7
  108. package/src/client.ts +3 -3
  109. package/src/datasets/getDataset.ts +6 -2
  110. package/src/datasets/getDatasetExamples.ts +14 -1
  111. package/src/datasets/getDatasetInfo.ts +2 -0
  112. package/src/datasets/index.ts +0 -1
  113. package/src/datasets/listDatasets.ts +1 -1
  114. package/src/experiments/runExperiment.ts +4 -2
  115. package/src/prompts/createPrompt.ts +9 -9
  116. package/src/prompts/sdks/toSDK.ts +5 -2
  117. package/src/schemas/jsonLiteralSchema.ts +7 -2
  118. package/src/schemas/llm/converters.ts +9 -7
  119. package/src/spans/addSpanAnnotation.ts +1 -1
  120. package/src/spans/getSpanAnnotations.ts +2 -2
  121. package/src/spans/getSpans.ts +2 -2
  122. package/src/spans/logSpanAnnotations.ts +1 -1
  123. package/src/types/datasets.ts +25 -2
  124. 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.4",
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
- "author": "",
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 the examples from the latest version of the dataset
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 the latest examples from a dataset
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,
@@ -2,5 +2,4 @@ export * from "./createDataset";
2
2
  export * from "./getDataset";
3
3
  export * from "./getDatasetExamples";
4
4
  export * from "./appendDatasetExamples";
5
- export * from "./getDatasetExamples";
6
5
  export * from "./getDatasetInfo";
@@ -5,7 +5,7 @@ import invariant from "tiny-invariant";
5
5
 
6
6
  export type ListDatasetsParams = ClientFn;
7
7
 
8
- type FullDatasetInfo = DatasetInfo & {
8
+ export type FullDatasetInfo = DatasetInfo & {
9
9
  startDate: Date;
10
10
  endDate: Date;
11
11
  };
@@ -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 name - The name of the evaluator.
688
- * @param evaluate - The evaluator function.
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<T extends SupportedSDK, V extends Variables = Variables> = {
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([z.string(), z.number(), z.boolean(), z.null()]);
8
- type Literal = z.infer<typeof literalSchema>;
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 toolCall a tool call from an unknown LlmProvider
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 toolCall the tool call to convert
247
- * @param targetProvider the provider to convert the tool call to
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 call to a target provider format
320
- * @param toolCall the tool call to convert
321
- * @param targetProvider the provider to convert the tool call to
322
- * @returns the tool call in the target provider format
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 = {
@@ -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
  */
@@ -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
+ }
@@ -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 baseUrl The base URL of the Phoenix API
17
- * @param datasetId The ID of the dataset
18
- * @param experimentId The ID of the experiment
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 baseUrl The base URL of the Phoenix API
36
- * @param datasetId The ID of the dataset
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 baseUrl The base URL of the Phoenix API
52
- * @param datasetId The ID of the dataset
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({