UNPKG

@arizeai/phoenix-client

Version:

A client for the Phoenix API

40 lines 1.55 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDatasetInfo = getDatasetInfo; const client_1 = require("../client"); const getDatasetInfoByName_1 = require("./getDatasetInfoByName"); const tiny_invariant_1 = __importDefault(require("tiny-invariant")); /** * Get an overview of the information in a dataset * Note: this does not include the examples contained in the dataset * Dataset info is not version-specific, only examples are versioned */ async function getDatasetInfo({ client: _client, dataset, }) { var _a; const client = _client || (0, client_1.createClient)(); if ("datasetName" in dataset) { return await (0, getDatasetInfoByName_1.getDatasetInfoByName)({ client, datasetName: dataset.datasetName, }); } const datasetResponse = await client.GET("/v1/datasets/{id}", { params: { path: { id: dataset.datasetId, }, }, }); (0, tiny_invariant_1.default)((_a = datasetResponse.data) === null || _a === void 0 ? void 0 : _a.data, "Failed to get dataset info"); const datasetInfo = datasetResponse.data.data; return { id: datasetInfo.id, name: datasetInfo.name, description: datasetInfo.description || undefined, metadata: datasetInfo.metadata, }; } //# sourceMappingURL=getDatasetInfo.js.map