ai-utils.js
Version:
Build AI applications, chatbots, and agents with JavaScript and TypeScript.
48 lines (47 loc) • 1.36 kB
TypeScript
import { z } from "zod";
import { ApiCallError } from "../../util/api/ApiCallError.js";
import { ResponseHandler } from "../../util/api/postToApi.js";
export declare const openAIErrorDataSchema: z.ZodObject<{
error: z.ZodObject<{
message: z.ZodString;
type: z.ZodString;
param: z.ZodNullable<z.ZodAny>;
code: z.ZodNullable<z.ZodString>;
}, "strip", z.ZodTypeAny, {
code: string | null;
message: string;
type: string;
param?: any;
}, {
code: string | null;
message: string;
type: string;
param?: any;
}>;
}, "strip", z.ZodTypeAny, {
error: {
code: string | null;
message: string;
type: string;
param?: any;
};
}, {
error: {
code: string | null;
message: string;
type: string;
param?: any;
};
}>;
export type OpenAIErrorData = z.infer<typeof openAIErrorDataSchema>;
export declare class OpenAIError extends ApiCallError {
readonly data: OpenAIErrorData;
constructor({ data, statusCode, url, requestBodyValues, message, }: {
message?: string;
statusCode: number;
url: string;
requestBodyValues: unknown;
data: OpenAIErrorData;
});
}
export declare const failedOpenAICallResponseHandler: ResponseHandler<ApiCallError>;