UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

60 lines • 2.52 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import * as AuthorsAPI from "./authors.mjs"; import { Authors, BaseAuthors, } from "./authors.mjs"; import * as TasksAPI from "./tasks.mjs"; import { BaseTasks, Tasks } from "./tasks.mjs"; import * as ToMarkdownAPI from "./to-markdown.mjs"; import { BaseToMarkdown, ToMarkdown, } from "./to-markdown.mjs"; import * as FinetunesAPI from "./finetunes/finetunes.mjs"; import { BaseFinetunes, Finetunes, } from "./finetunes/finetunes.mjs"; import * as ModelsAPI from "./models/models.mjs"; import { BaseModels, Models, } from "./models/models.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseAI = /* @__PURE__ */ (() => { class BaseAI extends APIResource { /** * Runs the Workers AI model specified in the URL path. Send the model's inputs * directly in the request body, without a model/input/options wrapper. * * Accepts model-specific JSON or binary input. The response format depends on the * model and the requested output. * * See the [model catalog](https://developers.cloudflare.com/workers-ai/models/) * for supported models and their input formats. */ run(modelName, params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/ai/run/${modelName}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } } BaseAI._key = Object.freeze(['ai']); return BaseAI; })(); export var AI = /* @__PURE__ */ (() => { class AI extends BaseAI { constructor() { super(...arguments); this.finetunes = new FinetunesAPI.Finetunes(this._client); this.authors = new AuthorsAPI.Authors(this._client); this.tasks = new TasksAPI.Tasks(this._client); this.models = new ModelsAPI.Models(this._client); this.toMarkdown = new ToMarkdownAPI.ToMarkdown(this._client); } } AI.Finetunes = Finetunes; AI.BaseFinetunes = BaseFinetunes; AI.Authors = Authors; AI.BaseAuthors = BaseAuthors; AI.Tasks = Tasks; AI.BaseTasks = BaseTasks; AI.Models = Models; AI.BaseModels = BaseModels; AI.ToMarkdown = ToMarkdown; AI.BaseToMarkdown = BaseToMarkdown; return AI; })(); //# sourceMappingURL=ai.mjs.map