@arizeai/phoenix-client 2.3.5 → 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/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/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/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/types/datasets.d.ts +22 -2
- package/dist/src/types/datasets.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- 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/types/datasets.ts +25 -2
package/package.json
CHANGED
|
@@ -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
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
|
+
}
|