MCPcopy Create free account
hub / github.com/anomalyco/opencode / mergeGenerationOptions

Function mergeGenerationOptions

packages/llm/src/schema/options.ts:110–122  ·  view source on GitHub ↗
(...items: ReadonlyArray<GenerationOptionsInput | undefined>)

Source from the content-addressed store, hash-verified

108) => items.findLast((item) => item?.[key] !== undefined)?.[key]
109
110export const mergeGenerationOptions = (...items: ReadonlyArray<GenerationOptionsInput | undefined>) => {
111 const result = new GenerationOptions({
112 maxTokens: latestGeneration(items, "maxTokens"),
113 temperature: latestGeneration(items, "temperature"),
114 topP: latestGeneration(items, "topP"),
115 topK: latestGeneration(items, "topK"),
116 frequencyPenalty: latestGeneration(items, "frequencyPenalty"),
117 presencePenalty: latestGeneration(items, "presencePenalty"),
118 seed: latestGeneration(items, "seed"),
119 stop: latestGeneration(items, "stop"),
120 })
121 return Object.values(result).some((value) => value !== undefined) ? result : undefined
122}
123
124export class ModelLimits extends Schema.Class<ModelLimits>("LLM.ModelLimits")({
125 context: Schema.optional(Schema.Number),

Callers 2

mergeRouteDefaultsFunction · 0.90
resolveRequestOptionsFunction · 0.90

Calls 2

latestGenerationFunction · 0.85
valuesMethod · 0.45

Tested by

no test coverage detected