cloudflare
Version:
The official TypeScript library for the Cloudflare API
62 lines • 2.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AISecurity = exports.BaseAISecurity = void 0;
const tslib_1 = require("../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const CustomTopicsAPI = tslib_1.__importStar(require("./custom-topics.js"));
const custom_topics_1 = require("./custom-topics.js");
const path_1 = require("../../internal/utils/path.js");
var BaseAISecurity = /* @__PURE__ */ (() => {
class BaseAISecurity extends resource_1.APIResource {
/**
* Update the AI Security for Apps status for the zone, enabling or disabling the
* detection. The detection results are exposed as `cf.llm.prompt.*` fields for use
* in custom rules and rate limiting rules; changes can take up to a minute to
* propagate.
*
* @example
* ```ts
* const aiSecurity = await client.aiSecurity.update({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
update(params, options) {
const { zone_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/ai-security/settings`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Get the current AI Security for Apps status for the zone. While enabled,
* Cloudflare scans prompts sent to endpoints labeled `cf-llm` for personally
* identifiable information, unsafe topics, and prompt injection attempts.
*
* @example
* ```ts
* const aiSecurity = await client.aiSecurity.get({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/ai-security/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseAISecurity._key = Object.freeze(['aiSecurity']);
return BaseAISecurity;
})();
exports.BaseAISecurity = BaseAISecurity;
var AISecurity = /* @__PURE__ */ (() => {
class AISecurity extends BaseAISecurity {
constructor() {
super(...arguments);
this.customTopics = new CustomTopicsAPI.CustomTopics(this._client);
}
}
AISecurity.CustomTopics = custom_topics_1.CustomTopics;
AISecurity.BaseCustomTopics = custom_topics_1.BaseCustomTopics;
return AISecurity;
})();
exports.AISecurity = AISecurity;
//# sourceMappingURL=ai-security.js.map