Nodes/Groq Nodes/Groq Tool Use
ComfyUI Node

Groq Tool Use

Get structured JSON out of an LLM, not an essay

By brayevalerien·Created 10 months ago·Updated 10 months ago· 1
Groq Tool Use
    • response_text
    • tool_calls_json
    • usage_info
    promptWhat is the weather in San Francisco?
    tools_json[ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "City name" }, "unit": { "type": "string", "enum": [ "celsius", "fahrenheit" ] } }, "required": [ "location" ] } } } ]
    modelllama-3.3-70b-versatile
    temperature1.0
    api_key
    tool_choiceauto
    parallel_tool_callstrue

    Groq Chat gives you an essay. Groq Tool Use gives you data. If you've ever asked an LLM to "list the colors" and gotten a paragraph with a preamble, a numbered list, and a farewell, you know why function calling exists. This node defines a set of tools as JSON, hands them to Groq's model, and gets back a structured tool_calls_json you can actually parse and act on.

    The honest framing up front: this node is the request side of tool use. It does not execute your tools - there's no code runner inside ComfyUI that calls get_weather for you. It gets the model to declare, in clean JSON, which function it wants to call and with what arguments. Executing that is your job, in whatever follows the node. That's not a limitation so much as the division of labor: the node guarantees you get machine-readable output instead of a wall of prose.

    How it works

    You supply tools_json - an array of OpenAI-style function definitions, each with a type, a name, a description, and a JSON schema for parameters. The pack validates the schema before the call (malformed JSON gets rejected with a clear message), then sends the tools array with your prompt to the model. The response's tool calls are extracted and returned as tool_calls_json; if the model decided to just answer instead, response_text holds that instead.

    The inputs that matter

    • tools_json - the whole game. The default is a get_weather example, which is a great template: copy it, swap the name/description/parameters for your own, and you're 90% there.
    • prompt - the user message that may trigger a tool call.
    • model - the same chat-model dropdown as Groq Chat (llama-3.3-70b-versatile and friends).
    • temperature - controls how freely the model picks tools. Lower it if it's getting creative with arguments.
    • tool_choice - auto (let the model decide), required (force it to call a tool), or none (disable calling). Set required when you always want structured output.
    • parallel_tool_calls - on by default; lets the model request several tool calls in one shot.

    The three outputs are response_text, tool_calls_json, and usage_info. The one you care about is tool_calls_json - wire it into a text display or a JSON-parsing node, and suddenly your workflow can branch on real structured data instead of string matching.

    Where it shines

    Structured extraction is the killer use: "turn this prompt into a list of {subject, style, camera} objects," or "classify each of these into categories." Combined with a required tool_choice, it's a reliable way to force the model into a shape, which is exactly the trick prompt engineers reach for when they need deterministic-feeling output from a nondeterministic model.

    Installing it

    Same routine as the rest of the pack. ComfyUI Manager → search "Groq Nodes", or:

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

    Restart, set your GROQ_API_KEY (env var, .env, or the api_key field), and you're off. Light dependencies, no model downloads.

    Common issues

    Two gotchas dominate. First, tools_json must be valid JSON - the pack validates it, but a stray comma surfaces as "Invalid JSON in tools definition", and it's the #1 beginner stumble. Second, remember it doesn't execute anything: if tool_calls_json comes back and you were expecting the answer, that's working as designed - you're supposed to do the next step. Errors surface as text in response_text ("Configuration error…"), so check that output when things go quiet. And as with the whole pack, it's a young one-maintainer repo hitting a cloud API - install from the real repo, keep it updated, mind your rate limits.

    Categorygroq/tools

    Inputs (7)

    NameTypeDefaultDescription
    promptSTRINGWhat is the weather in San Francisco?
    tools_jsonSTRING[ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "City name" }, "unit": { "type": "string", "enum": [ "celsius", "fahrenheit" ] } }, "required": [ "location" ] } } } ]
    modelCOMBOllama-3.3-70b-versatile7 options: llama-3.3-70b-versatile, llama-3.1-8b-instant, openai/gpt-oss-120b, openai/gpt-oss-20b, groq/compound, groq/compound-mini, +1
    temperatureFLOAT1.00–2
    api_keyoptSTRING
    tool_choiceoptCOMBOauto3 options: auto, required, none
    parallel_tool_callsoptBOOLEANtrue

    Outputs (3)

    NameTypeDescription
    response_textSTRING
    tool_calls_jsonSTRING
    usage_infoSTRING