UNPKG

openai

Version:

The official TypeScript library for the OpenAI API

21 lines • 1.07 kB
"use strict"; // File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.Completions = void 0; const resource_1 = require("../core/resource.js"); function resolveResourceRequestOptions(options, buildOptions) { return Promise.resolve(options).then(buildOptions); } function withBodyFinalization(options, finalization) { return { ...options, __metadata: { ...options.__metadata, ...finalization } }; } /** * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. */ class Completions extends resource_1.APIResource { create(body, options) { return this._client.post('/completions', resolveResourceRequestOptions(options, (options) => withBodyFinalization({ body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, { streamFromBody: true }))); } } exports.Completions = Completions; //# sourceMappingURL=completions.js.map