call-ai
Version:
Lightweight library for making AI API calls with streaming support
33 lines • 981 B
JavaScript
export function isToolUseType(obj) {
return !!obj && obj.type === "tool_use";
}
export function isToolUseResponse(obj) {
return !!obj && obj.tool_use !== undefined;
}
export function isOpenAIArray(obj) {
return Array.isArray(obj) && obj.length > 0 && obj[0].function !== undefined;
}
export class CallAIError extends Error {
message;
status;
statusText;
details;
contentType;
originalError;
refreshError;
errorType;
partialContent;
constructor(params) {
super(params.message);
this.message = params.message;
this.status = params.status;
this.statusText = params.statusText;
this.details = params.details;
this.contentType = params.contentType;
this.originalError = params.originalError;
this.partialContent = params.partialContent;
this.refreshError = params.refreshError;
this.errorType = params.errorType;
}
}
//# sourceMappingURL=types.js.map