MCPcopy
hub / github.com/marimo-team/marimo / loadAndValidateModels

Function loadAndValidateModels

packages/llm-info/src/generate.ts:71–87  ·  view source on GitHub ↗
(yamlPath: string)

Source from the content-addressed store, hash-verified

69}
70
71function loadAndValidateModels(yamlPath: string): Record<string, unknown[]> {
72 const yamlContent = readFileSync(yamlPath, "utf-8");
73 const raw = parse(yamlContent);
74
75 if (raw == null || typeof raw !== "object" || Array.isArray(raw)) {
76 throw new Error(
77 "Models YAML must be a map keyed by provider id (e.g. `anthropic:`)",
78 );
79 }
80
81 try {
82 return ModelsByProviderSchema.parse(raw);
83 } catch (error) {
84 Logger.error("Model validation failed:", error);
85 throw error;
86 }
87}
88
89function loadAndValidateProviders(yamlPath: string): unknown[] {
90 const yamlContent = readFileSync(yamlPath, "utf-8");

Callers 1

mainFunction · 0.85

Calls 3

parseMethod · 0.65
parseFunction · 0.50
errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…