MCPcopy Create free account
hub / github.com/anomalyco/models.dev / buildGoogleModel

Function buildGoogleModel

packages/core/src/sync/providers/google.ts:91–161  ·  view source on GitHub ↗
(model: GoogleModel, existing: ExistingModel)

Source from the content-addressed store, hash-verified

89} satisfies SyncProvider<GoogleModel>;
90
91export function buildGoogleModel(model: GoogleModel, existing: ExistingModel): SyncedModel {
92 const name = existing.name;
93 const description = existing.description;
94 const releaseDate = existing.release_date;
95 const lastUpdated = existing.last_updated;
96 const attachment = existing.attachment;
97 const reasoning = existing.reasoning;
98 const toolCall = existing.tool_call;
99 const openWeights = existing.open_weights;
100 const limit = existing.limit;
101 const modalities = existing.modalities;
102
103 if (
104 name === undefined
105 || releaseDate === undefined
106 || lastUpdated === undefined
107 || attachment === undefined
108 || reasoning === undefined
109 || toolCall === undefined
110 || openWeights === undefined
111 || limit === undefined
112 || modalities === undefined
113 ) {
114 throw new Error(`Google model ${model.name} has incomplete local TOML metadata required for sync`);
115 }
116
117 const synced: SyncedFullModel = {
118 name: model.displayName ?? name,
119 description: description ?? model.description ?? describeModel({
120 id: model.name.replace(/^models\//, ""),
121 name: model.displayName ?? name,
122 family: existing.family,
123 reasoning: model.thinking ?? reasoning,
124 tool_call: toolCall,
125 structured_output: existing.structured_output,
126 open_weights: openWeights,
127 limit: {
128 input: limit.input,
129 context: model.inputTokenLimit,
130 output: model.outputTokenLimit,
131 },
132 modalities,
133 }),
134 family: existing.family,
135 release_date: releaseDate,
136 last_updated: lastUpdated,
137 attachment,
138 reasoning: model.thinking ?? reasoning,
139 temperature: model.temperature !== undefined || model.maxTemperature !== undefined
140 ? true
141 : existing.temperature,
142 reasoning_options: existing.reasoning_options,
143 tool_call: toolCall,
144 structured_output: existing.structured_output,
145 knowledge: existing.knowledge,
146 open_weights: openWeights,
147 status: existing.status,
148 interleaved: existing.interleaved,

Callers 1

translateModelFunction · 0.85

Calls 2

describeModelFunction · 0.85
factorBaseModelFunction · 0.85

Tested by

no test coverage detected