export type GetApiApiV1AutoscientistExperimentIdDownloadArgs = {experiment_id: string}; export type GetApiApiV1AutoscientistExperimentIdDownloadOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download the best trained model artifact * * GET /api/v1/autoscientist/{experiment_id}/download */ export const getApiApiV1AutoscientistExperimentIdDownload = async (args: GetApiApiV1AutoscientistExperimentIdDownloadArgs, options: GetApiApiV1AutoscientistExperimentIdDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/gzip") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/autoscientist/${encodeURIComponent(String(args.experiment_id))}/download${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() };