String to Float
Turn an LLM's text answer into a real number
- float
Small node, real problem. LLMs speak in text. ComfyUI's typed sockets don't let a STRING output plug into something expecting a FLOAT - a numeric slider, a strength value, anything typed strictly as a number. str2float is the bridge: feed it text, get a float out the other side. It's part of LLM Party's "converter" family, the plumbing nodes that exist purely to reshape data between the LLM side of a graph and the more traditional, strictly-typed ComfyUI side.
There's nothing more to the mechanism than that - it parses text as a float and passes the result on.
Inputs and outputs that matter
text- the string to parse. In practice this is usually the output of an LLM node, or a piece of a larger response pulled out by something liketext2parameters.float- the single output, a realFLOATvalue ready to plug into any node that requires one.
Installing it
Search comfyui_LLM_party in ComfyUI Manager and install, or clone it yourself:
cd ComfyUI/custom_nodes
git clone https://github.com/heshengtao/comfyui_LLM_party
Run pip install -r requirements.txt inside your ComfyUI Python environment afterward, then restart. This particular node has zero model or API dependency - it's pure Python string parsing - but it comes bundled with the rest of this large pack, so the install pulls in everything else too (LLM API clients, local model loading support, RAG, TTS). If all you want is API-based LLM calling without the local-model weight, the README's only_api branch is the lighter path.
Common issues
The entire failure mode of this node is "the text wasn't actually a clean number." If your LLM answers with something like "The result is approximately 4.2 units" instead of just 4.2, parsing that as a float will fail - the node has no language understanding, it's a strict conversion, not an extraction. The fix lives upstream, in your prompt: tell the model explicitly to respond with the number and nothing else, or lower the temperature so it stops padding numeric answers with prose. If you need to pull a number out of a longer, more natural response rather than controlling the prompt that tightly, that's a job for a proper extraction step (or this pack's text2parameters, if the value is coming back as part of a structured JSON blob) rather than something str2float can do on its own.
Also worth remembering: locale formatting matters. A string like "1,000.5" or "4,2" (comma as decimal separator, common outside English-speaking locales) isn't a plain float literal and won't parse cleanly either - if your LLM's language or region settings tend to produce that kind of formatting, it's worth normalizing the text before it hits this node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |