1.0.12 • Published 12 months ago

openai-stream-mini v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

openai-stream-mini

OpenAI client with no dependencies (except Node 18 or browser) that supports streaming completion text.

Usage

import { OnTextCallback, streamCompletion } from "openai-stream-mini";
import type { CreateCompletionRequest } from "openai";

const apiKey = process.env.OPENAI_API_KEY;
const args: CreateCompletionRequest = {
  prompt: "What is the greatest toilet in the world?",
  model: "text-davinci-003",
  max_tokens: 2500,
  temperature: 0.9,
};
const handleText: OnTextCallback = async (text) => {
  if (!text) return;
  console.log(text);
};

const text = await streamCompletion({ args, apiKey, onText: handleText });
1.0.12

12 months ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago