@arizeai/phoenix-client
Version:
A client for the Phoenix API
28 lines • 921 B
JavaScript
import { createClient } from "../client.js";
/**
* Get the information of a dataset via the name
*/
export async function getDatasetInfoByName({ client: _client, datasetName, }) {
const client = _client || createClient();
const response = await client.GET("/v1/datasets", {
params: {
query: {
name: datasetName,
},
},
});
if (response.data?.data?.length) {
const datasetInfo = response.data.data[0];
if (!datasetInfo) {
throw new Error(`Dataset with name ${datasetName} not found`);
}
return {
id: datasetInfo.id,
name: datasetInfo.name,
description: datasetInfo.description || undefined,
metadata: datasetInfo.metadata,
};
}
throw new Error(`Dataset with name ${datasetName} not found`);
}
//# sourceMappingURL=getDatasetInfoByName.js.map