Griptape RAG Query: Translate Module
Ask in English, retrieve in German — translate your RAG queries before search
- prompt_driver
- MODULE
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, defaultenglish. 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 → Griptape → ComfyUI-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.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| languageopt | STRING | english | Language to translate the query to. |
| prompt_driveropt | PROMPT_DRIVER | Prompt driver to use for the module. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODULE | MODULE_LIST | — |