UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

66 lines • 2.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AI = exports.BaseAI = void 0; const tslib_1 = require("../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const AuthorsAPI = tslib_1.__importStar(require("./authors.js")); const authors_1 = require("./authors.js"); const TasksAPI = tslib_1.__importStar(require("./tasks.js")); const tasks_1 = require("./tasks.js"); const ToMarkdownAPI = tslib_1.__importStar(require("./to-markdown.js")); const to_markdown_1 = require("./to-markdown.js"); const FinetunesAPI = tslib_1.__importStar(require("./finetunes/finetunes.js")); const finetunes_1 = require("./finetunes/finetunes.js"); const ModelsAPI = tslib_1.__importStar(require("./models/models.js")); const models_1 = require("./models/models.js"); const path_1 = require("../../internal/utils/path.js"); var BaseAI = /* @__PURE__ */ (() => { class BaseAI extends resource_1.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((0, path_1.path) `/accounts/${account_id}/ai/run/${modelName}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } } BaseAI._key = Object.freeze(['ai']); return BaseAI; })(); exports.BaseAI = BaseAI; 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_1.Finetunes; AI.BaseFinetunes = finetunes_1.BaseFinetunes; AI.Authors = authors_1.Authors; AI.BaseAuthors = authors_1.BaseAuthors; AI.Tasks = tasks_1.Tasks; AI.BaseTasks = tasks_1.BaseTasks; AI.Models = models_1.Models; AI.BaseModels = models_1.BaseModels; AI.ToMarkdown = to_markdown_1.ToMarkdown; AI.BaseToMarkdown = to_markdown_1.BaseToMarkdown; return AI; })(); exports.AI = AI; //# sourceMappingURL=ai.js.map