export type GetApiAiAssistantsAssistantIdHistoryEventsArgs = {assistant_id: string, offset?: number | undefined, limit?: number | undefined}; export type GetApiAiAssistantsAssistantIdHistoryEventsOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the assistant's full event history as formatted text. * * GET /ai_assistants/{assistant_id}/history/events */ export const getApiAiAssistantsAssistantIdHistoryEvents = async (args: GetApiAiAssistantsAssistantIdHistoryEventsArgs, options?: GetApiAiAssistantsAssistantIdHistoryEventsOptions) => { const {baseUrl = "https://h2ogpte.genai.h2o.ai/api/v1", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.offset != null) query.append("offset", String(args.offset)) if (args.limit != null) query.append("limit", String(args.limit)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/ai_assistants/${encodeURIComponent(String(args.assistant_id))}/history/events${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.text() };