// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit. import * as S from "@distilled.cloud/core/schema"; import * as API from "@distilled.cloud/core/api"; import * as T from "../traits.ts"; import { CloudflareProtocol, CloudflarePaginatedProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { cloudflarePaginate, ResultInfo } from "../pagination.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; /** Fallback camelCase→wire mapping for opaque content (mined from the distilled SDK). */ const KEY_DICTIONARY: Record> = { completionTokens: "completion_tokens", createdAt: "created_at", fileName: "file_name", frequencyPenalty: "frequency_penalty", ignoreEos: "ignore_eos", imageB64: "image_b64", imageUrl: "image_url", inputText: "input_text", jsonSchema: "json_schema", maxLength: "max_length", maxTokens: "max_tokens", modifiedAt: "modified_at", negativePrompt: "negative_prompt", numSteps: "num_steps", perPage: "per_page", presencePenalty: "presence_penalty", promptTokens: "prompt_tokens", repetitionPenalty: "repetition_penalty", responseFormat: "response_format", resultInfo: "result_info", sourceLang: "source_lang", targetLang: "target_lang", toolCalls: "tool_calls", topK: "top_k", topP: "top_p", totalCount: "total_count", totalTokens: "total_tokens", translatedText: "translated_text", wordCount: "word_count", }; export class AccountNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("AccountNotFound", { code: S.Number, message: S.String, }), [{ code: 7003 }], ) {} export class ModelNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("ModelNotFound", { code: S.Number, message: S.String, }), [{ code: 7003 }, { code: 7000 }], ) {} export class ModelNotSupported extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("ModelNotSupported", { code: S.Number, message: S.String, }), [{ code: 1000 }], ) {} export class ModelSchemaNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("ModelSchemaNotFound", { code: S.Number, message: S.String, }), [{ code: 6002 }], ) {} export interface CreateFinetuneRequest { accountId: string; model: string; name: string; description?: string; public?: boolean; } export const CreateFinetuneRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), model: S.String, name: S.String, description: S.optional(S.String), public: S.optional(S.Boolean), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/ai/finetunes", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateFinetuneRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateFinetuneResponse { id: string; createdAt: string; model: string; modifiedAt: string; name: string; public: boolean; description?: string | null; } export const CreateFinetuneResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdAt: S.String.pipe(T.Body("created_at")), model: S.String, modifiedAt: S.String.pipe(T.Body("modified_at")), name: S.String, public: S.Boolean, description: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateFinetuneResponse", }) as any as S.Schema; export interface CreateFinetuneAssetRequest { accountId: string; finetuneId: string; } export const CreateFinetuneAssetRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), finetuneId: S.String.pipe(T.Label("finetune_id")), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/ai/finetunes/{finetune_id}/finetune-assets", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateFinetuneAssetRequest", }) as any as S.Schema; export interface CreateFinetuneAssetResponse {} export const CreateFinetuneAssetResponse = /*@__PURE__*/ S.suspend(() => S.Struct({}).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateFinetuneAssetResponse", }) as any as S.Schema; export interface GetModelSchemaRequest { accountId: string; /** Model Name */ model: string; } export const GetModelSchemaRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), model: S.String.pipe(T.Query()), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/ai/models/schema", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetModelSchemaRequest", }) as any as S.Schema; export interface ModelsSchemaGetResponseInput { additionalProperties: boolean; description: string; type: string; } export const ModelsSchemaGetResponseInput = /*@__PURE__*/ S.suspend(() => S.Struct({ additionalProperties: S.Boolean, description: S.String, type: S.String, }), ).annotate({ identifier: "ModelsSchemaGetResponseInput", }) as any as S.Schema; export type ModelsSchemaGetResponseOutput = ModelsSchemaGetResponseInput; export const ModelsSchemaGetResponseOutput = ModelsSchemaGetResponseInput; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetModelSchemaResponse { input: ModelsSchemaGetResponseInput; output: ModelsSchemaGetResponseInput; } export const GetModelSchemaResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ input: ModelsSchemaGetResponseInput, output: ModelsSchemaGetResponseInput, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetModelSchemaResponse", }) as any as S.Schema; export interface ListAuthorsRequest { accountId: string; } export const ListAuthorsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/ai/authors/search", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListAuthorsRequest", }) as any as S.Schema; export type AuthorsListResultList = Array; export const AuthorsListResultList = /*@__PURE__*/ S.Array( S.Unknown, ) as any as S.Schema; export interface ListAuthorsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: AuthorsListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListAuthorsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: AuthorsListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListAuthorsResponse", }) as any as S.Schema; export interface ListFinetunePublicsRequest { accountId: string; /** Pagination Limit */ limit?: number; /** Pagination Offset */ offset?: number; /** Order By Column Name */ orderBy?: string; } export const ListFinetunePublicsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), limit: S.optional(S.Number.pipe(T.Query())), offset: S.optional(S.Number.pipe(T.Query())), orderBy: S.optional(S.String.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/ai/finetunes/public", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListFinetunePublicsRequest", }) as any as S.Schema; export interface FinetunesPublicListResultItem { id: string; createdAt: string; model: string; modifiedAt: string; name: string; public: boolean; description?: string | null; } export const FinetunesPublicListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdAt: S.String.pipe(T.Body("created_at")), model: S.String, modifiedAt: S.String.pipe(T.Body("modified_at")), name: S.String, public: S.Boolean, description: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "FinetunesPublicListResultItem", }) as any as S.Schema; export type FinetunesPublicListResultList = Array; export const FinetunesPublicListResultList = /*@__PURE__*/ S.Array( FinetunesPublicListResultItem, ) as any as S.Schema; export interface ListFinetunePublicsResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: FinetunesPublicListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListFinetunePublicsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: FinetunesPublicListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListFinetunePublicsResponse", }) as any as S.Schema; export interface ListFinetunesRequest { accountId: string; } export const ListFinetunesRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/ai/finetunes", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListFinetunesRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface ListFinetunesResponse { id: string; createdAt: string; model: string; modifiedAt: string; name: string; description?: string | null; } export const ListFinetunesResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, createdAt: S.String.pipe(T.Body("created_at")), model: S.String, modifiedAt: S.String.pipe(T.Body("modified_at")), name: S.String, description: S.optional(S.NullOr(S.String)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListFinetunesResponse", }) as any as S.Schema; export type ModelsListRequestFormat = "openrouter"; export const ModelsListRequestFormat = /*@__PURE__*/ S.String; export interface ListModelsRequest { accountId: string; /** Filter by Author */ author?: string; /** If set, return models in the requested marketplace format instead of the default response. */ format?: ModelsListRequestFormat | (string & {}); /** Filter to hide experimental models */ hideExperimental?: boolean; /** If true, include models whose planned_deprecation_date is in the past — but only within a three-month grace window after that date. Models whose planned_deprecation_date is more than three months in the past remain hidden regardless of this flag. Future planned-deprecation dates are always included regardless of this flag. Defaults to false, preserving the existing behavior of hiding all past-dated deprecations. */ includeDeprecated?: boolean; page?: number; perPage?: number; /** Search */ search?: string; /** Filter by Source Id */ source?: number; /** Filter by Task Name */ task?: string; } export const ListModelsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), author: S.optional(S.String.pipe(T.Query())), format: S.optional(ModelsListRequestFormat.pipe(T.Query())), hideExperimental: S.optional(S.Boolean.pipe(T.Query("hide_experimental"))), includeDeprecated: S.optional( S.Boolean.pipe(T.Query("include_deprecated")), ), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), search: S.optional(S.String.pipe(T.Query())), source: S.optional(S.Number.pipe(T.Query())), task: S.optional(S.String.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/ai/models/search", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListModelsRequest", }) as any as S.Schema; /** Raw response payload (operation does not use the standard v4 result envelope). */ export interface ListModelsResponse {} export const ListModelsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({}).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListModelsResponse", }) as any as S.Schema; export interface ListTasksRequest { accountId: string; } export const ListTasksRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/ai/tasks/search", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListTasksRequest", }) as any as S.Schema; export type TasksListResultList = Array; export const TasksListResultList = /*@__PURE__*/ S.Array( S.Unknown, ) as any as S.Schema; export interface ListTasksResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: TasksListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListTasksResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: TasksListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListTasksResponse", }) as any as S.Schema; export type RunRequestTextTextEmbeddingsCase1List = Array; export const RunRequestTextTextEmbeddingsCase1List = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type RunRequestTextTextEmbeddings = | string | RunRequestTextTextEmbeddingsCase1List; export const RunRequestTextTextEmbeddings = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([[], []]), ); export type RunRequestTextMultimodalEmbeddingsList = Array; export const RunRequestTextMultimodalEmbeddingsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type RunRequestText = | string | RunRequestTextTextEmbeddings | RunRequestTextMultimodalEmbeddingsList; export const RunRequestText = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([[], [], []]), ); export type RunRequestImageTextToImageList = Array; export const RunRequestImageTextToImageList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export type RunRequestImage = string | RunRequestImageTextToImageList; export const RunRequestImage = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([[], []]), ); export type RunRequestMaskList = Array; export const RunRequestMaskList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export type RunRequestAudioList = Array; export const RunRequestAudioList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export type RunRequestResponseFormatType = "json_object" | "json_schema"; export const RunRequestResponseFormatType = /*@__PURE__*/ S.String; export interface RunRequestResponseFormat { jsonSchema?: unknown; type?: RunRequestResponseFormatType | (string & {}); } export const RunRequestResponseFormat = /*@__PURE__*/ S.suspend(() => S.Struct({ jsonSchema: S.optional(S.Unknown.pipe(T.Body("json_schema"))), type: S.optional(RunRequestResponseFormatType), }), ).annotate({ identifier: "RunRequestResponseFormat", }) as any as S.Schema; export interface RunRequestMessagesTextGenerationItemContentCase1Item { /** Text content */ text?: string; /** Type of the content (text) */ type?: string; } export const RunRequestMessagesTextGenerationItemContentCase1Item = /*@__PURE__*/ S.suspend(() => S.Struct({ text: S.optional(S.String), type: S.optional(S.String), }), ).annotate({ identifier: "RunRequestMessagesTextGenerationItemContentCase1Item", }) as any as S.Schema; export type RunRequestMessagesTextGenerationItemContentCase1List = Array; export const RunRequestMessagesTextGenerationItemContentCase1List = /*@__PURE__*/ S.Array( RunRequestMessagesTextGenerationItemContentCase1Item, ) as any as S.Schema; export type RunRequestMessagesTextGenerationItemContent = | string | RunRequestMessagesTextGenerationItemContentCase1List; export const RunRequestMessagesTextGenerationItemContent = /*@__PURE__*/ S.Unknown.pipe(T.UnionCases([[], []])); export interface RunRequestMessagesTextGenerationItem { /** The content of the message as a string. */ content: RunRequestMessagesTextGenerationItemContent; /** The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ role: string; } export const RunRequestMessagesTextGenerationItem = /*@__PURE__*/ S.suspend( () => S.Struct({ content: RunRequestMessagesTextGenerationItemContent, role: S.String, }), ).annotate({ identifier: "RunRequestMessagesTextGenerationItem", }) as any as S.Schema; export type RunRequestMessagesTextGenerationList = Array; export const RunRequestMessagesTextGenerationList = /*@__PURE__*/ S.Array( RunRequestMessagesTextGenerationItem, ) as any as S.Schema; export interface RunRequestMessagesImageTextToTextItemContentCase1ItemImageUrl { /** Image URI with data (e.g. data:image/jpeg;base64,/9j/...). */ url: string; } export const RunRequestMessagesImageTextToTextItemContentCase1ItemImageUrl = /*@__PURE__*/ S.suspend(() => S.Struct({ url: S.String, }), ).annotate({ identifier: "RunRequestMessagesImageTextToTextItemContentCase1ItemImageUrl", }) as any as S.Schema; export interface RunRequestMessagesImageTextToTextItemContentCase1Item { /** Type of the content part (e.g. 'text', 'image_url'). */ type: string; /** Image URL object (when type is 'image_url'). */ imageUrl?: RunRequestMessagesImageTextToTextItemContentCase1ItemImageUrl; /** Text content (when type is 'text'). */ text?: string; } export const RunRequestMessagesImageTextToTextItemContentCase1Item = /*@__PURE__*/ S.suspend(() => S.Struct({ type: S.String, imageUrl: S.optional( RunRequestMessagesImageTextToTextItemContentCase1ItemImageUrl.pipe( T.Body("image_url"), ), ), text: S.optional(S.String), }), ).annotate({ identifier: "RunRequestMessagesImageTextToTextItemContentCase1Item", }) as any as S.Schema; export type RunRequestMessagesImageTextToTextItemContentCase1List = Array; export const RunRequestMessagesImageTextToTextItemContentCase1List = /*@__PURE__*/ S.Array( RunRequestMessagesImageTextToTextItemContentCase1Item, ) as any as S.Schema; export type RunRequestMessagesImageTextToTextItemContent = | string | RunRequestMessagesImageTextToTextItemContentCase1List; export const RunRequestMessagesImageTextToTextItemContent = /*@__PURE__*/ S.Unknown.pipe(T.UnionCases([[], []])); export interface RunRequestMessagesImageTextToTextItem { /** The content of the message as a string. */ content: RunRequestMessagesImageTextToTextItemContent; /** The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). */ role: string; } export const RunRequestMessagesImageTextToTextItem = /*@__PURE__*/ S.suspend( () => S.Struct({ content: RunRequestMessagesImageTextToTextItemContent, role: S.String, }), ).annotate({ identifier: "RunRequestMessagesImageTextToTextItem", }) as any as S.Schema; export type RunRequestMessagesImageTextToTextList = Array; export const RunRequestMessagesImageTextToTextList = /*@__PURE__*/ S.Array( RunRequestMessagesImageTextToTextItem, ) as any as S.Schema; export type RunRequestMessages = | RunRequestMessagesTextGenerationList | RunRequestMessagesImageTextToTextList; export const RunRequestMessages = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([[], []]), ); export interface RunRequestFunctionsItem { code: string; name: string; } export const RunRequestFunctionsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ code: S.String, name: S.String, }), ).annotate({ identifier: "RunRequestFunctionsItem", }) as any as S.Schema; export type RunRequestFunctionsList = Array; export const RunRequestFunctionsList = /*@__PURE__*/ S.Array( RunRequestFunctionsItem, ) as any as S.Schema; export interface RunRequestToolsItemCase0ParametersPropertiesValue { /** A description of the expected parameter. */ description: string; /** The data type of the parameter. */ type: string; } export const RunRequestToolsItemCase0ParametersPropertiesValue = /*@__PURE__*/ S.suspend(() => S.Struct({ description: S.String, type: S.String, }), ).annotate({ identifier: "RunRequestToolsItemCase0ParametersPropertiesValue", }) as any as S.Schema; export type RunRequestToolsItemCase0ParametersPropertiesMap = { [key: string]: RunRequestToolsItemCase0ParametersPropertiesValue | undefined; }; export const RunRequestToolsItemCase0ParametersPropertiesMap = /*@__PURE__*/ S.Record( S.String, RunRequestToolsItemCase0ParametersPropertiesValue, ) as any as S.Schema; export type RunRequestToolsItemCase0ParametersRequiredList = Array; export const RunRequestToolsItemCase0ParametersRequiredList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface RunRequestToolsItemCase0Parameters { /** Definitions of each parameter. */ properties: RunRequestToolsItemCase0ParametersPropertiesMap; /** The type of the parameters object (usually 'object'). */ type: string; /** List of required parameter names. */ required?: RunRequestToolsItemCase0ParametersRequiredList; } export const RunRequestToolsItemCase0Parameters = /*@__PURE__*/ S.suspend(() => S.Struct({ properties: RunRequestToolsItemCase0ParametersPropertiesMap, type: S.String, required: S.optional(RunRequestToolsItemCase0ParametersRequiredList), }), ).annotate({ identifier: "RunRequestToolsItemCase0Parameters", }) as any as S.Schema; export interface RunRequestToolsItemCase0 { /** A brief description of what the tool does. */ description: string; /** The name of the tool. More descriptive the better. */ name: string; /** Schema defining the parameters accepted by the tool. */ parameters: RunRequestToolsItemCase0Parameters; } export const RunRequestToolsItemCase0 = /*@__PURE__*/ S.suspend(() => S.Struct({ description: S.String, name: S.String, parameters: RunRequestToolsItemCase0Parameters, }), ).annotate({ identifier: "RunRequestToolsItemCase0", }) as any as S.Schema; export type RunRequestToolsItemFunctionFunctionParametersPropertiesValue = RunRequestToolsItemCase0ParametersPropertiesValue; export const RunRequestToolsItemFunctionFunctionParametersPropertiesValue = RunRequestToolsItemCase0ParametersPropertiesValue; export type RunRequestToolsItemFunctionFunctionParametersPropertiesMap = { [key: string]: RunRequestToolsItemCase0ParametersPropertiesValue | undefined; }; export const RunRequestToolsItemFunctionFunctionParametersPropertiesMap = /*@__PURE__*/ S.Record( S.String, RunRequestToolsItemCase0ParametersPropertiesValue, ) as any as S.Schema; export type RunRequestToolsItemFunctionFunctionParametersRequiredList = Array; export const RunRequestToolsItemFunctionFunctionParametersRequiredList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface RunRequestToolsItemFunctionFunctionParameters { /** Definitions of each parameter. */ properties: RunRequestToolsItemFunctionFunctionParametersPropertiesMap; /** The type of the parameters object (usually 'object'). */ type: string; /** List of required parameter names. */ required?: RunRequestToolsItemFunctionFunctionParametersRequiredList; } export const RunRequestToolsItemFunctionFunctionParameters = /*@__PURE__*/ S.suspend(() => S.Struct({ properties: RunRequestToolsItemFunctionFunctionParametersPropertiesMap, type: S.String, required: S.optional( RunRequestToolsItemFunctionFunctionParametersRequiredList, ), }), ).annotate({ identifier: "RunRequestToolsItemFunctionFunctionParameters", }) as any as S.Schema; export interface RunRequestToolsItemFunctionFunction { /** A brief description of what the function does. */ description: string; /** The name of the function. */ name: string; /** Schema defining the parameters accepted by the function. */ parameters: RunRequestToolsItemFunctionFunctionParameters; } export const RunRequestToolsItemFunctionFunction = /*@__PURE__*/ S.suspend(() => S.Struct({ description: S.String, name: S.String, parameters: RunRequestToolsItemFunctionFunctionParameters, }), ).annotate({ identifier: "RunRequestToolsItemFunctionFunction", }) as any as S.Schema; export interface RunRequestToolsItemFunction { /** Details of the function tool. */ function: RunRequestToolsItemFunctionFunction; /** Specifies the type of tool (e.g., 'function'). */ type: string; } export const RunRequestToolsItemFunction = /*@__PURE__*/ S.suspend(() => S.Struct({ function: RunRequestToolsItemFunctionFunction, type: S.String, }), ).annotate({ identifier: "RunRequestToolsItemFunction", }) as any as S.Schema; export type RunRequestToolsItem = | RunRequestToolsItemCase0 | RunRequestToolsItemFunction; export const RunRequestToolsItem = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ ["description", "name", "parameters"], ["function", "type"], ]), ); export type RunRequestToolsList = Array; export const RunRequestToolsList = /*@__PURE__*/ S.Array( RunRequestToolsItem, ) as any as S.Schema; export interface RunAiRequest { accountId: string; modelName: string; /** The text that you want to classify */ text?: RunRequestText; /** A text description of the image you want to generate */ prompt?: string; /** Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt */ guidance?: number; /** The height of the generated image in pixels */ height?: number; /** For use with img2img tasks. An array of integers that represent the image data constrained to 8-bit unsigned integer values */ image?: RunRequestImage; /** For use with img2img tasks. A base64-encoded string of the input image */ imageB64?: string; /** An array representing An array of integers that represent mask image data for inpainting constrained to 8-bit unsigned integer values */ mask?: RunRequestMaskList; /** Text describing elements to avoid in the generated image */ negativePrompt?: string; /** The number of diffusion steps; higher values can improve quality but take longer */ numSteps?: number; /** Random seed for reproducibility of the image generation */ seed?: number; /** A value between 0 and 1 indicating how strongly to apply the transformation during img2img tasks; lower values make the output closer to the input image */ strength?: number; /** The width of the generated image in pixels */ width?: number; /** The speech language (e.g., 'en' for English, 'fr' for French). Defaults to 'en' if not specified */ lang?: string; /** An array of integers that represent the audio data constrained to 8-bit unsigned integer values */ audio?: RunRequestAudioList; /** The language of the recorded audio */ sourceLang?: string; /** The language to translate the transcription into. Currently only English is supported. */ targetLang?: string; /** Decreases the likelihood of the model repeating the same lines verbatim. */ frequencyPenalty?: number; /** Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model. */ lora?: string; /** The maximum number of tokens to generate in the response. */ maxTokens?: number; /** Increases the likelihood of the model introducing new topics. */ presencePenalty?: number; /** If true, a chat template is not applied and you must adhere to the specific model's expected formatting. */ raw?: boolean; /** Penalty for repeated tokens; higher values discourage repetition. */ repetitionPenalty?: number; responseFormat?: RunRequestResponseFormat; /** If true, the response will be streamed back incrementally using SSE, Server Sent Events. */ stream?: boolean; /** Controls the randomness of the output; higher values produce more random results. */ temperature?: number; /** Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises. */ topK?: number; /** Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. */ topP?: number; /** An array of message objects representing the conversation history. */ messages?: RunRequestMessages; functions?: RunRequestFunctionsList; /** A list of tools available for the assistant to use. */ tools?: RunRequestToolsList; /** The text that you want the model to summarize */ inputText?: string; /** The maximum length of the generated summary in tokens */ maxLength?: number; /** Whether to ignore the EOS token and continue generating tokens after the EOS token is generated. */ ignoreEos?: boolean; } export const RunAiRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), modelName: S.String.pipe(T.Label("model_name")), text: S.optional(RunRequestText), prompt: S.optional(S.String), guidance: S.optional(S.Number), height: S.optional(S.Number), image: S.optional(RunRequestImage), imageB64: S.optional(S.String.pipe(T.Body("image_b64"))), mask: S.optional(RunRequestMaskList), negativePrompt: S.optional(S.String.pipe(T.Body("negative_prompt"))), numSteps: S.optional(S.Number.pipe(T.Body("num_steps"))), seed: S.optional(S.Number), strength: S.optional(S.Number), width: S.optional(S.Number), lang: S.optional(S.String), audio: S.optional(RunRequestAudioList), sourceLang: S.optional(S.String.pipe(T.Body("source_lang"))), targetLang: S.optional(S.String.pipe(T.Body("target_lang"))), frequencyPenalty: S.optional(S.Number.pipe(T.Body("frequency_penalty"))), lora: S.optional(S.String), maxTokens: S.optional(S.Number.pipe(T.Body("max_tokens"))), presencePenalty: S.optional(S.Number.pipe(T.Body("presence_penalty"))), raw: S.optional(S.Boolean), repetitionPenalty: S.optional(S.Number.pipe(T.Body("repetition_penalty"))), responseFormat: S.optional( RunRequestResponseFormat.pipe(T.Body("response_format")), ), stream: S.optional(S.Boolean), temperature: S.optional(S.Number), topK: S.optional(S.Number.pipe(T.Body("top_k"))), topP: S.optional(S.Number.pipe(T.Body("top_p"))), messages: S.optional(RunRequestMessages), functions: S.optional(RunRequestFunctionsList), tools: S.optional(RunRequestToolsList), inputText: S.optional(S.String.pipe(T.Body("input_text"))), maxLength: S.optional(S.Number.pipe(T.Body("max_length"))), ignoreEos: S.optional(S.Boolean.pipe(T.Body("ignore_eos"))), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/ai/run/{model_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "RunAiRequest" }) as any as S.Schema; export interface RunResultTextClassificationItem { /** The classification label assigned to the text (e.g., 'POSITIVE' or 'NEGATIVE') */ label?: string | null; /** Confidence score indicating the likelihood that the text belongs to the specified label */ score?: number | null; } export const RunResultTextClassificationItem = /*@__PURE__*/ S.suspend(() => S.Struct({ label: S.optional(S.NullOr(S.String)), score: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "RunResultTextClassificationItem", }) as any as S.Schema; export type RunResultTextClassificationList = Array; export const RunResultTextClassificationList = /*@__PURE__*/ S.Array( RunResultTextClassificationItem, ) as any as S.Schema; export interface RunResultAudio { /** The generated audio in MP3 format, base64-encoded */ audio?: string | null; } export const RunResultAudio = /*@__PURE__*/ S.suspend(() => S.Struct({ audio: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "RunResultAudio" }) as any as S.Schema; export type RunResultTextEmbeddingsDataItemList = Array; export const RunResultTextEmbeddingsDataItemList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export type RunResultTextEmbeddingsDataList = Array; export const RunResultTextEmbeddingsDataList = /*@__PURE__*/ S.Array( RunResultTextEmbeddingsDataItemList, ) as any as S.Schema; export type RunResultTextEmbeddingsShapeList = Array; export const RunResultTextEmbeddingsShapeList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export interface RunResultTextEmbeddings { /** Embeddings of the requested text values */ data?: RunResultTextEmbeddingsDataList | null; shape?: RunResultTextEmbeddingsShapeList | null; } export const RunResultTextEmbeddings = /*@__PURE__*/ S.suspend(() => S.Struct({ data: S.optional(S.NullOr(RunResultTextEmbeddingsDataList)), shape: S.optional(S.NullOr(RunResultTextEmbeddingsShapeList)), }), ).annotate({ identifier: "RunResultTextEmbeddings", }) as any as S.Schema; export interface RunResultAutomaticSpeechRecognitionWordsItem { /** The ending second when the word completes */ end?: number | null; /** The second this word begins in the recording */ start?: number | null; word?: string | null; } export const RunResultAutomaticSpeechRecognitionWordsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ end: S.optional(S.NullOr(S.Number)), start: S.optional(S.NullOr(S.Number)), word: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "RunResultAutomaticSpeechRecognitionWordsItem", }) as any as S.Schema; export type RunResultAutomaticSpeechRecognitionWordsList = Array; export const RunResultAutomaticSpeechRecognitionWordsList = /*@__PURE__*/ S.Array( RunResultAutomaticSpeechRecognitionWordsItem, ) as any as S.Schema; export interface RunResultAutomaticSpeechRecognition { /** The transcription */ text: string; vtt?: string | null; wordCount?: number | null; words?: RunResultAutomaticSpeechRecognitionWordsList | null; } export const RunResultAutomaticSpeechRecognition = /*@__PURE__*/ S.suspend(() => S.Struct({ text: S.String, vtt: S.optional(S.NullOr(S.String)), wordCount: S.optional(S.NullOr(S.Number).pipe(T.Body("word_count"))), words: S.optional(S.NullOr(RunResultAutomaticSpeechRecognitionWordsList)), }), ).annotate({ identifier: "RunResultAutomaticSpeechRecognition", }) as any as S.Schema; export interface RunResultImageClassificationItem { /** The predicted category or class for the input image based on analysis */ label?: string | null; /** A confidence value, between 0 and 1, indicating how certain the model is about the predicted label */ score?: number | null; } export const RunResultImageClassificationItem = /*@__PURE__*/ S.suspend(() => S.Struct({ label: S.optional(S.NullOr(S.String)), score: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "RunResultImageClassificationItem", }) as any as S.Schema; export type RunResultImageClassificationList = Array; export const RunResultImageClassificationList = /*@__PURE__*/ S.Array( RunResultImageClassificationItem, ) as any as S.Schema; export interface RunResultObjectDetectionItemBox { /** The x-coordinate of the bottom-right corner of the bounding box */ xmax?: number | null; /** The x-coordinate of the top-left corner of the bounding box */ xmin?: number | null; /** The y-coordinate of the bottom-right corner of the bounding box */ ymax?: number | null; /** The y-coordinate of the top-left corner of the bounding box */ ymin?: number | null; } export const RunResultObjectDetectionItemBox = /*@__PURE__*/ S.suspend(() => S.Struct({ xmax: S.optional(S.NullOr(S.Number)), xmin: S.optional(S.NullOr(S.Number)), ymax: S.optional(S.NullOr(S.Number)), ymin: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "RunResultObjectDetectionItemBox", }) as any as S.Schema; export interface RunResultObjectDetectionItem { /** Coordinates defining the bounding box around the detected object */ box?: RunResultObjectDetectionItemBox | null; /** The class label or name of the detected object */ label?: string | null; /** Confidence score indicating the likelihood that the detection is correct */ score?: number | null; } export const RunResultObjectDetectionItem = /*@__PURE__*/ S.suspend(() => S.Struct({ box: S.optional(S.NullOr(RunResultObjectDetectionItemBox)), label: S.optional(S.NullOr(S.String)), score: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "RunResultObjectDetectionItem", }) as any as S.Schema; export type RunResultObjectDetectionList = Array; export const RunResultObjectDetectionList = /*@__PURE__*/ S.Array( RunResultObjectDetectionItem, ) as any as S.Schema; export interface RunResultCase8ToolCallsItem { /** The arguments passed to be passed to the tool call request */ arguments?: unknown | null; /** The name of the tool to be called */ name?: string | null; } export const RunResultCase8ToolCallsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ arguments: S.optional(S.NullOr(S.Unknown)), name: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "RunResultCase8ToolCallsItem", }) as any as S.Schema; export type RunResultCase8ToolCallsList = Array; export const RunResultCase8ToolCallsList = /*@__PURE__*/ S.Array( RunResultCase8ToolCallsItem, ) as any as S.Schema; export interface RunResultCase8Usage { /** Total number of tokens in output */ completionTokens?: number | null; /** Total number of tokens in input */ promptTokens?: number | null; /** Total number of input and output tokens */ totalTokens?: number | null; } export const RunResultCase8Usage = /*@__PURE__*/ S.suspend(() => S.Struct({ completionTokens: S.optional( S.NullOr(S.Number).pipe(T.Body("completion_tokens")), ), promptTokens: S.optional(S.NullOr(S.Number).pipe(T.Body("prompt_tokens"))), totalTokens: S.optional(S.NullOr(S.Number).pipe(T.Body("total_tokens"))), }), ).annotate({ identifier: "RunResultCase8Usage", }) as any as S.Schema; export interface RunResultCase8 { /** The generated text response from the model */ response: string; /** An array of tool calls requests made during the response generation */ toolCalls?: RunResultCase8ToolCallsList | null; /** Usage statistics for the inference request */ usage?: RunResultCase8Usage | null; } export const RunResultCase8 = /*@__PURE__*/ S.suspend(() => S.Struct({ response: S.String, toolCalls: S.optional( S.NullOr(RunResultCase8ToolCallsList).pipe(T.Body("tool_calls")), ), usage: S.optional(S.NullOr(RunResultCase8Usage)), }), ).annotate({ identifier: "RunResultCase8" }) as any as S.Schema; export interface RunResultTranslation { /** The translated text in the target language */ translatedText?: string | null; } export const RunResultTranslation = /*@__PURE__*/ S.suspend(() => S.Struct({ translatedText: S.optional( S.NullOr(S.String).pipe(T.Body("translated_text")), ), }), ).annotate({ identifier: "RunResultTranslation", }) as any as S.Schema; export interface RunResultSummarization { /** The summarized version of the input text */ summary?: string | null; } export const RunResultSummarization = /*@__PURE__*/ S.suspend(() => S.Struct({ summary: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "RunResultSummarization", }) as any as S.Schema; export interface RunResultImageToText { description?: string | null; } export const RunResultImageToText = /*@__PURE__*/ S.suspend(() => S.Struct({ description: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "RunResultImageToText", }) as any as S.Schema; export type RunResultImageTextToText = RunResultImageToText; export const RunResultImageTextToText = RunResultImageToText; export type RunResultMultimodalEmbeddingsDataItemList = Array; export const RunResultMultimodalEmbeddingsDataItemList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export type RunResultMultimodalEmbeddingsDataList = Array; export const RunResultMultimodalEmbeddingsDataList = /*@__PURE__*/ S.Array( RunResultMultimodalEmbeddingsDataItemList, ) as any as S.Schema; export type RunResultMultimodalEmbeddingsShapeList = Array; export const RunResultMultimodalEmbeddingsShapeList = /*@__PURE__*/ S.Array( S.Number, ) as any as S.Schema; export interface RunResultMultimodalEmbeddings { data?: RunResultMultimodalEmbeddingsDataList | null; shape?: RunResultMultimodalEmbeddingsShapeList | null; } export const RunResultMultimodalEmbeddings = /*@__PURE__*/ S.suspend(() => S.Struct({ data: S.optional(S.NullOr(RunResultMultimodalEmbeddingsDataList)), shape: S.optional(S.NullOr(RunResultMultimodalEmbeddingsShapeList)), }), ).annotate({ identifier: "RunResultMultimodalEmbeddings", }) as any as S.Schema; export type RunResult = | string | RunResultTextClassificationList | RunResultAudio | RunResultTextEmbeddings | RunResultAutomaticSpeechRecognition | RunResultImageClassificationList | RunResultObjectDetectionList | RunResultCase8 | RunResultTranslation | RunResultSummarization | RunResultImageToText | RunResultImageToText | RunResultMultimodalEmbeddings; export const RunResult = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([ [], [], ["audio"], ["data", "shape"], ["text", "vtt", "wordCount", "words"], [], [], ["response", "toolCalls", "usage"], ["translatedText"], ["summary"], ["description"], ["description"], ["data", "shape"], ]), ); export type RunAiResponse = RunResult; export const RunAiResponse = /*@__PURE__*/ S.suspend(() => RunResult.pipe(T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "RunAiResponse" }) as any as S.Schema; export interface SupportedToMarkdownRequest { accountId: string; } export const SupportedToMarkdownRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/ai/tomarkdown/supported", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "SupportedToMarkdownRequest", }) as any as S.Schema; export interface ToMarkdownSupportedResultItem { extension: string; mimeType: string; } export const ToMarkdownSupportedResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ extension: S.String, mimeType: S.String, }), ).annotate({ identifier: "ToMarkdownSupportedResultItem", }) as any as S.Schema; export type ToMarkdownSupportedResultList = Array; export const ToMarkdownSupportedResultList = /*@__PURE__*/ S.Array( ToMarkdownSupportedResultItem, ) as any as S.Schema; export interface SupportedToMarkdownResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: ToMarkdownSupportedResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const SupportedToMarkdownResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: ToMarkdownSupportedResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "SupportedToMarkdownResponse", }) as any as S.Schema; export interface TransformToMarkdownRequest { accountId: string; } export const TransformToMarkdownRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/ai/tomarkdown", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "TransformToMarkdownRequest", }) as any as S.Schema; export interface ToMarkdownTransformResultItem { data: string; format: string; mimeType: string; name: string; tokens: string; } export const ToMarkdownTransformResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ data: S.String, format: S.String, mimeType: S.String, name: S.String, tokens: S.String, }), ).annotate({ identifier: "ToMarkdownTransformResultItem", }) as any as S.Schema; export type ToMarkdownTransformResultList = Array; export const ToMarkdownTransformResultList = /*@__PURE__*/ S.Array( ToMarkdownTransformResultItem, ) as any as S.Schema; export type TransformToMarkdownResponse = ToMarkdownTransformResultList; export const TransformToMarkdownResponse = /*@__PURE__*/ S.suspend(() => ToMarkdownTransformResultList.pipe( T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY), ), ).annotate({ identifier: "TransformToMarkdownResponse", }) as any as S.Schema; export type CreateFinetuneError = | ModelNotSupported | AccountNotFound | CloudflareOpError; /** Creates a new fine-tuning job for a Workers AI model using custom training data. */ export const createFinetune: API.OperationMethod< CreateFinetuneRequest, CreateFinetuneResponse, CreateFinetuneError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateFinetuneRequest, output: CreateFinetuneResponse, errors: [ ModelNotSupported, AccountNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateFinetuneAssetError = | ModelNotSupported | AccountNotFound | CloudflareOpError; /** Uploads training data assets for a Workers AI fine-tuning job. */ export const createFinetuneAsset: API.OperationMethod< CreateFinetuneAssetRequest, CreateFinetuneAssetResponse, CreateFinetuneAssetError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateFinetuneAssetRequest, output: CreateFinetuneAssetResponse, errors: [ ModelNotSupported, AccountNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetModelSchemaError = | ModelNotSupported | ModelSchemaNotFound | AccountNotFound | CloudflareOpError; /** Retrieves the input and output JSON schema definition for a Workers AI model. */ export const getModelSchema: API.OperationMethod< GetModelSchemaRequest, GetModelSchemaResponse, GetModelSchemaError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetModelSchemaRequest, output: GetModelSchemaResponse, errors: [ ModelNotSupported, ModelSchemaNotFound, AccountNotFound, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListAuthorsError = CloudflareOpError; /** Searches Workers AI models by author or organization name. */ export const listAuthors: API.PaginatedOperationMethod< ListAuthorsRequest, ListAuthorsResponse, ListAuthorsError, CloudflareOpContext, unknown > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListAuthorsRequest, output: ListAuthorsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type ListFinetunePublicsError = CloudflareOpError; /** Lists publicly available fine-tuned models that can be used with Workers AI. */ export const listFinetunePublics: API.PaginatedOperationMethod< ListFinetunePublicsRequest, ListFinetunePublicsResponse, ListFinetunePublicsError, CloudflareOpContext, FinetunesPublicListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListFinetunePublicsRequest, output: ListFinetunePublicsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type ListFinetunesError = AccountNotFound | CloudflareOpError; /** Lists all fine-tuning jobs created by the account, including status and metrics. */ export const listFinetunes: API.OperationMethod< ListFinetunesRequest, ListFinetunesResponse, ListFinetunesError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: ListFinetunesRequest, output: ListFinetunesResponse, errors: [AccountNotFound, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListModelsError = CloudflareOpError; /** Searches Workers AI models by name or description. */ export const listModels: API.OperationMethod< ListModelsRequest, ListModelsResponse, ListModelsError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: ListModelsRequest, output: ListModelsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListTasksError = CloudflareOpError; /** Searches Workers AI models by task type (e.g., text-generation, embeddings). */ export const listTasks: API.PaginatedOperationMethod< ListTasksRequest, ListTasksResponse, ListTasksError, CloudflareOpContext, unknown > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListTasksRequest, output: ListTasksResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type RunAiError = ModelNotFound | CloudflareOpError; /** This endpoint provides users with the capability to run specific AI models on-demand. By submitting the required input data, users can receive real-time predictions or results generated by the chosen AI model. The endpoint supports various AI model types, ensuring flexibility and adaptability for diverse use cases. Model specific inputs available in [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). */ export const runAi: API.OperationMethod< RunAiRequest, RunAiResponse, RunAiError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: RunAiRequest, output: RunAiResponse, errors: [ModelNotFound, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type SupportedToMarkdownError = CloudflareOpError; /** Lists all file formats supported for conversion to Markdown. */ export const supportedToMarkdown: API.PaginatedOperationMethod< SupportedToMarkdownRequest, SupportedToMarkdownResponse, SupportedToMarkdownError, CloudflareOpContext, ToMarkdownSupportedResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: SupportedToMarkdownRequest, output: SupportedToMarkdownResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any; export type TransformToMarkdownError = CloudflareOpError; /** Converts uploaded files into Markdown format using Workers AI. */ export const transformToMarkdown: API.OperationMethod< TransformToMarkdownRequest, TransformToMarkdownResponse, TransformToMarkdownError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: TransformToMarkdownRequest, output: TransformToMarkdownResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); // Alias of transformToMarkdown (same route, alternate export name upstream). export const createAiToMarkdown = transformToMarkdown; export type CreateAiToMarkdownRequest = TransformToMarkdownRequest; export type CreateAiToMarkdownResponse = TransformToMarkdownResponse; export type CreateAiToMarkdownError = TransformToMarkdownError;