Readme
Google Gemini AI Agent (Niagara ProgramObject)
Google Gemini Niagara Program Module — User Guide
1) What this module does
- Reads the list of Gemini models from Google.
- Provides a dropdown (modelPick) to select a model.
- Collects Niagara point values (by ORD) into a JSON “station snapshot”.
- Sends prompt + snapshot (and optional memory) to Gemini.
- Writes the reply to outText.
2) Key behavior
- NO internal polling.
- The module calls Gemini ONLY when updateNow is triggered (external pulse).
3) Inputs and outputs
A) Enable / control
enable (Boolean) — INPUT
- true : module is active.
- false : module is disabled (no HTTP calls). One-shot buttons are ignored and automatically reset.
updateNow (Boolean) — INPUT, one-shot
- Triggers one analysis request.
- Usage: set updateNow = true for one cycle. The module sets it back to false.
restartNow (Boolean) — INPUT, one-shot
- Resets internal state (including 429 pause) and sets the module back to “Ready”.
- Usage: set restartNow = true. The module sets it back to false.
answerOk (Boolean) — OUTPUT
- false before an analyze request starts.
- true only when a successful model response is received.
- Stays true until the next updateNow.
statusMessage (StatusString) — OUTPUT
- Short status text, for example:
- Ready
- Analyze: sending...
- Analyze: OK
- Analyze ERR: ...
- Analyze paused (429)
outText (StatusString) — OUTPUT
- The model reply text (or an error message).
B) API / model selection
apiKey (String) — INPUT
- Your Google API key.
refreshModelsNow (Boolean) — INPUT, one-shot
- Downloads the model list from Google.
- Usage: set refreshModelsNow = true. The module sets it back to false.
modelsList (StatusString) — OUTPUT
- Text list of models returned by Google (for verification).
modelsLastUpdate (AbsTime) — OUTPUT
- Time of the last successful model list update.
modelPick (DynamicEnum) — INPUT
- Dropdown list of models.
model (String) — INPUT / service
- Current selected model id.
- Normally you do not edit this manually; it is synchronized with modelPick.
C) Prompt and output limits
instructions (String) — INPUT
- System-style rules for the model.
- Example: “You are a building HVAC dispatcher. Be concise and practical.”
prompt (String) — INPUT
- Main request text.
maxOutputTokens (StatusNumeric) — INPUT
- Maximum length of the model output.
D) Station points
pointsOrds (String) — INPUT (one ORD per line)
- Add Niagara ORDs here, one per line.
- You can provide:
1) A single point/component (module reads its out)
2) A folder/container (module walks the tree and reads points inside)
Folder reading
- If the ORD resolves to a container, the module scans child components.
- If a child looks like a point (has an out slot/value), it is added to the snapshot.
Snapshot limits (to avoid oversized requests)
- Up to 400 points.
- Max folder depth: 12 levels.
E) Chat memory
memoryMaxMessages (StatusNumeric) — INPUT
- How many messages to keep in memory (rolling buffer).
- One “message” is one stored entry (user or model).
memoryModePick (DynamicEnum) — INPUT
- What to store in memory (all non-empty combinations):
- prompt_only
- snapshot_only
- answers_only
- prompt_snapshot
- prompt_answers
- snapshot_answers
- promptsnapshotanswers
chatMemory (StatusString) — OUTPUT / service
- Stored memory in an internal line format.
- Usually you do not edit it manually.
clearMemoryNow (Boolean) — INPUT, one-shot
- Clears chat memory.
- Usage: set clearMemoryNow = true. The module sets it back to false.
4) Typical workflow
1) Set enable = true.
2) Paste apiKey.
3) Trigger refreshModelsNow = true.
4) Check modelsList and modelsLastUpdate.
5) Select a model using modelPick.
6) Set instructions, prompt, maxOutputTokens.
7) Fill pointsOrds (points and/or folders).
8) Set memoryModePick and memoryMaxMessages (optional).
9) External scheduler/logic triggers updateNow = true when you want a new response.
10) Check answerOk, outText, statusMessage.
5) 429 / rate limit pause
- If Google returns 429 (rate limit / quota), the module enters a pause.
- While paused, updateNow will not send a request.
- Use restartNow to clear the pause and try again after you fixed the quota/rate.
6) Notes
- Keep memory modes that include “snapshot” small, because snapshots are large.
- If you want stable output, keep instructions consistent and short.null
Installation
Enter installation instructions for this package
Usage
Enter usage instructions for this package
Copyright 2026 Gennadiy Zhilcov