UNPKG

@arizeai/phoenix-client

Version:

A client for the Phoenix API

32 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDatasetInfoByName = getDatasetInfoByName; const client_1 = require("../client"); /** * Get the information of a dataset via the name */ async function getDatasetInfoByName({ client: _client, datasetName, }) { var _a, _b; const client = _client || (0, client_1.createClient)(); const response = await client.GET("/v1/datasets", { params: { query: { name: datasetName, }, }, }); if ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.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