export type GetApiDiV1ModelsModelIdLogsArgs = {model_id: unknown, follow?: boolean | undefined, since_time?: unknown | undefined, version?: string | undefined}; export type GetApiDiV1ModelsModelIdLogsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get training logs as websocket stream. * * * GET /di/v1/models/{model_id}/logs */ export const getApiDiV1ModelsModelIdLogs = async (args: GetApiDiV1ModelsModelIdLogsArgs, options?: GetApiDiV1ModelsModelIdLogsOptions) => { const {baseUrl = "https://di.prophecis.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.follow != null) query.append("follow", String(args.follow)) if (args.since_time != null) query.append("since_time", String(args.since_time)) if (args.version != null) query.append("version", String(args.version)) const url = `${baseUrl.replace(/\/+$/, '')}/di/v1/models/${encodeURIComponent(String(args.model_id))}/logs${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };