Nodes/ComfyUI Pinecone Prompt Upserter/Pinecone Prompt Upserter
ComfyUI Node

Pinecone Prompt Upserter

Your best prompts, saved to a real vector database

By Hearmeman24·Created 11 months ago·Updated 11 months ago· 0
Pinecone Prompt Upserter
  • image
  • status
  • image
prompt_text
model_namecomfyui
index_nameprompts
pinecone_api_key
openai_api_key

You know how it goes: you spend an evening dialing in a prompt, finally get the shot you wanted, and the next week you can't remember what it was. The Pinecone Prompt Upserter is a small, single-purpose node that fixes that the hard way - it stores the prompts you approve into a Pinecone vector database so you can search them later. "Upserter" is doing honest work there: this node is the write side only. There's no retrieval node in the pack, so you're building the library here and querying it wherever you like (a Python script, a frontend, or a future node). Worth knowing before you wire it into anything.

How it works

The node sits at the end of a workflow. When it runs, it takes your prompt_text, does two things to it, then decides whether to bother you:

  • Trigger-word sanitization - the genuinely clever bit. Any token matching the Name01 pattern (capital letter + letters + 01, like Sarah01 or Onyx01) gets replaced with <trigger_word>. If you're iterating on a character LoRA and don't want the character's name baked into every stored prompt, this keeps your library reusable across character swaps.
  • SHA256 hashing of the normalized text (lowercase, stripped) - that hash is both the dedup key and the vector ID in Pinecone.

First time it sees a prompt hash, it pauses the whole graph and pops a browser overlay showing the generated image with a green "Insert to Index" and a red "Cancel" button. Approve, and it calls OpenAI's text-embedding-3-large (3072 dimensions) and upserts a vector with text, model, and prompt_hash metadata into your index. Decline, and it skips. Either way, the hash goes into an in-memory set so the same session won't ask again.

The inputs that matter

You only really set three things:

  • prompt_text - the prompt to store, usually wired from whatever is feeding your text encoder.
  • model_name - a label (like "flux", "sdxl") stored as metadata so you can filter later. Pure metadata; doesn't affect anything.
  • index_name - your Pinecone index, default prompts.

Optional: image (wire your sampler's output here to see it in the approval popup), plus pinecone_api_key and openai_api_key - leave them empty and it falls back to environment variables.

Outputs are a status string (SUCCESS:, SKIPPED:, CANCELED:, or ERROR: with the hash) and a passthrough image. It's an output node, so it typically ends the branch.

Installing it

ComfyUI Manager will find it if you search "Pinecone Prompt Upserter". Or, the manual route:

cd ComfyUI/custom_nodes/
git clone https://github.com/Hearmeman24/ComfyUI-Pinecone
cd ComfyUI-Pinecone
pip install -r requirements.txt

That requirements file pulls in openai, pinecone, and python-dotenv. Then restart ComfyUI. Before it will actually save anything you need two API keys as environment variables (OPENAI_API_KEY, PINECONE_API_KEY) and a Pinecone index you've created yourself with 3072 dimensions and cosine metric to match text-embedding-3-large - the README includes the pc.create_index(...) snippet to do it. That last step trips people up constantly; a default Pinecone index is 1536 dimensions and the node will just error.

Where people get burned

  • It blocks the entire workflow. The approval loop is a while paused: sleep on the server side, so if you miss the popup - tab unfocused, browser closed, headless API call - the queue hangs indefinitely. It's the first thing to understand about this node. One light aside: don't run it unattended and go make coffee.
  • "Smart memory" is session-only. seen_prompts is an in-memory class-level set, not a database. Restart ComfyUI and it'll ask you about a prompt you already approved. The README's "won't duplicate" holds only because the vector ID is the deterministic hash (re-inserting overwrites the same ID) - and only if you click Insert again.
  • It costs money and leaves ComfyUI. Every saved prompt round-trips through OpenAI's embedding API and Pinecone. Fine for curating a few dozen keepers; nonsense as a firehose.
  • The pack is brand new and single-commit (MIT), so treat the popup UI as a feature in active development - the "Show Preview" button on the node is your escape hatch if the overlay misbehaves.

Honestly? For most people this is overkill - a text file or the clipboard does the same job for free. Reach for it when you've outgrown that: a few hundred saved prompts, a character workflow you iterate on, or a curated dataset you want to query semantically. For that, it's genuinely handy.

Categoryprompt_management

Inputs (6)

NameTypeDefaultDescription
prompt_textSTRING
model_nameSTRINGcomfyui
index_nameSTRINGprompts
imageoptIMAGE
pinecone_api_keyoptSTRING
openai_api_keyoptSTRING

Outputs (2)

NameTypeDescription
statusSTRING
imageIMAGE