Function: probeGpuBudget()
ts
function probeGpuBudget(nav?: NavigatorGpuLike): Promise<GpuBudget>;Defined in: src/batteries/llm/chat_common/gpu_budget.ts:108
Probe the host WebGPU device for its memory budget (per-allocation ceilings + adapter info).
Parameters
| Parameter | Type | Description |
|---|---|---|
nav? | NavigatorGpuLike | Injectable navigator-like object for tests; defaults to the global navigator. |
Returns
Promise<GpuBudget>
The GpuBudget snapshot.
Remarks
Reads navigator.gpu adapter limits — this is OBSERVABILITY ONLY; it allocates nothing and changes no behavior. Returns { available: false } (with zeroed sizes) when WebGPU is absent (Node, a browser without the API, or a refused adapter) so callers can branch without try/catch. Best-effort and never throws. A battery emits the result through its lifecycle hook so the application can show "you have ~N GiB of GPU budget" and let the user choose a context window accordingly.