Nodes/ComfyUI Griptape Nodes/Griptape RAG Query: Translate Module
ComfyUI Node

Griptape RAG Query: Translate Module

Ask in English, retrieve in German — translate your RAG queries before search

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape RAG Query: Translate Module
  • prompt_driver
  • MODULE
languageenglish

This is the niche-but-elegant module in Griptape's RAG lineup. Its job: take the user's question, translate it into another language, and hand the translated version to the retrieval stage. Why would you want that? Because your documents might be in a language your users don't write in. You search a German knowledge base but your users ask in English - translate the query to German before searching, and retrieval suddenly finds the right chunks.

It's a query-stage module, which means it plugs into the query_stage_modules input on the Griptape RAG Engine node. The RAG engine runs the query stage first, so this module's output shapes everything downstream.

The inputs that matter

  • language - a free-text string, default english. The target language for translation. Yes, that's the target - you're translating the query into this language, not out of it.
  • prompt_driver - which LLM does the translating. Wire in any of the pack's prompt drivers. If you leave this empty, the module silently falls back to an OpenAI GPT-4o driver - which means it works without setup, but requires an OpenAI key in your environment and quietly spends tokens on it. That's the kind of default that surprises people when the invoice or the error arrives.

How it works

Under the hood it constructs a Griptape TranslateQueryRagModule. On each query, it prompts the driver to translate the query into your chosen language, and the translated string becomes the retrieval query. The rest of the pipeline is untouched - this module only rewrites the question, never the answer.

What it outputs

A single MODULE_LIST output - note the type. It's a list even though you built one module, because query-stage inputs accept multiple modules, and the RAG engine expects lists there. Wire it straight into query_stage_modules on the RAG Engine.

Installing it

It ships in the pack: ComfyUI Manager → GriptapeComfyUI-Griptape, restart, or

cd ComfyUI/custom_nodes
git clone https://github.com/griptape-ai/ComfyUI-Griptape

Common issues

The two gotchas are the fallback driver and the direction of language. If your retrieval results are wrong, check you set the target language, not the source. And if you didn't wire a prompt_driver but expect zero LLM usage - no, it's calling OpenAI's API behind the scenes, and you'll either need that key or wonder why translation never runs. Set the driver explicitly to something local (Ollama) if you want the whole pipeline to stay off-cloud. Pack-wide torch/version issues apply as usual.

CategoryGriptape/RAG

Inputs (2)

NameTypeDefaultDescription
languageoptSTRINGenglishLanguage to translate the query to.
prompt_driveroptPROMPT_DRIVERPrompt driver to use for the module.

Outputs (1)

NameTypeDescription
MODULEMODULE_LIST