Skip to main content

Tools for working with Ollama

Project description

Matt's Ollama Tools

I needed some simple tools to make it easier to work with integrating Ollama with the real world. This is a collection of those tools.

Chunker

Sometimes you need to take a bunch of text in and then spit it out in an array of chunks. This will take in a long text and then split it into chunks of up to a defined number of words. It won't ever get sentence fragments. It will overlap each chunk by one sentence. If you have a text with a bunch of poorly written run-on sentences, this might not work.

Usage

from mattsollamatools import chunker

textchunks = chunker(text, max_words_per_chunk=110, language='spanish')

If you don't include max_words_per_chunk, it will default to 100. If you don't include language, it will default to 'english'.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mattsollamatools-0.0.25.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

mattsollamatools-0.0.25-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page