openapi_openai

1.1.0 • Public • Published

openapi_openai

OpenapiOpenai - JavaScript client for openapi_openai The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.0
  • Package version: 1.1.0
  • Generator version: 7.4.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://github.com/oapicf/openapi-openai

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install openapi_openai --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your openapi_openai from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/oapicf/openapi-openai then install it via:

    npm install oapicf/openapi-openai --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var OpenapiOpenai = require('openapi_openai');

var defaultClient = OpenapiOpenai.ApiClient.instance;
// Configure Bearer access token for authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.accessToken = "YOUR ACCESS TOKEN"

var api = new OpenapiOpenai.AssistantsApi()
var threadId = "threadId_example"; // {String} The ID of the thread to which this run belongs.
var runId = "runId_example"; // {String} The ID of the run to cancel.
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.cancelRun(threadId, runId, callback);

Documentation for API Endpoints

All URIs are relative to https://api.openai.com/v1

Class Method HTTP request Description
OpenapiOpenai.AssistantsApi cancelRun POST /threads/{thread_id}/runs/{run_id}/cancel Cancels a run that is `in_progress`.
OpenapiOpenai.AssistantsApi createAssistant POST /assistants Create an assistant with a model and instructions.
OpenapiOpenai.AssistantsApi createAssistantFile POST /assistants/{assistant_id}/files Create an assistant file by attaching a File to an assistant.
OpenapiOpenai.AssistantsApi createMessage POST /threads/{thread_id}/messages Create a message.
OpenapiOpenai.AssistantsApi createRun POST /threads/{thread_id}/runs Create a run.
OpenapiOpenai.AssistantsApi createThread POST /threads Create a thread.
OpenapiOpenai.AssistantsApi createThreadAndRun POST /threads/runs Create a thread and run it in one request.
OpenapiOpenai.AssistantsApi deleteAssistant DELETE /assistants/{assistant_id} Delete an assistant.
OpenapiOpenai.AssistantsApi deleteAssistantFile DELETE /assistants/{assistant_id}/files/{file_id} Delete an assistant file.
OpenapiOpenai.AssistantsApi deleteThread DELETE /threads/{thread_id} Delete a thread.
OpenapiOpenai.AssistantsApi getAssistant GET /assistants/{assistant_id} Retrieves an assistant.
OpenapiOpenai.AssistantsApi getAssistantFile GET /assistants/{assistant_id}/files/{file_id} Retrieves an AssistantFile.
OpenapiOpenai.AssistantsApi getMessage GET /threads/{thread_id}/messages/{message_id} Retrieve a message.
OpenapiOpenai.AssistantsApi getMessageFile GET /threads/{thread_id}/messages/{message_id}/files/{file_id} Retrieves a message file.
OpenapiOpenai.AssistantsApi getRun GET /threads/{thread_id}/runs/{run_id} Retrieves a run.
OpenapiOpenai.AssistantsApi getRunStep GET /threads/{thread_id}/runs/{run_id}/steps/{step_id} Retrieves a run step.
OpenapiOpenai.AssistantsApi getThread GET /threads/{thread_id} Retrieves a thread.
OpenapiOpenai.AssistantsApi listAssistantFiles GET /assistants/{assistant_id}/files Returns a list of assistant files.
OpenapiOpenai.AssistantsApi listAssistants GET /assistants Returns a list of assistants.
OpenapiOpenai.AssistantsApi listMessageFiles GET /threads/{thread_id}/messages/{message_id}/files Returns a list of message files.
OpenapiOpenai.AssistantsApi listMessages GET /threads/{thread_id}/messages Returns a list of messages for a given thread.
OpenapiOpenai.AssistantsApi listRunSteps GET /threads/{thread_id}/runs/{run_id}/steps Returns a list of run steps belonging to a run.
OpenapiOpenai.AssistantsApi listRuns GET /threads/{thread_id}/runs Returns a list of runs belonging to a thread.
OpenapiOpenai.AssistantsApi modifyAssistant POST /assistants/{assistant_id} Modifies an assistant.
OpenapiOpenai.AssistantsApi modifyMessage POST /threads/{thread_id}/messages/{message_id} Modifies a message.
OpenapiOpenai.AssistantsApi modifyRun POST /threads/{thread_id}/runs/{run_id} Modifies a run.
OpenapiOpenai.AssistantsApi modifyThread POST /threads/{thread_id} Modifies a thread.
OpenapiOpenai.AssistantsApi submitToolOuputsToRun POST /threads/{thread_id}/runs/{run_id}/submit_tool_outputs When a run has the `status: &quot;requires_action&quot;` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
OpenapiOpenai.AudioApi createSpeech POST /audio/speech Generates audio from the input text.
OpenapiOpenai.AudioApi createTranscription POST /audio/transcriptions Transcribes audio into the input language.
OpenapiOpenai.AudioApi createTranslation POST /audio/translations Translates audio into English.
OpenapiOpenai.ChatApi createChatCompletion POST /chat/completions Creates a model response for the given chat conversation.
OpenapiOpenai.CompletionsApi createCompletion POST /completions Creates a completion for the provided prompt and parameters.
OpenapiOpenai.EmbeddingsApi createEmbedding POST /embeddings Creates an embedding vector representing the input text.
OpenapiOpenai.FilesApi createFile POST /files Upload a file that can be used across various endpoints. The size of all the files uploaded by one organization can be up to 100 GB. The size of individual files can be a maximum of 512 MB or 2 million tokens for Assistants. See the Assistants Tools guide to learn more about the types of files supported. The Fine-tuning API only supports `.jsonl` files. Please contact us if you need to increase these storage limits.
OpenapiOpenai.FilesApi deleteFile DELETE /files/{file_id} Delete a file.
OpenapiOpenai.FilesApi downloadFile GET /files/{file_id}/content Returns the contents of the specified file.
OpenapiOpenai.FilesApi listFiles GET /files Returns a list of files that belong to the user's organization.
OpenapiOpenai.FilesApi retrieveFile GET /files/{file_id} Returns information about a specific file.
OpenapiOpenai.FineTuningApi cancelFineTuningJob POST /fine_tuning/jobs/{fine_tuning_job_id}/cancel Immediately cancel a fine-tune job.
OpenapiOpenai.FineTuningApi createFineTuningJob POST /fine_tuning/jobs Creates a fine-tuning job which begins the process of creating a new model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. Learn more about fine-tuning
OpenapiOpenai.FineTuningApi listFineTuningEvents GET /fine_tuning/jobs/{fine_tuning_job_id}/events Get status updates for a fine-tuning job.
OpenapiOpenai.FineTuningApi listFineTuningJobCheckpoints GET /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints List checkpoints for a fine-tuning job.
OpenapiOpenai.FineTuningApi listPaginatedFineTuningJobs GET /fine_tuning/jobs List your organization's fine-tuning jobs
OpenapiOpenai.FineTuningApi retrieveFineTuningJob GET /fine_tuning/jobs/{fine_tuning_job_id} Get info about a fine-tuning job. Learn more about fine-tuning
OpenapiOpenai.ImagesApi createImage POST /images/generations Creates an image given a prompt.
OpenapiOpenai.ImagesApi createImageEdit POST /images/edits Creates an edited or extended image given an original image and a prompt.
OpenapiOpenai.ImagesApi createImageVariation POST /images/variations Creates a variation of a given image.
OpenapiOpenai.ModelsApi deleteModel DELETE /models/{model} Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
OpenapiOpenai.ModelsApi listModels GET /models Lists the currently available models, and provides basic information about each one such as the owner and availability.
OpenapiOpenai.ModelsApi retrieveModel GET /models/{model} Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
OpenapiOpenai.ModerationsApi createModeration POST /moderations Classifies if text is potentially harmful.

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: Bearer authentication

Readme

Keywords

none

Package Sidebar

Install

npm i openapi_openai

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

2.36 MB

Total Files

254

Last publish

Collaborators

  • oapicf