openai-single-response
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Openai Single Response

openai-single-response is a JavaScript library for interacting with OpenAI's GPT models. It provides an easy-to-use API for generating chat completions, managing chat streams, and handling responses with or without schema validation.

Features

  • Easy integration with OpenAI's Chat models.
  • Support for both streaming and non-streaming chat completions.
  • Optional schema validation for responses.
  • Convenient utilities for message composition.

Installation

npm install openai-single-response

Usage

Basic Usage

Here's a quick example to get you started:

import { getSingleChatCompletion } from openai-single-response;

async function chat() {
const response = await getSingleChatCompletion({
apiKey: 'your-api-key',
systemPrompt: "Your system prompt",
userPrompt: "Your user prompt",
});

console.log(response);
}

chat();

Licensing

The code in this project is licensed under MIT.

Package Sidebar

Install

npm i openai-single-response

Weekly Downloads

3

Version

1.0.5

License

MIT

Unpacked Size

13.6 kB

Total Files

17

Last publish

Collaborators

  • keisukenagakawa