cloudflare
Version:
The official TypeScript library for the Cloudflare API
56 lines • 2.36 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as CustomTopicsAPI from "./custom-topics.mjs";
import { BaseCustomTopics, CustomTopics, } from "./custom-topics.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseAISecurity = /* @__PURE__ */ (() => {
class BaseAISecurity extends 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(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(path `/zones/${zone_id}/ai-security/settings`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseAISecurity._key = Object.freeze(['aiSecurity']);
return BaseAISecurity;
})();
export var AISecurity = /* @__PURE__ */ (() => {
class AISecurity extends BaseAISecurity {
constructor() {
super(...arguments);
this.customTopics = new CustomTopicsAPI.CustomTopics(this._client);
}
}
AISecurity.CustomTopics = CustomTopics;
AISecurity.BaseCustomTopics = BaseCustomTopics;
return AISecurity;
})();
//# sourceMappingURL=ai-security.mjs.map