1.2.1 • Published 22 days ago

openai-text-splitter v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
22 days ago

OpenAI Text Splitter

Openai prompt splitter. Dividing large texts into manageable parts for processing with OpenAI APIs. A library inspired by chatgpt-prompt-splitter to divide large texts into smaller parts for efficient processing with OpenAI APIs.

Installation

  npm install openai-text-splitter

Usage

Arguments

ArgumentDefaultDescription
textrequiredThe input text to be split into parts.
textChunkLength20The maximum length of each character chunk to process.
tokenLimitPerPrompt400The token limit per prompt for OpenAI API.

Node: Configure textChunkLength and tokenLimitPerPrompt according to content you are processing.

import {splitTextForOpenAI} from 'openai-text-splitter';

const text = 'Your large text here...';
const textChunkLength = 500;
const tokenLimitPerPrompt = 2048;

const messages = splitTextForOpenAI(text, {
  textChunkLength,
  tokenLimitPerPrompt,
});
1.2.1

22 days ago

1.2.0

22 days ago

1.1.3

22 days ago

1.1.2

22 days ago

1.1.1

22 days ago

1.1.0

22 days ago

1.0.4

22 days ago

1.0.3

22 days ago

1.0.2

22 days ago

1.0.1

22 days ago

1.0.0

22 days ago