
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
Super simple and easy-to-use text splitter for Node.js
Perfect for quickly building LLM prototypes or small-scale applications in Node.js.
With a compressed (ZIP) file size of just 1KB.
npm install llm-chunk
Easily integrate it into your project with just a few lines of code:
import { chunk } from 'llm-chunk'
const text = `
Hello World.
This is
a test sentence! Have a good day? Haha. Haha
`;
// Default options
const chunks = chunk(text, {
minLength: 0, // number of minimum characters into chunk
maxLength: 1000, // number of maximum characters into chunk
splitter: "paragraph", // paragraph | sentence
overlap: 0, // number of overlap chracters
delimiters: "" // regex for base split method
});
// The result shows 'paragraph' splitter as default
chunk(text)
// Results
[
'Hello World.\nThis is\n a test sentence! Have a good day? Haha. Haha'
]
chunk(text, { minLength: 7, maxLength: 9 })
// Results
[
'Hello World.\nThis',
' is\n a test',
' sentence! Have a good day? Haha. Haha'
]
Use 'sentence' splitter:
chunk(text, { splitter: "sentence" })
// Results
[
'Hello World.',
'This is\n',
'a test sentence!',
'Have a good day?',
'Haha.',
'Haha'
]
chunk(text, { minLength: 10, splitter: "sentence" })
// Results
[
'Hello World.',
'This is\n a test sentence!',
'Have a good day?',
'Haha. Haha'
]
chunks = chunk(text, { overlap: 3, splitter: "sentence" });
// Results
[
'Hello World.',
' World. This is\n',
' is\n a test sentence!',
' sentence! Have a good day?',
' day? Haha.',
' Haha. Haha',
' Haha'
]
For more examples and chunk results, please check the "samples" folder.
It's super fast. But there's still room for performance improvement.
Patches and PRs are welcome.
----------
Chunk 163948 characters into 436 chunks
----------
Total: 12.169ms (100 times)
Average: 0.122ms
MIT
FAQs
A super simple text splitter for LLM
The npm package llm-chunk receives a total of 3,273 weekly downloads. As such, llm-chunk popularity was classified as popular.
We found that llm-chunk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.