/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { MutationKey, useMutation, UseMutationResult, } from "@tanstack/react-query"; import { SDKCore } from "../core.js"; import { llmModelsPutOrgAutoModel } from "../funcs/llmModelsPutOrgAutoModel.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 LlmModelsPutOrgAutoModelMutationVariables = { request: operations.PutOrgAutoModelRequest; options?: RequestOptions; }; export type LlmModelsPutOrgAutoModelMutationData = components.OrgAutoModel; export type LlmModelsPutOrgAutoModelMutationError = | SDKError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Set this org's auto-model override for an endpoint * * @remarks * Stores `{ endpoint → modelId }` so subsequent requests with `model: "auto"` for the endpoint resolve to `modelId` instead of the operator's YAML default. The target must (a) not be the literal string `"auto"`, (b) be active in this org's model registry, and (c) have the same `apiFormat` as the endpoint. */ export function useLlmModelsPutOrgAutoModelMutation( options?: MutationHookOptions< LlmModelsPutOrgAutoModelMutationData, LlmModelsPutOrgAutoModelMutationError, LlmModelsPutOrgAutoModelMutationVariables >, ): UseMutationResult< LlmModelsPutOrgAutoModelMutationData, LlmModelsPutOrgAutoModelMutationError, LlmModelsPutOrgAutoModelMutationVariables > { const client = useSDKContext(); return useMutation({ ...buildLlmModelsPutOrgAutoModelMutation(client, options), ...options, }); } export function mutationKeyLlmModelsPutOrgAutoModel(): MutationKey { return ["@meetkai/mka1", "models", "putOrgAutoModel"]; } export function buildLlmModelsPutOrgAutoModelMutation( client$: SDKCore, hookOptions?: RequestOptions, ): { mutationKey: MutationKey; mutationFn: ( variables: LlmModelsPutOrgAutoModelMutationVariables, ) => Promise; } { return { mutationKey: mutationKeyLlmModelsPutOrgAutoModel(), mutationFn: function llmModelsPutOrgAutoModelMutationFn({ request, options, }): Promise { const mergedOptions = { ...hookOptions, ...options, fetchOptions: { ...hookOptions?.fetchOptions, ...options?.fetchOptions, signal: combineSignals( hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal, ), }, }; return unwrapAsync(llmModelsPutOrgAutoModel( client$, request, mergedOptions, )); }, }; }