New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

openapi_openai

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi_openai

The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

ClassMethodHTTP requestDescription
OpenapiOpenai.AssistantsApicancelRunPOST /threads/{thread_id}/runs/{run_id}/cancelCancels a run that is `in_progress`.
OpenapiOpenai.AssistantsApicreateAssistantPOST /assistantsCreate an assistant with a model and instructions.
OpenapiOpenai.AssistantsApicreateAssistantFilePOST /assistants/{assistant_id}/filesCreate an assistant file by attaching a File to an assistant.
OpenapiOpenai.AssistantsApicreateMessagePOST /threads/{thread_id}/messagesCreate a message.
OpenapiOpenai.AssistantsApicreateRunPOST /threads/{thread_id}/runsCreate a run.
OpenapiOpenai.AssistantsApicreateThreadPOST /threadsCreate a thread.
OpenapiOpenai.AssistantsApicreateThreadAndRunPOST /threads/runsCreate a thread and run it in one request.
OpenapiOpenai.AssistantsApideleteAssistantDELETE /assistants/{assistant_id}Delete an assistant.
OpenapiOpenai.AssistantsApideleteAssistantFileDELETE /assistants/{assistant_id}/files/{file_id}Delete an assistant file.
OpenapiOpenai.AssistantsApideleteThreadDELETE /threads/{thread_id}Delete a thread.
OpenapiOpenai.AssistantsApigetAssistantGET /assistants/{assistant_id}Retrieves an assistant.
OpenapiOpenai.AssistantsApigetAssistantFileGET /assistants/{assistant_id}/files/{file_id}Retrieves an AssistantFile.
OpenapiOpenai.AssistantsApigetMessageGET /threads/{thread_id}/messages/{message_id}Retrieve a message.
OpenapiOpenai.AssistantsApigetMessageFileGET /threads/{thread_id}/messages/{message_id}/files/{file_id}Retrieves a message file.
OpenapiOpenai.AssistantsApigetRunGET /threads/{thread_id}/runs/{run_id}Retrieves a run.
OpenapiOpenai.AssistantsApigetRunStepGET /threads/{thread_id}/runs/{run_id}/steps/{step_id}Retrieves a run step.
OpenapiOpenai.AssistantsApigetThreadGET /threads/{thread_id}Retrieves a thread.
OpenapiOpenai.AssistantsApilistAssistantFilesGET /assistants/{assistant_id}/filesReturns a list of assistant files.
OpenapiOpenai.AssistantsApilistAssistantsGET /assistantsReturns a list of assistants.
OpenapiOpenai.AssistantsApilistMessageFilesGET /threads/{thread_id}/messages/{message_id}/filesReturns a list of message files.
OpenapiOpenai.AssistantsApilistMessagesGET /threads/{thread_id}/messagesReturns a list of messages for a given thread.
OpenapiOpenai.AssistantsApilistRunStepsGET /threads/{thread_id}/runs/{run_id}/stepsReturns a list of run steps belonging to a run.
OpenapiOpenai.AssistantsApilistRunsGET /threads/{thread_id}/runsReturns a list of runs belonging to a thread.
OpenapiOpenai.AssistantsApimodifyAssistantPOST /assistants/{assistant_id}Modifies an assistant.
OpenapiOpenai.AssistantsApimodifyMessagePOST /threads/{thread_id}/messages/{message_id}Modifies a message.
OpenapiOpenai.AssistantsApimodifyRunPOST /threads/{thread_id}/runs/{run_id}Modifies a run.
OpenapiOpenai.AssistantsApimodifyThreadPOST /threads/{thread_id}Modifies a thread.
OpenapiOpenai.AssistantsApisubmitToolOuputsToRunPOST /threads/{thread_id}/runs/{run_id}/submit_tool_outputsWhen 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.AudioApicreateSpeechPOST /audio/speechGenerates audio from the input text.
OpenapiOpenai.AudioApicreateTranscriptionPOST /audio/transcriptionsTranscribes audio into the input language.
OpenapiOpenai.AudioApicreateTranslationPOST /audio/translationsTranslates audio into English.
OpenapiOpenai.ChatApicreateChatCompletionPOST /chat/completionsCreates a model response for the given chat conversation.
OpenapiOpenai.CompletionsApicreateCompletionPOST /completionsCreates a completion for the provided prompt and parameters.
OpenapiOpenai.EmbeddingsApicreateEmbeddingPOST /embeddingsCreates an embedding vector representing the input text.
OpenapiOpenai.FilesApicreateFilePOST /filesUpload 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.FilesApideleteFileDELETE /files/{file_id}Delete a file.
OpenapiOpenai.FilesApidownloadFileGET /files/{file_id}/contentReturns the contents of the specified file.
OpenapiOpenai.FilesApilistFilesGET /filesReturns a list of files that belong to the user's organization.
OpenapiOpenai.FilesApiretrieveFileGET /files/{file_id}Returns information about a specific file.
OpenapiOpenai.FineTuningApicancelFineTuningJobPOST /fine_tuning/jobs/{fine_tuning_job_id}/cancelImmediately cancel a fine-tune job.
OpenapiOpenai.FineTuningApicreateFineTuningJobPOST /fine_tuning/jobsCreates 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.FineTuningApilistFineTuningEventsGET /fine_tuning/jobs/{fine_tuning_job_id}/eventsGet status updates for a fine-tuning job.
OpenapiOpenai.FineTuningApilistFineTuningJobCheckpointsGET /fine_tuning/jobs/{fine_tuning_job_id}/checkpointsList checkpoints for a fine-tuning job.
OpenapiOpenai.FineTuningApilistPaginatedFineTuningJobsGET /fine_tuning/jobsList your organization's fine-tuning jobs
OpenapiOpenai.FineTuningApiretrieveFineTuningJobGET /fine_tuning/jobs/{fine_tuning_job_id}Get info about a fine-tuning job. Learn more about fine-tuning
OpenapiOpenai.ImagesApicreateImagePOST /images/generationsCreates an image given a prompt.
OpenapiOpenai.ImagesApicreateImageEditPOST /images/editsCreates an edited or extended image given an original image and a prompt.
OpenapiOpenai.ImagesApicreateImageVariationPOST /images/variationsCreates a variation of a given image.
OpenapiOpenai.ModelsApideleteModelDELETE /models/{model}Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
OpenapiOpenai.ModelsApilistModelsGET /modelsLists the currently available models, and provides basic information about each one such as the owner and availability.
OpenapiOpenai.ModelsApiretrieveModelGET /models/{model}Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
OpenapiOpenai.ModerationsApicreateModerationPOST /moderationsClassifies if text is potentially harmful.

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: Bearer authentication

FAQs

Package last updated on 15 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc