cloudflare
Version:
The official TypeScript library for the Cloudflare API
319 lines • 10.3 kB
text/typescript
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 BaseEvaluations extends APIResource {
static readonly _key: readonly ['aiGateway', 'evaluations'];
/**
* 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: string, params: EvaluationCreateParams, options?: RequestOptions): APIPromise<EvaluationCreateResponse>;
/**
* 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: string, params: EvaluationListParams, options?: RequestOptions): PagePromise<EvaluationListResponsesV4PagePaginationArray, EvaluationListResponse>;
/**
* 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: string, params: EvaluationDeleteParams, options?: RequestOptions): APIPromise<EvaluationDeleteResponse>;
/**
* 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: string, params: EvaluationGetParams, options?: RequestOptions): APIPromise<EvaluationGetResponse>;
}
export declare class Evaluations extends BaseEvaluations {
}
export type EvaluationListResponsesV4PagePaginationArray = V4PagePaginationArray<EvaluationListResponse>;
export interface EvaluationCreateResponse {
id: string;
created_at: string;
datasets: Array<EvaluationCreateResponse.Dataset>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
processed: boolean;
results: Array<EvaluationCreateResponse.Result>;
total_logs: number;
}
export declare namespace EvaluationCreateResponse {
interface Dataset {
id: string;
account_id: string;
account_tag: string;
created_at: string;
enable: boolean;
filters: Array<Dataset.Filter>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
}
namespace Dataset {
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>;
}
}
interface Result {
id: string;
created_at: string;
evaluation_id: string;
evaluation_type_id: string;
modified_at: string;
result: string;
status: number;
status_description: string;
total_logs: number;
}
}
export interface EvaluationListResponse {
id: string;
created_at: string;
datasets: Array<EvaluationListResponse.Dataset>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
processed: boolean;
results: Array<EvaluationListResponse.Result>;
total_logs: number;
}
export declare namespace EvaluationListResponse {
interface Dataset {
id: string;
account_id: string;
account_tag: string;
created_at: string;
enable: boolean;
filters: Array<Dataset.Filter>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
}
namespace Dataset {
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>;
}
}
interface Result {
id: string;
created_at: string;
evaluation_id: string;
evaluation_type_id: string;
modified_at: string;
result: string;
status: number;
status_description: string;
total_logs: number;
}
}
export interface EvaluationDeleteResponse {
id: string;
created_at: string;
datasets: Array<EvaluationDeleteResponse.Dataset>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
processed: boolean;
results: Array<EvaluationDeleteResponse.Result>;
total_logs: number;
}
export declare namespace EvaluationDeleteResponse {
interface Dataset {
id: string;
account_id: string;
account_tag: string;
created_at: string;
enable: boolean;
filters: Array<Dataset.Filter>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
}
namespace Dataset {
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>;
}
}
interface Result {
id: string;
created_at: string;
evaluation_id: string;
evaluation_type_id: string;
modified_at: string;
result: string;
status: number;
status_description: string;
total_logs: number;
}
}
export interface EvaluationGetResponse {
id: string;
created_at: string;
datasets: Array<EvaluationGetResponse.Dataset>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
processed: boolean;
results: Array<EvaluationGetResponse.Result>;
total_logs: number;
}
export declare namespace EvaluationGetResponse {
interface Dataset {
id: string;
account_id: string;
account_tag: string;
created_at: string;
enable: boolean;
filters: Array<Dataset.Filter>;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
modified_at: string;
name: string;
}
namespace Dataset {
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>;
}
}
interface Result {
id: string;
created_at: string;
evaluation_id: string;
evaluation_type_id: string;
modified_at: string;
result: string;
status: number;
status_description: string;
total_logs: number;
}
}
export interface EvaluationCreateParams {
/**
* Path param
*/
account_id: string;
/**
* Body param
*/
dataset_ids: Array<string>;
/**
* Body param
*/
evaluation_type_ids: Array<string>;
/**
* Body param
*/
name: string;
}
export interface EvaluationListParams extends V4PagePaginationArrayParams {
/**
* Path param
*/
account_id: string;
/**
* Query param
*/
name?: string;
/**
* Query param
*/
processed?: boolean;
/**
* Query param: Search by id, name
*/
search?: string;
}
export interface EvaluationDeleteParams {
account_id: string;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
}
export interface EvaluationGetParams {
account_id: string;
/**
* Unique identifier of the AI Gateway within the account.
*/
gateway_id: string;
}
export declare namespace Evaluations {
export { type EvaluationCreateResponse as EvaluationCreateResponse, type EvaluationListResponse as EvaluationListResponse, type EvaluationDeleteResponse as EvaluationDeleteResponse, type EvaluationGetResponse as EvaluationGetResponse, type EvaluationListResponsesV4PagePaginationArray as EvaluationListResponsesV4PagePaginationArray, type EvaluationCreateParams as EvaluationCreateParams, type EvaluationListParams as EvaluationListParams, type EvaluationDeleteParams as EvaluationDeleteParams, type EvaluationGetParams as EvaluationGetParams, };
}
//# sourceMappingURL=evaluations.d.mts.map