npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@speakeasy-api/openai

v1.9.2

Published

![OpenAI_Logo_Black](https://user-images.githubusercontent.com/6267663/220744241-48f469af-40b6-4d7f-ab48-8426b30189f0.svg#gh-light-mode-only) ![OpenAI_Logo_White](https://user-images.githubusercontent.com/6267663/220744513-66c99d0e-ed91-4577-982f-e7128d35

Downloads

3

Readme

OpenAPI Node SDK

OpenAI_Logo_Black OpenAI_Logo_White

SDK Installation

NPM

npm add @speakeasy-api/openai

Yarn

yarn add @speakeasy-api/openai

Authentication

The OpenAI API uses API keys for authentication. Visit your API Keys page to retrieve the API key you'll use in your requests.

Remember that your API key is a secret! Do not share it with others or expose it in any client-side code (browsers, apps). Production requests must be routed through your own backend server where your API key can be securely loaded from an environment variable or key management service.

All API requests should include your API key in an Authorization HTTP header as follows:

Authorization: Bearer YOUR_API_KEY

SDK Example Usage

import {
  CancelFineTuneRequest,
  CancelFineTuneResponse
} from "@speakeasy-api/openai/dist/sdk/models/operations";

import { AxiosError } from "axios";
import { Gpt } from "@speakeasy-api/openai";
const sdk = new Gpt();

const req: CancelFineTuneRequest = {
  fineTuneId: "ft-AF1WoRqd3aJAHsqc9NY7iL8F",
};

sdk.openAI.cancelFineTune(req).then((res: CancelFineTuneResponse | AxiosError) => {
   // handle response
});

SDK Available Operations

openAI

  • cancelFineTune - Immediately cancel a fine-tune job.

  • createAnswer - 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.

  • createChatCompletion - Creates a completion for the chat message
  • createClassification - 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.

  • createCompletion - Creates a completion for the provided prompt and parameters

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

  • createEmbedding - Creates an embedding vector representing the input text.

  • createFile - 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.

  • createFineTune - 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

  • createImage - Creates an image given a prompt.
  • createImageEdit - Creates an edited or extended image given an original image and a prompt.
  • createImageVariation - Creates a variation of a given image.
  • createModeration - Classifies if text violates OpenAI's Content Policy
  • createSearch - 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.

  • createTranscription - Transcribes audio into the input language.

  • createTranslation - Translates audio into into English.

  • deleteFile - Delete a file.

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

  • downloadFile - Returns the contents of the specified file

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

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

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

  • listFineTunes - List your organization's fine-tuning jobs

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

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

  • retrieveFile - Returns information about a specific file.

  • retrieveFineTune - Gets info about the fine-tune job.

Learn more about Fine-tuning

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

SDK Generated by Speakeasy