UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

290 lines • 9.82 kB
import { APIResource } from "../../core/resource.mjs"; import { APIPromise } from "../../core/api-promise.mjs"; import { PagePromise, V4PagePaginationArray, type V4PagePaginationArrayParams } from "../../core/pagination.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; export declare class BaseDatasets extends APIResource { static readonly _key: readonly ['aiGateway', 'datasets']; /** * Creates a dataset that selects gateway logs matching the specified filters for * use in evaluations. Evaluations and datasets are deprecated and unavailable to * new accounts. * * @example * ```ts * const dataset = await client.aiGateway.datasets.create( * 'my-gateway', * { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * enable: true, * filters: [ * { * key: 'created_at', * operator: 'eq', * value: ['string'], * }, * ], * name: 'name', * }, * ); * ``` */ create(gatewayID: string, params: DatasetCreateParams, options?: RequestOptions): APIPromise<DatasetCreateResponse>; /** * Replaces the name, log filters, and enabled state of a dataset. Evaluations and * datasets are deprecated and unavailable to new accounts. * * @example * ```ts * const dataset = await client.aiGateway.datasets.update( * 'id', * { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * gateway_id: 'my-gateway', * enable: true, * filters: [ * { * key: 'created_at', * operator: 'eq', * value: ['string'], * }, * ], * name: 'name', * }, * ); * ``` */ update(id: string, params: DatasetUpdateParams, options?: RequestOptions): APIPromise<DatasetUpdateResponse>; /** * Lists the datasets defined for an AI Gateway. Evaluations and datasets are * deprecated and unavailable to new accounts. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const datasetListResponse of client.aiGateway.datasets.list( * 'my-gateway', * { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, * )) { * // ... * } * ``` */ list(gatewayID: string, params: DatasetListParams, options?: RequestOptions): PagePromise<DatasetListResponsesV4PagePaginationArray, DatasetListResponse>; /** * Deletes a dataset. Evaluations and datasets are deprecated and unavailable to * new accounts. * * @example * ```ts * const dataset = await client.aiGateway.datasets.delete( * 'id', * { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * gateway_id: 'my-gateway', * }, * ); * ``` */ delete(id: string, params: DatasetDeleteParams, options?: RequestOptions): APIPromise<DatasetDeleteResponse>; /** * Retrieves a dataset and its log filters. Evaluations and datasets are deprecated * and unavailable to new accounts. * * @example * ```ts * const dataset = await client.aiGateway.datasets.get('id', { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * gateway_id: 'my-gateway', * }); * ``` */ get(id: string, params: DatasetGetParams, options?: RequestOptions): APIPromise<DatasetGetResponse>; } export declare class Datasets extends BaseDatasets { } export type DatasetListResponsesV4PagePaginationArray = V4PagePaginationArray<DatasetListResponse>; export interface DatasetCreateResponse { id: string; created_at: string; enable: boolean; filters: Array<DatasetCreateResponse.Filter>; /** * Unique identifier of the AI Gateway within the account. */ gateway_id: string; modified_at: string; name: string; } export declare namespace DatasetCreateResponse { interface Filter { key: 'created_at' | 'request_content_type' | 'response_content_type' | 'success' | 'cached' | 'provider' | 'model' | 'cost' | 'tokens' | 'tokens_in' | 'tokens_out' | 'duration' | 'feedback'; operator: 'eq' | 'contains' | 'lt' | 'gt'; value: Array<string | number | boolean>; } } export interface DatasetUpdateResponse { id: string; created_at: string; enable: boolean; filters: Array<DatasetUpdateResponse.Filter>; /** * Unique identifier of the AI Gateway within the account. */ gateway_id: string; modified_at: string; name: string; } export declare namespace DatasetUpdateResponse { interface Filter { key: 'created_at' | 'request_content_type' | 'response_content_type' | 'success' | 'cached' | 'provider' | 'model' | 'cost' | 'tokens' | 'tokens_in' | 'tokens_out' | 'duration' | 'feedback'; operator: 'eq' | 'contains' | 'lt' | 'gt'; value: Array<string | number | boolean>; } } export interface DatasetListResponse { id: string; created_at: string; enable: boolean; filters: Array<DatasetListResponse.Filter>; /** * Unique identifier of the AI Gateway within the account. */ gateway_id: string; modified_at: string; name: string; } export declare namespace DatasetListResponse { interface Filter { key: 'created_at' | 'request_content_type' | 'response_content_type' | 'success' | 'cached' | 'provider' | 'model' | 'cost' | 'tokens' | 'tokens_in' | 'tokens_out' | 'duration' | 'feedback'; operator: 'eq' | 'contains' | 'lt' | 'gt'; value: Array<string | number | boolean>; } } export interface DatasetDeleteResponse { id: string; created_at: string; enable: boolean; filters: Array<DatasetDeleteResponse.Filter>; /** * Unique identifier of the AI Gateway within the account. */ gateway_id: string; modified_at: string; name: string; } export declare namespace DatasetDeleteResponse { interface Filter { key: 'created_at' | 'request_content_type' | 'response_content_type' | 'success' | 'cached' | 'provider' | 'model' | 'cost' | 'tokens' | 'tokens_in' | 'tokens_out' | 'duration' | 'feedback'; operator: 'eq' | 'contains' | 'lt' | 'gt'; value: Array<string | number | boolean>; } } export interface DatasetGetResponse { id: string; created_at: string; enable: boolean; filters: Array<DatasetGetResponse.Filter>; /** * Unique identifier of the AI Gateway within the account. */ gateway_id: string; modified_at: string; name: string; } export declare namespace DatasetGetResponse { interface Filter { key: 'created_at' | 'request_content_type' | 'response_content_type' | 'success' | 'cached' | 'provider' | 'model' | 'cost' | 'tokens' | 'tokens_in' | 'tokens_out' | 'duration' | 'feedback'; operator: 'eq' | 'contains' | 'lt' | 'gt'; value: Array<string | number | boolean>; } } export interface DatasetCreateParams { /** * Path param */ account_id: string; /** * Body param */ enable: boolean; /** * Body param */ filters: Array<DatasetCreateParams.Filter>; /** * Body param */ name: string; } export declare namespace DatasetCreateParams { interface Filter { key: 'created_at' | 'request_content_type' | 'response_content_type' | 'success' | 'cached' | 'provider' | 'model' | 'cost' | 'tokens' | 'tokens_in' | 'tokens_out' | 'duration' | 'feedback'; operator: 'eq' | 'contains' | 'lt' | 'gt'; value: Array<string | number | boolean>; } } export interface DatasetUpdateParams { /** * Path param */ account_id: string; /** * Path param: Unique identifier of the AI Gateway within the account. */ gateway_id: string; /** * Body param */ enable: boolean; /** * Body param */ filters: Array<DatasetUpdateParams.Filter>; /** * Body param */ name: string; } export declare namespace DatasetUpdateParams { interface Filter { key: 'created_at' | 'request_content_type' | 'response_content_type' | 'success' | 'cached' | 'provider' | 'model' | 'cost' | 'tokens' | 'tokens_in' | 'tokens_out' | 'duration' | 'feedback'; operator: 'eq' | 'contains' | 'lt' | 'gt'; value: Array<string | number | boolean>; } } export interface DatasetListParams extends V4PagePaginationArrayParams { /** * Path param */ account_id: string; /** * Query param */ enable?: boolean; /** * Query param */ name?: string; /** * Query param: Search by id, name, filters */ search?: string; } export interface DatasetDeleteParams { account_id: string; /** * Unique identifier of the AI Gateway within the account. */ gateway_id: string; } export interface DatasetGetParams { account_id: string; /** * Unique identifier of the AI Gateway within the account. */ gateway_id: string; } export declare namespace Datasets { export { type DatasetCreateResponse as DatasetCreateResponse, type DatasetUpdateResponse as DatasetUpdateResponse, type DatasetListResponse as DatasetListResponse, type DatasetDeleteResponse as DatasetDeleteResponse, type DatasetGetResponse as DatasetGetResponse, type DatasetListResponsesV4PagePaginationArray as DatasetListResponsesV4PagePaginationArray, type DatasetCreateParams as DatasetCreateParams, type DatasetUpdateParams as DatasetUpdateParams, type DatasetListParams as DatasetListParams, type DatasetDeleteParams as DatasetDeleteParams, type DatasetGetParams as DatasetGetParams, }; } //# sourceMappingURL=datasets.d.mts.map