cloudflare
Version:
The official TypeScript library for the Cloudflare API
99 lines • 3.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Evaluations = exports.BaseEvaluations = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseEvaluations = /* @__PURE__ */ (() => {
class BaseEvaluations extends resource_1.APIResource {
/**
* Creates an evaluation that scores the logs in a dataset with the specified
* evaluator types. Evaluations and datasets are deprecated and unavailable to new
* accounts.
*
* @example
* ```ts
* const evaluation =
* await client.aiGateway.evaluations.create('my-gateway', {
* account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0',
* dataset_ids: ['string'],
* evaluation_type_ids: ['string'],
* name: 'name',
* });
* ```
*/
create(gatewayID, params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/ai-gateway/gateways/${gatewayID}/evaluations`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists the evaluations run on an AI Gateway. Evaluations and datasets are
* deprecated and unavailable to new accounts.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const evaluationListResponse of client.aiGateway.evaluations.list(
* 'my-gateway',
* { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' },
* )) {
* // ...
* }
* ```
*/
list(gatewayID, params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/ai-gateway/gateways/${gatewayID}/evaluations`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes an evaluation and its results. Evaluations and datasets are deprecated
* and unavailable to new accounts.
*
* @example
* ```ts
* const evaluation =
* await client.aiGateway.evaluations.delete('id', {
* account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0',
* gateway_id: 'my-gateway',
* });
* ```
*/
delete(id, params, options) {
const { account_id, gateway_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/evaluations/${id}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves an evaluation and its results. Evaluations and datasets are deprecated
* and unavailable to new accounts.
*
* @example
* ```ts
* const evaluation = await client.aiGateway.evaluations.get(
* 'id',
* {
* account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0',
* gateway_id: 'my-gateway',
* },
* );
* ```
*/
get(id, params, options) {
const { account_id, gateway_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/ai-gateway/gateways/${gateway_id}/evaluations/${id}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseEvaluations._key = Object.freeze([
'aiGateway',
'evaluations',
]);
return BaseEvaluations;
})();
exports.BaseEvaluations = BaseEvaluations;
class Evaluations extends BaseEvaluations {
}
exports.Evaluations = Evaluations;
//# sourceMappingURL=evaluations.js.map