openai-single-response
v1.0.5
Published
A TypeScript utility for single-use interactions with OpenAI's chat API, featuring schema-based response parsing.
Downloads
3
Maintainers
Readme
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.