OpenAIApi - object-oriented interface

Export

Hierarchy

  • BaseAPI
    • OpenAIApi

Constructors

  • Parameters

    • Optional configuration: Configuration
    • Optional basePath: string
    • Optional axios: AxiosInstance

    Returns OpenAIApi

Properties

axios: AxiosInstance
basePath: string
configuration: undefined | Configuration

Methods

  • Parameters

    • fineTuneId: string

      The ID of the fine-tune job to cancel

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<FineTune, any>>

    Summary

    Immediately cancel a fine-tune job.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • createAnswerRequest: CreateAnswerRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateAnswerResponse, any>>

    Summary

    Answers the specified question using the provided documents and examples. The endpoint first searches over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for completion.

    Deprecated

    Throws

    Memberof

    OpenAIApi

  • Parameters

    Returns Promise<AxiosResponse<CreateChatCompletionResponse, any>>

    Summary

    Creates a model response for the given chat conversation.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    Returns Promise<AxiosResponse<CreateClassificationResponse, any>>

    Summary

    Classifies the specified query using provided examples. The endpoint first searches over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the completions endpoint. Labeled examples can be provided via an uploaded file, or explicitly listed in the request using the examples parameter for quick tests and small scale use cases.

    Deprecated

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • createCompletionRequest: CreateCompletionRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateCompletionResponse, any>>

    Summary

    Creates a completion for the provided prompt and parameters.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • createEditRequest: CreateEditRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateEditResponse, any>>

    Summary

    Creates a new edit for the provided input, instruction, and parameters.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • createEmbeddingRequest: CreateEmbeddingRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateEmbeddingResponse, any>>

    Summary

    Creates an embedding vector representing the input text.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • file: File

      Name of the JSON Lines file to be uploaded. If the `purpose` is set to \&quot;fine-tune\&quot;, each line is a JSON record with \&quot;prompt\&quot; and \&quot;completion\&quot; fields representing your training examples.

    • purpose: string

      The intended purpose of the uploaded documents. Use \&quot;fine-tune\&quot; for Fine-tuning. This allows us to validate the format of the uploaded file.

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<OpenAIFile, any>>

    Summary

    Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • createFineTuneRequest: CreateFineTuneRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<FineTune, any>>

    Summary

    Creates a job that fine-tunes a specified 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

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • createImageRequest: CreateImageRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ImagesResponse, any>>

    Summary

    Creates an image given a prompt.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • image: File

      The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.

    • prompt: string

      A text description of the desired image(s). The maximum length is 1000 characters.

    • Optional mask: File

      An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.

    • Optional n: number

      The number of images to generate. Must be between 1 and 10.

    • Optional size: string

      The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.

    • Optional responseFormat: string

      The format in which the generated images are returned. Must be one of `url` or `b64_json`.

    • Optional user: string

      A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ImagesResponse, any>>

    Summary

    Creates an edited or extended image given an original image and a prompt.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • image: File

      The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.

    • Optional n: number

      The number of images to generate. Must be between 1 and 10.

    • Optional size: string

      The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.

    • Optional responseFormat: string

      The format in which the generated images are returned. Must be one of `url` or `b64_json`.

    • Optional user: string

      A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ImagesResponse, any>>

    Summary

    Creates a variation of a given image.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • createModerationRequest: CreateModerationRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateModerationResponse, any>>

    Summary

    Classifies if text violates OpenAI's Content Policy

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • engineId: string

      The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`.

    • createSearchRequest: CreateSearchRequest
    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateSearchResponse, any>>

    Summary

    The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When file is set, the search endpoint searches over all the documents in the given file and returns up to the max_rerank number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.

    Deprecated

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • file: File

      The audio file object (not file name) to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.

    • model: string

      ID of the model to use. Only `whisper-1` is currently available.

    • Optional prompt: string

      An optional text to guide the model\&#39;s style or continue a previous audio segment. The prompt should match the audio language.

    • Optional responseFormat: string

      The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.

    • Optional temperature: number

      The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.

    • Optional language: string

      The language of the input audio. Supplying the input language in ISO-639-1 format will improve accuracy and latency.

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateTranscriptionResponse, any>>

    Summary

    Transcribes audio into the input language.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • file: File

      The audio file object (not file name) translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.

    • model: string

      ID of the model to use. Only `whisper-1` is currently available.

    • Optional prompt: string

      An optional text to guide the model\&#39;s style or continue a previous audio segment. The prompt should be in English.

    • Optional responseFormat: string

      The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.

    • Optional temperature: number

      The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<CreateTranslationResponse, any>>

    Summary

    Translates audio into into English.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • fileId: string

      The ID of the file to use for this request

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<DeleteFileResponse, any>>

    Summary

    Delete a file.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • model: string

      The model to delete

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<DeleteModelResponse, any>>

    Summary

    Delete a fine-tuned model. You must have the Owner role in your organization.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • fileId: string

      The ID of the file to use for this request

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<string, any>>

    Summary

    Returns the contents of the specified file

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ListEnginesResponse, any>>

    Summary

    Lists the currently available (non-finetuned) models, and provides basic information about each one such as the owner and availability.

    Deprecated

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ListFilesResponse, any>>

    Summary

    Returns a list of files that belong to the user's organization.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • fineTuneId: string

      The ID of the fine-tune job to get events for.

    • Optional stream: boolean

      Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only server-sent events as they become available. The stream will terminate with a `data: [DONE]` message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ListFineTuneEventsResponse, any>>

    Summary

    Get fine-grained status updates for a fine-tune job.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ListFineTunesResponse, any>>

    Summary

    List your organization's fine-tuning jobs

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<ListModelsResponse, any>>

    Summary

    Lists the currently available models, and provides basic information about each one such as the owner and availability.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • engineId: string

      The ID of the engine to use for this request

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<Engine, any>>

    Summary

    Retrieves a model instance, providing basic information about it such as the owner and availability.

    Deprecated

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • fileId: string

      The ID of the file to use for this request

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<OpenAIFile, any>>

    Summary

    Returns information about a specific file.

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • fineTuneId: string

      The ID of the fine-tune job

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<FineTune, any>>

    Summary

    Gets info about the fine-tune job. Learn more about Fine-tuning

    Throws

    Memberof

    OpenAIApi

  • Parameters

    • model: string

      The ID of the model to use for this request

    • Optional options: AxiosRequestConfig<any>

      Override http request option.

    Returns Promise<AxiosResponse<Model, any>>

    Summary

    Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

    Throws

    Memberof

    OpenAIApi

Generated using TypeDoc