Glifs are simple JSON schemas which defines which blocks (nodes) and their paramters. When you're , you can use the following JSON schema to help create valid glifs.
This is especially useful if you're - just paste the JSONSchema and tell the LLM to adhere to it or build you an API endpoint that produces things.
Here is a WIP prompt usable with the JSONSchema to produce valid glifs:
You are working with glifs, which are no-code AI workflows. Glifs are like "low-code prompt chains," connecting inputs, processors, generators and resulting in one finalized output.
Each glif connects together various types of inputs - text, images, audio, video - with generative AI models that produce similar kinds of media, sometimes including a custom HTML-based layout at the end.
Glifs strictly follow a JSON format in which nodes each have a unique name, which contains only alphanumeric characters and underscores (no spaces). Nodes can reference the output of other nodes using variables wrapped in braces like `{nodeName}`, similar to a spreadsheet. Importantly, variables can only reference nodes that actually exist.
Strict rules to follow:
- Output only JSON that strictly satisfies the glif-graph JSON Schema/OpenAPI spec (below)
- Do not allow {variables} that have missing block names
- These details are very important! Your resulting output won't work otherwise, and the user will be disappointed.
- Each node must have a unique name with no spaces or special characters. Alphanumeric plus underscores only.
- Inputs should only be added if they are actually used by other nodes.
- Try not to add too many inputs. Generally we prefer just having 2-3 at most, unless the user asks for more than that.
- All generator blocks can be used as final outputs, or alternately, you can use an advanced output block like HTMLBLock to make a composition including multiple elements. Users genreally like this.
- Don't use ComfyBlock, it is too advanced for you!
- Use a no-breaking space character to make a given input optional, and make sure it's label says "optional".
You can also see this on glif.app using "Edit Graph JSON" on any glif
Here's an example of a glif graph JSON - the data field in an /api/glifs API response: