# Evaluations ## List Evaluations `client.aiGateway.evaluations.list(stringgatewayId, EvaluationListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `gatewayId: string` gateway id - `params: EvaluationListParams` - `account_id: string` Path param - `name?: string` Query param - `page?: number` Query param - `per_page?: number` Query param - `processed?: boolean` Query param - `search?: string` Query param: Search by id, name ### Returns - `EvaluationListResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const evaluationListResponse of client.aiGateway.evaluations.list('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', })) { console.log(evaluationListResponse.id); } ``` #### Response ```json { "result": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 } ], "success": true } ``` ## Fetch a Evaluation `client.aiGateway.evaluations.get(stringgatewayId, stringid, EvaluationGetParamsparams, RequestOptionsoptions?): EvaluationGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: EvaluationGetParams` - `account_id: string` ### Returns - `EvaluationGetResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const evaluation = await client.aiGateway.evaluations.get('my-gateway', 'id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(evaluation.id); ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Create a new Evaluation `client.aiGateway.evaluations.create(stringgatewayId, EvaluationCreateParamsparams, RequestOptionsoptions?): EvaluationCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Creates a new AI Gateway. ### Parameters - `gatewayId: string` gateway id - `params: EvaluationCreateParams` - `account_id: string` Path param - `dataset_ids: Array` Body param - `evaluation_type_ids: Array` Body param - `name: string` Body param ### Returns - `EvaluationCreateResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const evaluation = await client.aiGateway.evaluations.create('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', dataset_ids: ['string'], evaluation_type_ids: ['string'], name: 'name', }); console.log(evaluation.id); ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Delete a Evaluation `client.aiGateway.evaluations.delete(stringgatewayId, stringid, EvaluationDeleteParamsparams, RequestOptionsoptions?): EvaluationDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Deletes an AI Gateway dataset. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: EvaluationDeleteParams` - `account_id: string` ### Returns - `EvaluationDeleteResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const evaluation = await client.aiGateway.evaluations.delete('my-gateway', 'id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(evaluation.id); ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Domain Types ### Evaluation List Response - `EvaluationListResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number` ### Evaluation Get Response - `EvaluationGetResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number` ### Evaluation Create Response - `EvaluationCreateResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number` ### Evaluation Delete Response - `EvaluationDeleteResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "created_at" | "request_content_type" | "response_content_type" | 10 more` - `"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"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `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` - `total_logs: number`