openai-edge
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["openai-edge"]={})}(this,(function(e){"use strict";const t="https://api.openai.com/v1".replace(/\/+$/,""),n="undefined"==typeof fetch?void 0:fetch;class a{basePath;fetch;configuration;constructor(e,a=t,s=n){this.basePath=a,this.fetch=s,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class s extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const r="https://example.com",i=function(e,t,n){if(null==n)throw new s(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function o(e,t,n=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>o(e,t,n))):Object.keys(t).forEach((a=>o(e,t[a],`${n}${""!==n?".":""}${a}`))):e.has(n)?e.append(n,t):e.set(n,t))}const c=function(e,...t){const n=new URLSearchParams(e.search);o(n,t),e.search=n.toString()},h=function(e,t,n){const a="string"!=typeof e;return(a&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):a)?JSON.stringify(void 0!==e?e:{}):e||""},d=function(e){return e.pathname+e.search+e.hash},l=function(e,t,n,a){return(s=t,r=n)=>{if(void 0===s)throw new Error("You must pass a fetch polyfill if you're running in an environment without a global fetch");return s((a?.basePath||r)+e.url,e.options)}},u="undefined"==typeof fetch?void 0:fetch,p=function(e){return{cancelFineTune:async(t,n={})=>{i("cancelFineTune","fineTuneId",t);const a="/fine-tunes/{fine_tune_id}/cancel".replace("{fine_tune_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"POST",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},createAnswer:async(t,n={})=>{i("createAnswer","createAnswerRequest",t);const a=new URL("/answers",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createChatCompletion:async(t,n={})=>{i("createChatCompletion","createChatCompletionRequest",t);const a=new URL("/chat/completions",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createClassification:async(t,n={})=>{i("createClassification","createClassificationRequest",t);const a=new URL("/classifications",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createCompletion:async(t,n={})=>{i("createCompletion","createCompletionRequest",t);const a=new URL("/completions",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createEdit:async(t,n={})=>{i("createEdit","createEditRequest",t);const a=new URL("/edits",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createEmbedding:async(t,n={})=>{i("createEmbedding","createEmbeddingRequest",t);const a=new URL("/embeddings",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createFile:async(t,n,a={})=>{i("createFile","file",t),i("createFile","purpose",n);const s=new URL("/files",r);let o;e&&(o=e.baseOptions);const h={method:"POST",...o,...a},l={},u=new(e&&e.formDataCtor||FormData);void 0!==t&&u.append("file",t),void 0!==n&&u.append("purpose",n),l["Content-Type"]="multipart/form-data",c(s,{});let p=o&&o.headers?o.headers:{};return h.headers={...l,...u.getHeaders(),...p,...a.headers},h.body=u,{url:d(s),options:h}},createFineTune:async(t,n={})=>{i("createFineTune","createFineTuneRequest",t);const a=new URL("/fine-tunes",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createImage:async(t,n={})=>{i("createImage","createImageRequest",t);const a=new URL("/images/generations",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createImageEdit:async(t,n,a,s,o,h,l,u={})=>{i("createImageEdit","image",t),i("createImageEdit","prompt",n);const p=new URL("/images/edits",r);let m;e&&(m=e.baseOptions);const f={method:"POST",...m,...u},g={},y=new(e&&e.formDataCtor||FormData);void 0!==t&&y.append("image",t),void 0!==a&&y.append("mask",a),void 0!==n&&y.append("prompt",n),void 0!==s&&y.append("n",s),void 0!==o&&y.append("size",o),void 0!==h&&y.append("response_format",h),void 0!==l&&y.append("user",l),g["Content-Type"]="multipart/form-data",c(p,{});let T=m&&m.headers?m.headers:{};return f.headers={...g,...y.getHeaders(),...T,...u.headers},f.body=y,{url:d(p),options:f}},createImageVariation:async(t,n,a,s,o,h={})=>{i("createImageVariation","image",t);const l=new URL("/images/variations",r);let u;e&&(u=e.baseOptions);const p={method:"POST",...u,...h},m={},f=new(e&&e.formDataCtor||FormData);void 0!==t&&f.append("image",t),void 0!==n&&f.append("n",n),void 0!==a&&f.append("size",a),void 0!==s&&f.append("response_format",s),void 0!==o&&f.append("user",o),m["Content-Type"]="multipart/form-data",c(l,{});let g=u&&u.headers?u.headers:{};return p.headers={...m,...f.getHeaders(),...g,...h.headers},p.body=f,{url:d(l),options:p}},createModeration:async(t,n={})=>{i("createModeration","createModerationRequest",t);const a=new URL("/moderations",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createSearch:async(t,n,a={})=>{i("createSearch","engineId",t),i("createSearch","createSearchRequest",n);const s="/engines/{engine_id}/search".replace("{engine_id}",encodeURIComponent(String(t))),o=new URL(s,r);let l;e&&(l=e.baseOptions);const u={method:"POST",...l,...a},p={};p["Content-Type"]="application/json",c(o,{});let m=l&&l.headers?l.headers:{};return u.headers={...p,...m,...a.headers},u.body=h(n,u,e),{url:d(o),options:u}},createTranscription:async(t,n,a,s,o,h,l={})=>{i("createTranscription","file",t),i("createTranscription","model",n);const u=new URL("/audio/transcriptions",r);let p;e&&(p=e.baseOptions);const m={method:"POST",...p,...l},f={},g=new(e&&e.formDataCtor||FormData);void 0!==t&&g.append("file",t),void 0!==n&&g.append("model",n),void 0!==a&&g.append("prompt",a),void 0!==s&&g.append("response_format",s),void 0!==o&&g.append("temperature",o),void 0!==h&&g.append("language",h),f["Content-Type"]="multipart/form-data",c(u,{});let y=p&&p.headers?p.headers:{};return m.headers={...f,...g.getHeaders(),...y,...l.headers},m.body=g,{url:d(u),options:m}},createTranslation:async(t,n,a,s,o,h={})=>{i("createTranslation","file",t),i("createTranslation","model",n);const l=new URL("/audio/translations",r);let u;e&&(u=e.baseOptions);const p={method:"POST",...u,...h},m={},f=new(e&&e.formDataCtor||FormData);void 0!==t&&f.append("file",t),void 0!==n&&f.append("model",n),void 0!==a&&f.append("prompt",a),void 0!==s&&f.append("response_format",s),void 0!==o&&f.append("temperature",o),m["Content-Type"]="multipart/form-data",c(l,{});let g=u&&u.headers?u.headers:{};return p.headers={...m,...f.getHeaders(),...g,...h.headers},p.body=f,{url:d(l),options:p}},deleteFile:async(t,n={})=>{i("deleteFile","fileId",t);const a="/files/{file_id}".replace("{file_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"DELETE",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},deleteModel:async(t,n={})=>{i("deleteModel","model",t);const a="/models/{model}".replace("{model}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"DELETE",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},downloadFile:async(t,n={})=>{i("downloadFile","fileId",t);const a="/files/{file_id}/content".replace("{file_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},listEngines:async(t={})=>{const n=new URL("/engines",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},listFiles:async(t={})=>{const n=new URL("/files",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},listFineTuneEvents:async(t,n,a={})=>{i("listFineTuneEvents","fineTuneId",t);const s="/fine-tunes/{fine_tune_id}/events".replace("{fine_tune_id}",encodeURIComponent(String(t))),o=new URL(s,r);let h;e&&(h=e.baseOptions);const l={method:"GET",...h,...a},u={};void 0!==n&&(u.stream=n),c(o,u);let p=h&&h.headers?h.headers:{};return l.headers={...p,...a.headers},{url:d(o),options:l}},listFineTunes:async(t={})=>{const n=new URL("/fine-tunes",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},listModels:async(t={})=>{const n=new URL("/models",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},retrieveEngine:async(t,n={})=>{i("retrieveEngine","engineId",t);const a="/engines/{engine_id}".replace("{engine_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},retrieveFile:async(t,n={})=>{i("retrieveFile","fileId",t);const a="/files/{file_id}".replace("{file_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},retrieveFineTune:async(t,n={})=>{i("retrieveFineTune","fineTuneId",t);const a="/fine-tunes/{fine_tune_id}".replace("{fine_tune_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},retrieveModel:async(t,n={})=>{i("retrieveModel","model",t);const a="/models/{model}".replace("{model}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}}}},m=function(e){const n=p(e);return{async cancelFineTune(a,s){const r=await n.cancelFineTune(a,s);return l(r,u,t,e)},async createAnswer(a,s){const r=await n.createAnswer(a,s);return l(r,u,t,e)},async createChatCompletion(a,s){const r=await n.createChatCompletion(a,s);return l(r,u,t,e)},async createClassification(a,s){const r=await n.createClassification(a,s);return l(r,u,t,e)},async createCompletion(a,s){const r=await n.createCompletion(a,s);return l(r,u,t,e)},async createEdit(a,s){const r=await n.createEdit(a,s);return l(r,u,t,e)},async createEmbedding(a,s){const r=await n.createEmbedding(a,s);return l(r,u,t,e)},async createFile(a,s,r){const i=await n.createFile(a,s,r);return l(i,u,t,e)},async createFineTune(a,s){const r=await n.createFineTune(a,s);return l(r,u,t,e)},async createImage(a,s){const r=await n.createImage(a,s);return l(r,u,t,e)},async createImageEdit(a,s,r,i,o,c,h,d){const p=await n.createImageEdit(a,s,r,i,o,c,h,d);return l(p,u,t,e)},async createImageVariation(a,s,r,i,o,c){const h=await n.createImageVariation(a,s,r,i,o,c);return l(h,u,t,e)},async createModeration(a,s){const r=await n.createModeration(a,s);return l(r,u,t,e)},async createSearch(a,s,r){const i=await n.createSearch(a,s,r);return l(i,u,t,e)},async createTranscription(a,s,r,i,o,c,h){const d=await n.createTranscription(a,s,r,i,o,c,h);return l(d,u,t,e)},async createTranslation(a,s,r,i,o,c){const h=await n.createTranslation(a,s,r,i,o,c);return l(h,u,t,e)},async deleteFile(a,s){const r=await n.deleteFile(a,s);return l(r,u,t,e)},async deleteModel(a,s){const r=await n.deleteModel(a,s);return l(r,u,t,e)},async downloadFile(a,s){const r=await n.downloadFile(a,s);return l(r,u,t,e)},async listEngines(a){const s=await n.listEngines(a);return l(s,u,t,e)},async listFiles(a){const s=await n.listFiles(a);return l(s,u,t,e)},async listFineTuneEvents(a,s,r){const i=await n.listFineTuneEvents(a,s,r);return l(i,u,t,e)},async listFineTunes(a){const s=await n.listFineTunes(a);return l(s,u,t,e)},async listModels(a){const s=await n.listModels(a);return l(s,u,t,e)},async retrieveEngine(a,s){const r=await n.retrieveEngine(a,s);return l(r,u,t,e)},async retrieveFile(a,s){const r=await n.retrieveFile(a,s);return l(r,u,t,e)},async retrieveFineTune(a,s){const r=await n.retrieveFineTune(a,s);return l(r,u,t,e)},async retrieveModel(a,s){const r=await n.retrieveModel(a,s);return l(r,u,t,e)}}};class f extends FormData{_boundary;constructor(...e){super(...e),this._boundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);return e}()}getHeaders(){return{"content-type":"multipart/form-data; boundary="+this._boundary}}}e.ChatCompletionRequestMessageRoleEnum={System:"system",User:"user",Assistant:"assistant",Function:"function"},e.ChatCompletionResponseMessageRoleEnum={System:"system",User:"user",Assistant:"assistant",Function:"function"},e.Configuration=class{apiKey;organization;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.organization=e.organization,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor,this.baseOptions||(this.baseOptions={}),this.baseOptions.headers={Authorization:`Bearer ${this.apiKey}`,...this.baseOptions.headers},this.organization&&(this.baseOptions.headers["OpenAI-Organization"]=this.organization),this.formDataCtor||(this.formDataCtor=f)}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}},e.CreateImageRequestResponseFormatEnum={Url:"url",B64Json:"b64_json"},e.CreateImageRequestSizeEnum={_256x256:"256x256",_512x512:"512x512",_1024x1024:"1024x1024"},e.OpenAIApi=class extends a{cancelFineTune(e,t){return m(this.configuration).cancelFineTune(e,t).then((e=>e(this.fetch,this.basePath)))}createAnswer(e,t){return m(this.configuration).createAnswer(e,t).then((e=>e(this.fetch,this.basePath)))}createChatCompletion(e,t){return m(this.configuration).createChatCompletion(e,t).then((e=>e(this.fetch,this.basePath)))}createClassification(e,t){return m(this.configuration).createClassification(e,t).then((e=>e(this.fetch,this.basePath)))}createCompletion(e,t){return m(this.configuration).createCompletion(e,t).then((e=>e(this.fetch,this.basePath)))}createEdit(e,t){return m(this.configuration).createEdit(e,t).then((e=>e(this.fetch,this.basePath)))}createEmbedding(e,t){return m(this.configuration).createEmbedding(e,t).then((e=>e(this.fetch,this.basePath)))}createFile(e,t,n){return m(this.configuration).createFile(e,t,n).then((e=>e(this.fetch,this.basePath)))}createFineTune(e,t){return m(this.configuration).createFineTune(e,t).then((e=>e(this.fetch,this.basePath)))}createImage(e,t){return m(this.configuration).createImage(e,t).then((e=>e(this.fetch,this.basePath)))}createImageEdit(e,t,n,a,s,r,i,o){return m(this.configuration).createImageEdit(e,t,n,a,s,r,i,o).then((e=>e(this.fetch,this.basePath)))}createImageVariation(e,t,n,a,s,r){return m(this.configuration).createImageVariation(e,t,n,a,s,r).then((e=>e(this.fetch,this.basePath)))}createModeration(e,t){return m(this.configuration).createModeration(e,t).then((e=>e(this.fetch,this.basePath)))}createSearch(e,t,n){return m(this.configuration).createSearch(e,t,n).then((e=>e(this.fetch,this.basePath)))}createTranscription(e,t,n,a,s,r,i){return m(this.configuration).createTranscription(e,t,n,a,s,r,i).then((e=>e(this.fetch,this.basePath)))}createTranslation(e,t,n,a,s,r){return m(this.configuration).createTranslation(e,t,n,a,s,r).then((e=>e(this.fetch,this.basePath)))}deleteFile(e,t){return m(this.configuration).deleteFile(e,t).then((e=>e(this.fetch,this.basePath)))}deleteModel(e,t){return m(this.configuration).deleteModel(e,t).then((e=>e(this.fetch,this.basePath)))}downloadFile(e,t){return m(this.configuration).downloadFile(e,t).then((e=>e(this.fetch,this.basePath)))}listEngines(e){return m(this.configuration).listEngines(e).then((e=>e(this.fetch,this.basePath)))}listFiles(e){return m(this.configuration).listFiles(e).then((e=>e(this.fetch,this.basePath)))}listFineTuneEvents(e,t,n){return m(this.configuration).listFineTuneEvents(e,t,n).then((e=>e(this.fetch,this.basePath)))}listFineTunes(e){return m(this.configuration).listFineTunes(e).then((e=>e(this.fetch,this.basePath)))}listModels(e){return m(this.configuration).listModels(e).then((e=>e(this.fetch,this.basePath)))}retrieveEngine(e,t){return m(this.configuration).retrieveEngine(e,t).then((e=>e(this.fetch,this.basePath)))}retrieveFile(e,t){return m(this.configuration).retrieveFile(e,t).then((e=>e(this.fetch,this.basePath)))}retrieveFineTune(e,t){return m(this.configuration).retrieveFineTune(e,t).then((e=>e(this.fetch,this.basePath)))}retrieveModel(e,t){return m(this.configuration).retrieveModel(e,t).then((e=>e(this.fetch,this.basePath)))}},e.OpenAIApiFactory=function(e,t,n){const a=m(e);return{cancelFineTune:(e,s)=>a.cancelFineTune(e,s).then((e=>e(n,t))),createAnswer:(e,s)=>a.createAnswer(e,s).then((e=>e(n,t))),createChatCompletion:(e,s)=>a.createChatCompletion(e,s).then((e=>e(n,t))),createClassification:(e,s)=>a.createClassification(e,s).then((e=>e(n,t))),createCompletion:(e,s)=>a.createCompletion(e,s).then((e=>e(n,t))),createEdit:(e,s)=>a.createEdit(e,s).then((e=>e(n,t))),createEmbedding:(e,s)=>a.createEmbedding(e,s).then((e=>e(n,t))),createFile:(e,s,r)=>a.createFile(e,s,r).then((e=>e(n,t))),createFineTune:(e,s)=>a.createFineTune(e,s).then((e=>e(n,t))),createImage:(e,s)=>a.createImage(e,s).then((e=>e(n,t))),createImageEdit:(e,s,r,i,o,c,h,d)=>a.createImageEdit(e,s,r,i,o,c,h,d).then((e=>e(n,t))),createImageVariation:(e,s,r,i,o,c)=>a.createImageVariation(e,s,r,i,o,c).then((e=>e(n,t))),createModeration:(e,s)=>a.createModeration(e,s).then((e=>e(n,t))),createSearch:(e,s,r)=>a.createSearch(e,s,r).then((e=>e(n,t))),createTranscription:(e,s,r,i,o,c,h)=>a.createTranscription(e,s,r,i,o,c,h).then((e=>e(n,t))),createTranslation:(e,s,r,i,o,c)=>a.createTranslation(e,s,r,i,o,c).then((e=>e(n,t))),deleteFile:(e,s)=>a.deleteFile(e,s).then((e=>e(n,t))),deleteModel:(e,s)=>a.deleteModel(e,s).then((e=>e(n,t))),downloadFile:(e,s)=>a.downloadFile(e,s).then((e=>e(n,t))),listEngines:e=>a.listEngines(e).then((e=>e(n,t))),listFiles:e=>a.listFiles(e).then((e=>e(n,t))),listFineTuneEvents:(e,s,r)=>a.listFineTuneEvents(e,s,r).then((e=>e(n,t))),listFineTunes:e=>a.listFineTunes(e).then((e=>e(n,t))),listModels:e=>a.listModels(e).then((e=>e(n,t))),retrieveEngine:(e,s)=>a.retrieveEngine(e,s).then((e=>e(n,t))),retrieveFile:(e,s)=>a.retrieveFile(e,s).then((e=>e(n,t))),retrieveFineTune:(e,s)=>a.retrieveFineTune(e,s).then((e=>e(n,t))),retrieveModel:(e,s)=>a.retrieveModel(e,s).then((e=>e(n,t)))}},e.OpenAIApiFp=m,e.OpenAIApiParamCreator=p})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["openai-edge"]={})}(this,(function(e){"use strict";const t="https://api.openai.com/v1".replace(/\/+$/,""),n="undefined"==typeof fetch?void 0:fetch;class a{basePath;fetch;configuration;constructor(e,a=t,s=n){this.basePath=a,this.fetch=s,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class s extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const r="https://example.com",i=function(e,t,n){if(null==n)throw new s(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function o(e,t,n=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>o(e,t,n))):Object.keys(t).forEach((a=>o(e,t[a],`${n}${""!==n?".":""}${a}`))):e.has(n)?e.append(n,t):e.set(n,t))}const c=function(e,...t){const n=new URLSearchParams(e.search);o(n,t),e.search=n.toString()},h=function(e,t,n){const a="string"!=typeof e;return(a&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):a)?JSON.stringify(void 0!==e?e:{}):e||""},d=function(e){return e.pathname+e.search+e.hash},l=function(e,t,n,a){return(s=t,r=n)=>{if(void 0===s)throw new Error("You must pass a fetch polyfill if you're running in an environment without a global fetch");let i=e.url;if(a?.defaultQueryParams){const e=-1===i.indexOf("?")?"?":"&";i+=e+a.defaultQueryParams}return s((a?.basePath||r)+i,e.options)}},u="undefined"==typeof fetch?void 0:fetch,p=function(e){return{cancelFineTune:async(t,n={})=>{i("cancelFineTune","fineTuneId",t);const a="/fine-tunes/{fine_tune_id}/cancel".replace("{fine_tune_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"POST",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},createAnswer:async(t,n={})=>{i("createAnswer","createAnswerRequest",t);const a=new URL("/answers",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createChatCompletion:async(t,n={})=>{i("createChatCompletion","createChatCompletionRequest",t);const a=new URL("/chat/completions",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createClassification:async(t,n={})=>{i("createClassification","createClassificationRequest",t);const a=new URL("/classifications",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createCompletion:async(t,n={})=>{i("createCompletion","createCompletionRequest",t);const a=new URL("/completions",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createEdit:async(t,n={})=>{i("createEdit","createEditRequest",t);const a=new URL("/edits",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createEmbedding:async(t,n={})=>{i("createEmbedding","createEmbeddingRequest",t);const a=new URL("/embeddings",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createFile:async(t,n,a={})=>{i("createFile","file",t),i("createFile","purpose",n);const s=new URL("/files",r);let o;e&&(o=e.baseOptions);const h={method:"POST",...o,...a},l={},u=new(e&&e.formDataCtor||FormData);void 0!==t&&u.append("file",t),void 0!==n&&u.append("purpose",n),l["Content-Type"]="multipart/form-data",c(s,{});let p=o&&o.headers?o.headers:{};return h.headers={...l,...u.getHeaders(),...p,...a.headers},h.body=u,{url:d(s),options:h}},createFineTune:async(t,n={})=>{i("createFineTune","createFineTuneRequest",t);const a=new URL("/fine-tunes",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createImage:async(t,n={})=>{i("createImage","createImageRequest",t);const a=new URL("/images/generations",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createImageEdit:async(t,n,a,s,o,h,l,u={})=>{i("createImageEdit","image",t),i("createImageEdit","prompt",n);const p=new URL("/images/edits",r);let m;e&&(m=e.baseOptions);const f={method:"POST",...m,...u},g={},y=new(e&&e.formDataCtor||FormData);void 0!==t&&y.append("image",t),void 0!==a&&y.append("mask",a),void 0!==n&&y.append("prompt",n),void 0!==s&&y.append("n",s),void 0!==o&&y.append("size",o),void 0!==h&&y.append("response_format",h),void 0!==l&&y.append("user",l),g["Content-Type"]="multipart/form-data",c(p,{});let T=m&&m.headers?m.headers:{};return f.headers={...g,...y.getHeaders(),...T,...u.headers},f.body=y,{url:d(p),options:f}},createImageVariation:async(t,n,a,s,o,h={})=>{i("createImageVariation","image",t);const l=new URL("/images/variations",r);let u;e&&(u=e.baseOptions);const p={method:"POST",...u,...h},m={},f=new(e&&e.formDataCtor||FormData);void 0!==t&&f.append("image",t),void 0!==n&&f.append("n",n),void 0!==a&&f.append("size",a),void 0!==s&&f.append("response_format",s),void 0!==o&&f.append("user",o),m["Content-Type"]="multipart/form-data",c(l,{});let g=u&&u.headers?u.headers:{};return p.headers={...m,...f.getHeaders(),...g,...h.headers},p.body=f,{url:d(l),options:p}},createModeration:async(t,n={})=>{i("createModeration","createModerationRequest",t);const a=new URL("/moderations",r);let s;e&&(s=e.baseOptions);const o={method:"POST",...s,...n},l={};l["Content-Type"]="application/json",c(a,{});let u=s&&s.headers?s.headers:{};return o.headers={...l,...u,...n.headers},o.body=h(t,o,e),{url:d(a),options:o}},createSearch:async(t,n,a={})=>{i("createSearch","engineId",t),i("createSearch","createSearchRequest",n);const s="/engines/{engine_id}/search".replace("{engine_id}",encodeURIComponent(String(t))),o=new URL(s,r);let l;e&&(l=e.baseOptions);const u={method:"POST",...l,...a},p={};p["Content-Type"]="application/json",c(o,{});let m=l&&l.headers?l.headers:{};return u.headers={...p,...m,...a.headers},u.body=h(n,u,e),{url:d(o),options:u}},createTranscription:async(t,n,a,s,o,h,l={})=>{i("createTranscription","file",t),i("createTranscription","model",n);const u=new URL("/audio/transcriptions",r);let p;e&&(p=e.baseOptions);const m={method:"POST",...p,...l},f={},g=new(e&&e.formDataCtor||FormData);void 0!==t&&g.append("file",t),void 0!==n&&g.append("model",n),void 0!==a&&g.append("prompt",a),void 0!==s&&g.append("response_format",s),void 0!==o&&g.append("temperature",o),void 0!==h&&g.append("language",h),f["Content-Type"]="multipart/form-data",c(u,{});let y=p&&p.headers?p.headers:{};return m.headers={...f,...g.getHeaders(),...y,...l.headers},m.body=g,{url:d(u),options:m}},createTranslation:async(t,n,a,s,o,h={})=>{i("createTranslation","file",t),i("createTranslation","model",n);const l=new URL("/audio/translations",r);let u;e&&(u=e.baseOptions);const p={method:"POST",...u,...h},m={},f=new(e&&e.formDataCtor||FormData);void 0!==t&&f.append("file",t),void 0!==n&&f.append("model",n),void 0!==a&&f.append("prompt",a),void 0!==s&&f.append("response_format",s),void 0!==o&&f.append("temperature",o),m["Content-Type"]="multipart/form-data",c(l,{});let g=u&&u.headers?u.headers:{};return p.headers={...m,...f.getHeaders(),...g,...h.headers},p.body=f,{url:d(l),options:p}},deleteFile:async(t,n={})=>{i("deleteFile","fileId",t);const a="/files/{file_id}".replace("{file_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"DELETE",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},deleteModel:async(t,n={})=>{i("deleteModel","model",t);const a="/models/{model}".replace("{model}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"DELETE",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},downloadFile:async(t,n={})=>{i("downloadFile","fileId",t);const a="/files/{file_id}/content".replace("{file_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},listEngines:async(t={})=>{const n=new URL("/engines",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},listFiles:async(t={})=>{const n=new URL("/files",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},listFineTuneEvents:async(t,n,a={})=>{i("listFineTuneEvents","fineTuneId",t);const s="/fine-tunes/{fine_tune_id}/events".replace("{fine_tune_id}",encodeURIComponent(String(t))),o=new URL(s,r);let h;e&&(h=e.baseOptions);const l={method:"GET",...h,...a},u={};void 0!==n&&(u.stream=n),c(o,u);let p=h&&h.headers?h.headers:{};return l.headers={...p,...a.headers},{url:d(o),options:l}},listFineTunes:async(t={})=>{const n=new URL("/fine-tunes",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},listModels:async(t={})=>{const n=new URL("/models",r);let a;e&&(a=e.baseOptions);const s={method:"GET",...a,...t};c(n,{});let i=a&&a.headers?a.headers:{};return s.headers={...i,...t.headers},{url:d(n),options:s}},retrieveEngine:async(t,n={})=>{i("retrieveEngine","engineId",t);const a="/engines/{engine_id}".replace("{engine_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},retrieveFile:async(t,n={})=>{i("retrieveFile","fileId",t);const a="/files/{file_id}".replace("{file_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},retrieveFineTune:async(t,n={})=>{i("retrieveFineTune","fineTuneId",t);const a="/fine-tunes/{fine_tune_id}".replace("{fine_tune_id}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}},retrieveModel:async(t,n={})=>{i("retrieveModel","model",t);const a="/models/{model}".replace("{model}",encodeURIComponent(String(t))),s=new URL(a,r);let o;e&&(o=e.baseOptions);const h={method:"GET",...o,...n};c(s,{});let l=o&&o.headers?o.headers:{};return h.headers={...l,...n.headers},{url:d(s),options:h}}}},m=function(e){const n=p(e);return{async cancelFineTune(a,s){const r=await n.cancelFineTune(a,s);return l(r,u,t,e)},async createAnswer(a,s){const r=await n.createAnswer(a,s);return l(r,u,t,e)},async createChatCompletion(a,s){const r=await n.createChatCompletion(a,s);return l(r,u,t,e)},async createClassification(a,s){const r=await n.createClassification(a,s);return l(r,u,t,e)},async createCompletion(a,s){const r=await n.createCompletion(a,s);return l(r,u,t,e)},async createEdit(a,s){const r=await n.createEdit(a,s);return l(r,u,t,e)},async createEmbedding(a,s){const r=await n.createEmbedding(a,s);return l(r,u,t,e)},async createFile(a,s,r){const i=await n.createFile(a,s,r);return l(i,u,t,e)},async createFineTune(a,s){const r=await n.createFineTune(a,s);return l(r,u,t,e)},async createImage(a,s){const r=await n.createImage(a,s);return l(r,u,t,e)},async createImageEdit(a,s,r,i,o,c,h,d){const p=await n.createImageEdit(a,s,r,i,o,c,h,d);return l(p,u,t,e)},async createImageVariation(a,s,r,i,o,c){const h=await n.createImageVariation(a,s,r,i,o,c);return l(h,u,t,e)},async createModeration(a,s){const r=await n.createModeration(a,s);return l(r,u,t,e)},async createSearch(a,s,r){const i=await n.createSearch(a,s,r);return l(i,u,t,e)},async createTranscription(a,s,r,i,o,c,h){const d=await n.createTranscription(a,s,r,i,o,c,h);return l(d,u,t,e)},async createTranslation(a,s,r,i,o,c){const h=await n.createTranslation(a,s,r,i,o,c);return l(h,u,t,e)},async deleteFile(a,s){const r=await n.deleteFile(a,s);return l(r,u,t,e)},async deleteModel(a,s){const r=await n.deleteModel(a,s);return l(r,u,t,e)},async downloadFile(a,s){const r=await n.downloadFile(a,s);return l(r,u,t,e)},async listEngines(a){const s=await n.listEngines(a);return l(s,u,t,e)},async listFiles(a){const s=await n.listFiles(a);return l(s,u,t,e)},async listFineTuneEvents(a,s,r){const i=await n.listFineTuneEvents(a,s,r);return l(i,u,t,e)},async listFineTunes(a){const s=await n.listFineTunes(a);return l(s,u,t,e)},async listModels(a){const s=await n.listModels(a);return l(s,u,t,e)},async retrieveEngine(a,s){const r=await n.retrieveEngine(a,s);return l(r,u,t,e)},async retrieveFile(a,s){const r=await n.retrieveFile(a,s);return l(r,u,t,e)},async retrieveFineTune(a,s){const r=await n.retrieveFineTune(a,s);return l(r,u,t,e)},async retrieveModel(a,s){const r=await n.retrieveModel(a,s);return l(r,u,t,e)}}};class f extends FormData{_boundary;constructor(...e){super(...e),this._boundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);return e}()}getHeaders(){return{"content-type":"multipart/form-data; boundary="+this._boundary}}}e.ChatCompletionRequestMessageRoleEnum={System:"system",User:"user",Assistant:"assistant",Function:"function"},e.ChatCompletionResponseMessageRoleEnum={System:"system",User:"user",Assistant:"assistant",Function:"function"},e.Configuration=class{apiKey;organization;username;password;accessToken;basePath;baseOptions;defaultQueryParams;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.organization=e.organization,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.defaultQueryParams=e.defaultQueryParams,this.formDataCtor=e.formDataCtor,this.baseOptions||(this.baseOptions={}),this.baseOptions.headers={Authorization:`Bearer ${this.apiKey}`,...this.baseOptions.headers},this.organization&&(this.baseOptions.headers["OpenAI-Organization"]=this.organization),this.formDataCtor||(this.formDataCtor=f)}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}},e.CreateImageRequestResponseFormatEnum={Url:"url",B64Json:"b64_json"},e.CreateImageRequestSizeEnum={_256x256:"256x256",_512x512:"512x512",_1024x1024:"1024x1024"},e.OpenAIApi=class extends a{cancelFineTune(e,t){return m(this.configuration).cancelFineTune(e,t).then((e=>e(this.fetch,this.basePath)))}createAnswer(e,t){return m(this.configuration).createAnswer(e,t).then((e=>e(this.fetch,this.basePath)))}createChatCompletion(e,t){return m(this.configuration).createChatCompletion(e,t).then((e=>e(this.fetch,this.basePath)))}createClassification(e,t){return m(this.configuration).createClassification(e,t).then((e=>e(this.fetch,this.basePath)))}createCompletion(e,t){return m(this.configuration).createCompletion(e,t).then((e=>e(this.fetch,this.basePath)))}createEdit(e,t){return m(this.configuration).createEdit(e,t).then((e=>e(this.fetch,this.basePath)))}createEmbedding(e,t){return m(this.configuration).createEmbedding(e,t).then((e=>e(this.fetch,this.basePath)))}createFile(e,t,n){return m(this.configuration).createFile(e,t,n).then((e=>e(this.fetch,this.basePath)))}createFineTune(e,t){return m(this.configuration).createFineTune(e,t).then((e=>e(this.fetch,this.basePath)))}createImage(e,t){return m(this.configuration).createImage(e,t).then((e=>e(this.fetch,this.basePath)))}createImageEdit(e,t,n,a,s,r,i,o){return m(this.configuration).createImageEdit(e,t,n,a,s,r,i,o).then((e=>e(this.fetch,this.basePath)))}createImageVariation(e,t,n,a,s,r){return m(this.configuration).createImageVariation(e,t,n,a,s,r).then((e=>e(this.fetch,this.basePath)))}createModeration(e,t){return m(this.configuration).createModeration(e,t).then((e=>e(this.fetch,this.basePath)))}createSearch(e,t,n){return m(this.configuration).createSearch(e,t,n).then((e=>e(this.fetch,this.basePath)))}createTranscription(e,t,n,a,s,r,i){return m(this.configuration).createTranscription(e,t,n,a,s,r,i).then((e=>e(this.fetch,this.basePath)))}createTranslation(e,t,n,a,s,r){return m(this.configuration).createTranslation(e,t,n,a,s,r).then((e=>e(this.fetch,this.basePath)))}deleteFile(e,t){return m(this.configuration).deleteFile(e,t).then((e=>e(this.fetch,this.basePath)))}deleteModel(e,t){return m(this.configuration).deleteModel(e,t).then((e=>e(this.fetch,this.basePath)))}downloadFile(e,t){return m(this.configuration).downloadFile(e,t).then((e=>e(this.fetch,this.basePath)))}listEngines(e){return m(this.configuration).listEngines(e).then((e=>e(this.fetch,this.basePath)))}listFiles(e){return m(this.configuration).listFiles(e).then((e=>e(this.fetch,this.basePath)))}listFineTuneEvents(e,t,n){return m(this.configuration).listFineTuneEvents(e,t,n).then((e=>e(this.fetch,this.basePath)))}listFineTunes(e){return m(this.configuration).listFineTunes(e).then((e=>e(this.fetch,this.basePath)))}listModels(e){return m(this.configuration).listModels(e).then((e=>e(this.fetch,this.basePath)))}retrieveEngine(e,t){return m(this.configuration).retrieveEngine(e,t).then((e=>e(this.fetch,this.basePath)))}retrieveFile(e,t){return m(this.configuration).retrieveFile(e,t).then((e=>e(this.fetch,this.basePath)))}retrieveFineTune(e,t){return m(this.configuration).retrieveFineTune(e,t).then((e=>e(this.fetch,this.basePath)))}retrieveModel(e,t){return m(this.configuration).retrieveModel(e,t).then((e=>e(this.fetch,this.basePath)))}},e.OpenAIApiFactory=function(e,t,n){const a=m(e);return{cancelFineTune:(e,s)=>a.cancelFineTune(e,s).then((e=>e(n,t))),createAnswer:(e,s)=>a.createAnswer(e,s).then((e=>e(n,t))),createChatCompletion:(e,s)=>a.createChatCompletion(e,s).then((e=>e(n,t))),createClassification:(e,s)=>a.createClassification(e,s).then((e=>e(n,t))),createCompletion:(e,s)=>a.createCompletion(e,s).then((e=>e(n,t))),createEdit:(e,s)=>a.createEdit(e,s).then((e=>e(n,t))),createEmbedding:(e,s)=>a.createEmbedding(e,s).then((e=>e(n,t))),createFile:(e,s,r)=>a.createFile(e,s,r).then((e=>e(n,t))),createFineTune:(e,s)=>a.createFineTune(e,s).then((e=>e(n,t))),createImage:(e,s)=>a.createImage(e,s).then((e=>e(n,t))),createImageEdit:(e,s,r,i,o,c,h,d)=>a.createImageEdit(e,s,r,i,o,c,h,d).then((e=>e(n,t))),createImageVariation:(e,s,r,i,o,c)=>a.createImageVariation(e,s,r,i,o,c).then((e=>e(n,t))),createModeration:(e,s)=>a.createModeration(e,s).then((e=>e(n,t))),createSearch:(e,s,r)=>a.createSearch(e,s,r).then((e=>e(n,t))),createTranscription:(e,s,r,i,o,c,h)=>a.createTranscription(e,s,r,i,o,c,h).then((e=>e(n,t))),createTranslation:(e,s,r,i,o,c)=>a.createTranslation(e,s,r,i,o,c).then((e=>e(n,t))),deleteFile:(e,s)=>a.deleteFile(e,s).then((e=>e(n,t))),deleteModel:(e,s)=>a.deleteModel(e,s).then((e=>e(n,t))),downloadFile:(e,s)=>a.downloadFile(e,s).then((e=>e(n,t))),listEngines:e=>a.listEngines(e).then((e=>e(n,t))),listFiles:e=>a.listFiles(e).then((e=>e(n,t))),listFineTuneEvents:(e,s,r)=>a.listFineTuneEvents(e,s,r).then((e=>e(n,t))),listFineTunes:e=>a.listFineTunes(e).then((e=>e(n,t))),listModels:e=>a.listModels(e).then((e=>e(n,t))),retrieveEngine:(e,s)=>a.retrieveEngine(e,s).then((e=>e(n,t))),retrieveFile:(e,s)=>a.retrieveFile(e,s).then((e=>e(n,t))),retrieveFineTune:(e,s)=>a.retrieveFineTune(e,s).then((e=>e(n,t))),retrieveModel:(e,s)=>a.retrieveModel(e,s).then((e=>e(n,t)))}},e.OpenAIApiFp=m,e.OpenAIApiParamCreator=p})); |
{ | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"name": "openai-edge", | ||
@@ -4,0 +4,0 @@ "umd:name": "openai-edge", |
@@ -11,6 +11,8 @@ # OpenAI Edge | ||
The latest version of this module has feature parity with the official `v3.3.0`, | ||
and also supports the chat completion `functions` parameter, which isn't yet | ||
included in the official module. | ||
The latest version of this module has feature parity with the official `v3.3.0`. | ||
> **Update July 2023:** The official `openai` library will use `fetch` in v4, | ||
> hopefully making `openai-edge` redundant. You can try it in beta now, more | ||
> info here: https://github.com/openai/openai-node/discussions/182 | ||
## Installation | ||
@@ -69,2 +71,7 @@ | ||
## Without global FormData | ||
This module also expects to be in an environment where `FormData` is defined. If | ||
you're running in Node.js, that means using v18 or later. | ||
## Available methods | ||
@@ -101,6 +108,2 @@ | ||
## Without global FormData | ||
This module also expects to be in an environment where `FormData` is defined. If you're running in Node.js, that means using v18 or later. | ||
## Edge route handler examples | ||
@@ -107,0 +110,0 @@ |
@@ -20,2 +20,3 @@ /** | ||
baseOptions?: any; | ||
defaultQueryParams?: URLSearchParams; | ||
formDataCtor?: new () => any; | ||
@@ -79,2 +80,3 @@ } | ||
*/ | ||
defaultQueryParams?: URLSearchParams; | ||
formDataCtor?: new () => any; | ||
@@ -81,0 +83,0 @@ constructor(param?: ConfigurationParameters); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
441757
8574
276