MCPcopy
hub / github.com/anomalyco/models.dev / loadExistingModel

Function loadExistingModel

packages/core/script/generate-friendli.ts:144–160  ·  view source on GitHub ↗
(
  filePath: string,
)

Source from the content-addressed store, hash-verified

142}
143
144async function loadExistingModel(
145 filePath: string,
146): Promise<ExistingModel | null> {
147 try {
148 const file = Bun.file(filePath);
149 if (!(await file.exists())) {
150 return null;
151 }
152 const toml = await import(filePath, { with: { type: "toml" } }).then(
153 (mod) => mod.default,
154 );
155 return toml as ExistingModel;
156 } catch (e) {
157 console.warn(`Warning: Failed to parse existing file ${filePath}:`, e);
158 return null;
159 }
160}
161
162interface MergedModel {
163 name: string;

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected