Gemini 3 函数调用
In this pack, you are the executor
- function_calls
- thought_signature
- text_response
Function calling is the mechanism behind "agentic" AI: you hand the model a list of function definitions, it figures out which to call and with what arguments, and the loop continues until the task is done. Gemini3FunctionCalling gives you the request half of that loop - and it's honest about it, because it doesn't execute anything. The node asks Gemini for a function call, hands you the JSON, and stops. Running the function and feeding the result back is your job.
That's the key thing to understand before you wire this in: it's not a turnkey agent. If you were expecting "ask for weather, get weather," this node gives you the request and expects you to do the fetching. But in ComfyUI that's actually the right shape - you have nodes for everything (image operations, file IO, other models), so letting Gemini orchestrate your graph by emitting structured call requests is genuinely useful.
How it works
You provide function_declarations as a JSON array of standard OpenAPI-style function specs - name, description, parameters with properties and required. That's passed to Google as a tools entry. The model responds with one or more functionCall parts, which the node extracts into the function_calls output as JSON. If the model included a thoughtSignature on the call, that comes out separately.
The multi-step loop uses the two optional inputs. When you've executed the calls, you feed the results back via function_responses (JSON) plus the thought_signature from the previous round; the node reconstructs a model-turn function call followed by a user-turn function response, and Gemini can then decide on the next call or produce final text. Chain the node copies together and you get sequential multi-step reasoning without any separate agent framework.
Inputs and outputs that matter
prompt- the task. The default asks for the weather in Paris and London against aget_weatherexample declaration.function_declarations- JSON. This is the input that actually defines your agent's tools.thought_signature/function_responses- optional, but they're what makes the loop work across runs.
Outputs: function_calls (JSON array - wire this to whatever will execute the calls), thought_signature (feed forward), and text_response (final text, usually empty until the loop resolves).
Install
Same pack as everything else here. ComfyUI Manager (search "ComfyUI-Gemini-3") or:
cd ComfyUI/custom_nodes
git clone https://github.com/xuchenxu168/ComfyUI-Gemini-3
cd ComfyUI-Gemini-3
pip install -r requirements.txt
No model downloads. Google AI Studio key via the api_key field, config.json, or GEMINI_API_KEY.
Common issues
- "Nothing happens" - expected. The node returns a request, not a result. If your graph has nothing downstream of
function_callsactually executing and feedingfunction_responsesback, the loop stalls after one turn. This is the trap most people hit first. - Malformed JSON in
function_responses- the node silently skips the history reconstruction on a parse failure, and the model loses the thread of what it already called. - Thinking level matters. With
thinking_levelset to low, the model is more likely to skip tool use and answer from memory. Keep high if the task genuinely needs tool orchestration. - It's not a graph-native executor. Some other packs auto-run functions by mapping declarations to local Python; this one deliberately stays a thin API wrapper, so budget your own plumbing for the execute step.
If you mostly want a guaranteed-shape answer rather than a tool loop, the pack's structured output node is usually the simpler choice - schema-validated JSON in one call, no executor required.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | 查询巴黎和伦敦的天气 | — |
| function_declarations | STRING | [ { "name": "get_weather", "description": "获取城市天气", "parameters": { "type": "object", "properties": { "city": { "type": "string", "description": "城市名称" } }, "required": [ "city" ] } } ] | — |
| api_provider | COMBO | 1 options: google | |
| api_key | STRING | — | |
| model | COMBO | gemini-3-pro-preview | 1 options: gemini-3-pro-preview |
| thinking_level | COMBO | high | 2 options: high, low |
| thought_signatureopt | STRING | — | |
| function_responsesopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| function_calls | STRING | — |
| thought_signature | STRING | — |
| text_response | STRING | — |