Nodes/ComfyUI Griptape Nodes/Griptape Run: Text Extraction
ComfyUI Node

Griptape Run: Text Extraction

Turn messy text into structured data

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Run: Text Extraction
  • agent
  • key_value_replacement
  • OUTPUT
  • AGENT
input_string
extraction_typejson
column_names
template_schema
STRING

You've got a paragraph of unstructured text - an email, a listing, a product blurb - and you want the fields out of it as data, not prose. Griptape Run: Text Extraction is the node that makes an LLM do the parsing for you, into either CSV or JSON, using Griptape's extraction engines.

It's a surprisingly handy utility once you see the shape of it. Feed it "John Smith, 34, lives in Austin" and a schema like {"name": str, "age": int}, and you get back structured output you can pass to other nodes. Where this shines is pipelines that turn free text into something a downstream system can consume - think turning an LLM's rambling answer into a clean key-value object before you save it or feed it back in.

How it works

The node builds a CsvExtractionEngine or JsonExtractionEngine from your settings, wraps it in an ExtractionTask, and runs it against the agent (a default one if none is connected). The prompt driver doing the extracting is whatever your agent's config specifies. CSV mode uses column_names (comma-separated) to define the columns; JSON mode uses template_schema - the tooltip shows the format: {"name": str, "age": int}. The output differs by mode: CSV returns the rows split by newlines, JSON returns the extracted artifacts.

The inputs that matter

  • extraction_type - csv or json (default json).
  • column_names - for CSV: comma-separated columns, e.g. name, age.
  • template_schema - for JSON: the schema template.
  • STRING - the text to extract from.
  • agent / input_string / key_value_replacement - the usual optional trio.

Outputs: OUTPUT (the structured result) and AGENT.

Installing

ComfyUI Manager → search "Griptape" → Install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/griptape-ai/ComfyUI-Griptape

Restart ComfyUI. Heavy deps (griptape[all], python-dotenv) and a real model configured - extraction quality tracks model quality.

Common gotchas

Extraction is only as good as your schema. A vague template_schema or missing column_names yields vague results - the LLM fills the gaps however it likes. Keep schemas tight and you'll get consistent output; leave them loose and you'll spend your afternoon debugging a string that sort of looks like JSON.

Plus the pack-wide usuals: torch version conflicts on Nvidia (reinstall with the cu121 index) and stale-griptape ImportErrors (python -m pip install griptape -U).

CategoryGriptape/Text

Inputs (7)

NameTypeDefaultDescription
input_stringoptSTRING
agentoptAGENT
key_value_replacementoptDICTThe will replace the {{ key }} with a value.
extraction_typeoptCOMBOjsonThe type of extraction to perform.
column_namesoptSTRINGComma separated list of column names to extract. Example: name, age
template_schemaoptSTRINGSchema template for the json extraction. Example: {"name": str, "age": int}
STRINGoptSTRINGText to extract from. If you are also providing an input_string, this will be added before that.

Outputs (2)

NameTypeDescription
OUTPUTSTRING
AGENTAGENT