mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
docs(coding-agent): document model catalog refresh
This commit is contained in:
parent
c93ea6ccf0
commit
581d75a89c
1 changed files with 9 additions and 0 deletions
|
|
@ -372,6 +372,13 @@ import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|||
|
||||
const modelRuntime = await ModelRuntime.create();
|
||||
|
||||
// create() restores cached catalogs but does not refresh them from pi.dev by default.
|
||||
// Opt in to a create-time network refresh and bound how long it may take:
|
||||
const refreshedRuntime = await ModelRuntime.create({
|
||||
allowModelNetwork: true,
|
||||
modelRefreshTimeoutMs: 15_000,
|
||||
});
|
||||
|
||||
// Find specific built-in model (doesn't check if API key exists)
|
||||
const opus = getModel("anthropic", "claude-opus-4-5");
|
||||
if (!opus) throw new Error("Model not found");
|
||||
|
|
@ -402,6 +409,8 @@ If no model is provided:
|
|||
2. Uses default from settings
|
||||
3. Falls back to first available model
|
||||
|
||||
Remote catalogs are persisted locally so later runtimes can restore them without a network request. The default file is `~/.pi/agent/models-store.json`; set `modelsStorePath` to choose another location, or inject `modelsStore` to control persistence. Network refreshes are throttled to once per provider every four hours unless forced. To force an immediate refresh, call `await modelRuntime.refresh({ allowNetwork: true, force: true, signal })`. Setting `PI_OFFLINE` disables model network access.
|
||||
|
||||
To match CLI model parsing, use the exported resolver helpers:
|
||||
|
||||
```typescript
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue