@arizeai/phoenix-client
Version:
A client for the Phoenix API
26 lines • 856 B
JavaScript
import { createClient } from "../client.js";
import invariant from "tiny-invariant";
/**
* List the information about all datasets available to the client.
*
* @example
* ```ts
* import { listDatasets } from "@arizeai/phoenix-client/datasets";
*
* const datasets = await listDatasets({});
* console.log(datasets);
* ```
*
* @throws {Error} If the datasets cannot be listed or the response is invalid.
*/
export async function listDatasets({ client: _client, }) {
const client = _client || createClient();
const response = await client.GET("/v1/datasets");
invariant(response.data?.data, "Failed to list datasets");
return response.data.data.map((dataset) => ({
...dataset,
startDate: new Date(dataset.created_at),
endDate: new Date(dataset.updated_at),
}));
}
//# sourceMappingURL=listDatasets.js.map