Nodes/ComfyUI-OllamaGemini/Gemini Text Splitter
ComfyUI Node

Gemini Text Splitter

Chop one text blob into a batch of strings

By al-swaiti·Created 2 years ago·Updated 2 months ago· 185
Gemini Text Splitter
    • STRING
    text
    delimiter,
    start_index0
    skip_every0
    max_count10

    This is the plumbing node, and it does exactly one thing: take a single text blob, split it on a delimiter, and hand back a list of strings. No AI, no "Gemini" magic despite the name - it's a plain text utility that happens to live in an AI pack. But it's the kind of glue that makes the flashier nodes actually useful, so it's worth understanding.

    Why you'd reach for it

    The scenario that makes this click: you asked an LLM (or the pack's prompt generator) for "ten prompt variations," and it handed you back one string with all ten crammed in, separated by commas or newlines. ComfyUI can't iterate over that - it's one lump of text. Text Splitter turns it into a proper list, and once it's a list, the nodes downstream can fan it out into a batch, iterate one per generation, or pick out the pieces you want. It's the difference between "a paragraph" and "ten separate prompts you can actually run."

    Anywhere you've got delimited data - a comma-separated tag pile, a list of filenames, a set of captions - and you need the individual items as list entries, this is the node.

    How it works and what you set

    You give it text and tell it how to cut. The output is a STRING typed as a list, which is the important part - it wires into anything that consumes a list rather than a single value.

    The inputs:

    • text - the blob to split. Multiline, so paste or wire in whatever you've got.
    • delimiter - what to split on. Defaults to a comma. This is the one that trips people up (more below).
    • start_index - skip the first N items. Default 0 (start from the beginning).
    • skip_every - decimate the list, taking every Nth item and dropping the rest. Default 0 (keep them all). Handy for thinning a huge list down to a sample.
    • max_count - hard cap on how many items come out. Defaults to 10, which means by default it quietly stops after ten entries even if your text had fifty.

    So the full pipeline is: split on the delimiter, jump to start_index, optionally skip every Nth, then keep at most max_count. Simple, but the combination gives you decent slicing control without a dedicated logic node.

    The gotchas that actually bite

    The comma default. This is the single most common way to get one useless result instead of a proper list. The delimiter defaults to ,, but plenty of text - especially LLM output - comes back with items on separate lines, not comma-separated. If your split gives you back one giant string, your text almost certainly uses a delimiter you didn't set. Change delimiter to match what's actually between your items (a newline, a semicolon, a pipe - whatever it is).

    The silent max_count cap. Default 10. If you feed it a list of thirty prompts and only ten come out, nothing's broken - you hit the cap. Raise max_count (it goes to 1000) when you want everything.

    Empty output. Set start_index past the end of your list and you get nothing back, no error. If the node runs green but produces an empty list, check that your start index isn't higher than the number of items you actually have.

    Installing it

    ComfyUI Manager: search ComfyUI-OllamaGemini, install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/al-swaiti/ComfyUI-OllamaGemini
    pip install -r requirements.txt
    

    then restart. This node itself is pure Python string handling - no API key, no model download, no heavy dependency of its own. If it fails to appear, the cause is the broader pack failing to load during the pip step (OllamaGemini pulls a lot of dependencies for its API and media nodes), not anything about the splitter. Check the startup console for the traceback and fix the install there.

    CategoryAI API

    Inputs (5)

    NameTypeDefaultDescription
    textSTRING
    delimiterSTRING,
    start_indexINT00–1000
    skip_everyINT00–10
    max_countINT101–1000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING