fix(coding-agent): replace deprecated getModel in SDK example (#7306)

This commit is contained in:
muyiyr 2026-07-31 04:01:49 +08:00 • committed by GitHub
parent c066d01a40
commit 393c344229
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,13 +4,12 @@
* Shows how to select a specific model and thinking level.
*/
import { getModel } from "@earendil-works/pi-ai/compat";
import { createAgentSession, ModelRuntime } from "@earendil-works/pi-coding-agent";
const modelRuntime = await ModelRuntime.create();
// Option 1: Find a specific built-in model by provider/id
const opus = getModel("anthropic", "claude-opus-4-5");
const opus = modelRuntime.getModel("anthropic", "claude-opus-4-5");
if (opus) {
console.log(`Found model: ${opus.provider}/${opus.id}`);
}