Nodes/ComfyUI-Artha-Nodes/πŸ”± Artha Gemini Operation
ComfyUI Node

πŸ”± Artha Gemini Operation

Edit text by telling it what to change, not how

By CyrostarΒ·Created 10 months agoΒ·Updated 8 months agoΒ· 0
πŸ”± Artha Gemini Operation
    • response
    β—„sourceA cat with a hatβ–Ί
    β—„instructionChange cat to dogβ–Ί
    β—„api_keyβ–Ί
    β—„modelgemini-2.5-flashβ–Ί
    β—„max_tokens5000β–Ί
    β—„temperature0.7β–Ί

    Artha Gemini Operation is a text editor with no find-and-replace. Instead of fiddling with regex or a replace node, you hand it a chunk of text and an instruction like "change cat to dog," "remove all the camera terms," or "make this prompt shorter and more cinematic," and Gemini performs the edit. It's the node for all the text surgery that string-manipulation nodes can't express, because the operation is described in natural language rather than code.

    The description puts it plainly: "can be used to make changes on the source text like replacing, removing parts and other text operations." It's stateless - every run is a fresh edit on whatever source you feed it, with no memory of previous calls. If you're building prompt-rewriting or prompt-cleaning workflows, this is the tool.

    What you set

    • source - the text to edit. Defaults to "A cat with a hat."
    • instruction - what to change. Defaults to "Change cat to dog," which is a perfect first test: wire in source, set the instruction, and you've learned the whole node.
    • api_key, model (default gemini-2.5-flash), max_tokens, temperature - the pack's standard API plumbing.

    One output: response, the edited text as a plain string. Route it into your prompt encoder, a display node, or the next processing step.

    How it works

    The node sends your source and instruction to Gemini as a single request. The instruction is the steering wheel - Gemini's interpretation of it determines the whole edit, so it pays to be specific. "Replace cat with dog" is bulletproof. "Make it better" is a coin flip. The practical lesson: treat the instruction like a prompt, because that's exactly what it is. You can chain multiple operations by feeding one Operation's output into the next, which is the natural way to build a cleanup pipeline - strip the boilerplate here, then condense, then feed the result to your encoder.

    Where it shines

    Prompt hygiene, mostly. Your prompt-gathering process produces mess: a bloaty draft, a prompt with conflicting style words, a tag-soup that needs converting to sentences. Operation handles the edits that no deterministic node can. It's also handy for batch text transforms - same source, different instruction, variations for days.

    The honest downside: it's cloud-backed, so every edit is an API call and there's no offline mode. And because Gemini is doing the editing, subtle instructions ("make the tone warmer") can produce subtly different outputs on each run - set temperature lower if you want tighter, more literal edits. An empty response is the pack's standard failure signal: the error was printed to the ComfyUI console and the node swallowed it into an empty string.

    Key and install

    Key resolution: the node's api_key field first, then api.json in the pack folder, then the GEMINI_API_KEY environment variable. Keep it in api.json so it doesn't ride along in a shared workflow. The node itself ships with the whole πŸ”± pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Cyrostar/ComfyUI-Artha-Nodes
    cd ComfyUI-Artha-Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI, or install "Artha" via ComfyUI Manager. Grab a key from Google AI Studio and you're editing text by wish.

    CategoryArtha/LLM/Gemini

    Inputs (6)

    NameTypeDefaultDescription
    sourceSTRINGA cat with a hatβ€”
    instructionSTRINGChange cat to dogβ€”
    api_keySTRINGAPI key will be visible in plain text. Consider adding your api to the api.json located inside this custom node folder.
    modelCOMBOgemini-2.5-flash5 options: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash, gemini-2.0-flash-lite
    max_tokensINT50001–8192For Gemini models, a token is equivalent to about 4 characters. 100 tokens is equal to about 60–80 English words.
    temperatureFLOAT0.70–2A temperature of 0 means only the most likely tokens are selected. Higher values increase randomness.

    Outputs (1)

    NameTypeDescription
    responseSTRINGβ€”