openai
Version:
The official TypeScript library for the OpenAI API
68 lines (53 loc) • 1.85 kB
text/typescript
// File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
function resolveResourceRequestOptions(
options: RequestOptions | undefined,
buildOptions: (options: RequestOptions | undefined) => RequestOptions | Promise<RequestOptions>,
): Promise<RequestOptions> {
return Promise.resolve(options).then(buildOptions);
}
export class Alerts extends APIResource {
/**
* Get a safety alert belonging to the authenticated API project.
*/
retrieve(id: string, options?: RequestOptions): APIPromise<SafetyAlert> {
return this._client.get(
path`/safety/alerts/${id}`,
resolveResourceRequestOptions(options, (options) => ({ ...options, __security: { bearerAuth: true } })),
);
}
}
export interface SafetyAlert {
id: string;
created_at: number;
error_type:
| 'potentially_unintended_data_transfer'
| 'potentially_unintended_data_access'
| 'potentially_unintended_destructive_activity'
| 'other';
model: string;
object: 'safety.alert';
/**
* A customer-safe description derived from error_type, or null for zero data
* retention requests.
*/
reason: string | null;
request_id: string;
/**
* Whether block registration succeeded for this request. This does not confirm
* that response execution stopped.
*/
request_paused: boolean;
response_id: string;
/**
* A generated explanation, temporarily available for eligible zero data retention
* alerts. Omitted when unavailable.
*/
detailed_explanation?: string | null;
}
export declare namespace Alerts {
export { type SafetyAlert as SafetyAlert };
}