Shrug Embeddings
Real vectors out of your local server, for search and similarity
- connection
- embeddings
Embeddings are the quiet workhorse of everything that claims to be "semantic" - search, similarity, clustering, dedup - and they're the least glamorous output of any LLM server. Shrug Embeddings is the node that pulls them into your graph: it sends text to your heylookitsanllm server's /v1/embeddings endpoint and hands you back a torch tensor. No cloud, no API key; the embedding model is whatever the server has loaded.
What would you actually do with it here? Keep a library of style descriptions as vectors and find the nearest matches for a new prompt. Cluster your last hundred generations by visual description. Deduplicate prompt variants. Build a tiny retrieval step before you send a prompt to ShrugVLM - pick the best few candidates from a big set, then let the VLM look at them. That's the pattern that justifies having embeddings in the graph at all.
How it works
The node POSTs your text to /v1/embeddings and reads back the data array (sorted by index, which the server doesn't guarantee - the client is careful about that). The result is a (N, D) float32 torch.Tensor, exposed as a custom SHRUG_EMBEDDINGS output. On the server side, heylookitsanllm runs MLX sentence embeddings with dynamic backbone loading, so the embedding model can differ from your chat model.
One thing to know before you paste a wall of text in: the client embeds the whole input as a single item. A multiline string becomes one embedding of the entire blob, not one per line. If you want per-line vectors, feed each line separately - that's the kind of detail the single text input doesn't advertise.
Inputs and outputs
connection(required) - aSHRUG_CONNfromShrugConnection.text(required) - the string to embed. One embedding per call, regardless of how many newlines are in it.
Output: embeddings - type SHRUG_EMBEDDINGS, which is a torch.Tensor under the hood. Here's the honest gap: it's a custom output type, so you won't be plugging it straight into standard ComfyUI nodes without a conversion or comparison step. Stock ComfyUI has no native "cosine similarity between two tensors" node waiting for it. Plan for a small amount of glue (or a loop node) on the other side.
How to install
Same pack install as the rest of the Shrug nodes. ComfyUI Manager → search Shrug-Prompter → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/fblissjr/shrug-prompter
Dependencies are already present in modern ComfyUI (httpx, orjson, pillow, torch, numpy), and no model files download into ComfyUI - the embedding model lives on the server. A current ComfyUI build is required (the pack uses the V3 extension API), plus a ShrugConnection with a server that has an embedding-capable model loaded.
Common issues
- Empty or mismatched vector dimensions. The server may have swapped embedding backbones between calls; models loaded dynamically can change dimensionality. Re-run after loading the model you intend to use.
- "Can't connect" style errors. Usual suspects - server down, wrong
base_url, or the model id on your connection isn't one the server knows. - Output won't wire into anything. The custom
SHRUG_EMBEDDINGStype needs matching consumer nodes. Convert or compare before it hits stock ComfyUI nodes.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| connection | SHRUG_CONN | — | |
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| embeddings | SHRUG_EMBEDDINGS | — |