Nodes/ComfyUI-ZMongo/05 Gemini Prompt from ZMongo Doc
ComfyUI Node

05 Gemini Prompt from ZMongo Doc

Pulling a stored document into a Gemini call

By CentralFloridaAttorney·Created 5 months ago·Updated 2 months ago· 1
05 Gemini Prompt from ZMongo Doc
  • session
  • json
  • source_text
  • gemini_text
  • success
collection_name
document_id
field_pathtext
prompt_prefixAnalyze the following content:
prompt_suffix
modelgemini-2.5-flash
max_output_tokens2048
temperature0.40
system_instruction
cachefalse
gemini_prefix/gemini
refresh_token

05 Gemini Prompt from ZMongo Doc is the node where this pack's two halves - the document store and the Gemini layer - actually fuse. It loads a document from a ZMongo collection, extracts one field from it, wraps that text with your prefix and suffix, and sends the assembled prompt to Gemini.

If you're building the "document ingestion pipeline" the README advertises, this is the workhorse. Store source material as ZMongo documents (from a file ingest or just manual Create Doc), then have Gemini analyze each one by pointing this node at it. It's also the pattern behind "stored prompt templates": keep the content in a database, let this node assemble the actual prompt.

How it works

Required inputs:

  • session - from the API Key Session node.
  • collection_name / document_id - which document to read.
  • field_path - which dot-path field to pull, default text. Deep paths like prompt.positive work via dot-notation.
  • prompt_prefix - default "Analyze the following content:\n\n" - prepended to the document text.
  • prompt_suffix - appended after it.
  • model, max_output_tokens, temperature - the usual Gemini knobs.

Optional: system_instruction, cache (cache the document fetch, default off), gemini_prefix, refresh_token.

Outputs:

  • json - merged payload including both the document fetch and the Gemini response.
  • source_text - the exact field value that got pulled from the document. Hugely useful for debugging "did it read the right thing?"
  • gemini_text - the model's response. The output you wire onward.
  • success - boolean.

Notes

  • Field-path errors fail visibly. If the path doesn't exist, source_text comes back empty and the node reports failure - a good reason to keep source_text visible on a preview while developing.
  • cache matters for big docs. If you're iterating on prompts over the same large document, flipping cache on avoids re-fetching it every run. Leave it off when the document may have changed.
  • Watch token budgets. Document text can be huge; pair this with Gemini Count Tokens (count the assembled prompt) or you'll hit context limits on long docs.
  • The prefix/suffix split is the design's elegance: content stays in the database, instructions live in the graph. Change "Analyze" to "Summarize" by editing one field, never touching your stored data.

Install

ComfyUI Manager → ComfyUI-ZMongo, or:

cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo

restart. Needs the API session for both the document fetch and the server-side Gemini call - the pack's heavier local deps (langchain, etc.) aren't needed by this node.

CategoryZMongo/06 Gemini

Inputs (13)

NameTypeDefaultDescription
sessionZMONGO_API_SESSION
collection_nameSTRING
document_idSTRING
field_pathSTRINGtext
prompt_prefixSTRINGAnalyze the following content:
prompt_suffixSTRING
modelSTRINGgemini-2.5-flash
max_output_tokensINT20481–65536
temperatureFLOAT0.400–2
system_instructionoptSTRING
cacheoptBOOLEANfalse
gemini_prefixoptSTRING/gemini
refresh_tokenoptSTRING

Outputs (4)

NameTypeDescription
jsonSTRING
source_textSTRING
gemini_textSTRING
successBOOLEAN