/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { llmBatchesCreate } from "../funcs/llmBatchesCreate.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKError } from "../models/errors/sdkerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { useSDKContext } from "./_context.js"; import { MutationHookOptions } from "./_types.js"; export type LlmBatchesCreateMutationVariables = { request: operations.CreateBatchRequest; options?: RequestOptions; }; export type LlmBatchesCreateMutationData = components.BatchObject; export type LlmBatchesCreateMutationError = | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Create a batch * * @remarks * Creates and executes a batch from an uploaded JSONL file of requests. Each line must have custom_id, method, url, and body fields. */ export function useLlmBatchesCreateMutation( options?: MutationHookOptions< LlmBatchesCreateMutationData, LlmBatchesCreateMutationError, LlmBatchesCreateMutationVariables >, ): UseMutationResult< LlmBatchesCreateMutationData, LlmBatchesCreateMutationError, LlmBatchesCreateMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildLlmBatchesCreateMutation(client, options), ...options, }); } export function mutationKeyLlmBatchesCreate(): MutationKey { return ["@meetkai/mka1", "batches", "create"]; } export function buildLlmBatchesCreateMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: LlmBatchesCreateMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyLlmBatchesCreate(), mutationFn: function llmBatchesCreateMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(llmBatchesCreate( client$, request, mergedOptions, )); }, }; }