You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

embeddings-splitter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

embeddings-splitter - npm Package Compare versions

Comparing version
0.0.4
to
0.0.5
+1
-1
lib/index.d.ts

@@ -1,2 +0,2 @@

export declare function split(prompt: string): string[];
export declare function split(prompt: string, maxTokens?: number): string[];
type Batches = {

@@ -3,0 +3,0 @@ data: string;

@@ -15,3 +15,3 @@ "use strict";

const tokenizer = (0, tiktoken_1.get_encoding)('cl100k_base');
function splitIntoMany(text, maxTokens = 500) {
function splitIntoMany(text, maxTokens) {
// Split the text into sentences

@@ -47,3 +47,3 @@ const sentences = text.split('. ');

}
function split(prompt) {
function split(prompt, maxTokens = 500) {
// should split into tokens

@@ -53,3 +53,3 @@ if (!prompt || prompt.length === 0) {

}
const chunks = splitIntoMany(prompt);
const chunks = splitIntoMany(prompt, maxTokens);
return chunks;

@@ -56,0 +56,0 @@ }

{
"name": "embeddings-splitter",
"version": "0.0.4",
"description": "A typescript library to split your long texts into smaller chunks to send them to OpenAI Embeddings",
"version": "0.0.5",
"description": "A typescript library to split your long texts into smaller chunks to send them to OpenAI Embeddings API",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "types": "lib/index.d.ts",

<p align="center">embeddings-splitter</p>
<p align="center">A typescript library to split texts into chunks so they can be embedded with OpenAI Embeddings</p>
<p align="center">A typescript library to split texts into chunks so they can be embedded with OpenAI Embeddings API</p>
<a href="https://github.com/hebertcisco/ts-npm-package-boilerplate/issues/new/choose">Request Feature</a>

@@ -13,4 +13,6 @@

### Split files
### Split long strings
`split` makes sure your string will are short enough to be embedded
```js

@@ -17,0 +19,0 @@ import { split } from 'embeddings-splitter';