cleanup(llm-pi-ai): share the model-entry field schemas between models and modelOverrides
The duplication gate caught the two schema literals diverging only by the id field; the shared dict is now the single home, with the id added where it lives (the entry) and omitted where the dict key carries it.
This commit is contained in:
@@ -175,8 +175,8 @@ const reasoningEfforts = z.dict(
|
||||
z.union(THINKING_LEVELS),
|
||||
) as unknown as z<PiAiReasoningEfforts>
|
||||
|
||||
const modelProfile: z<PiAiModelProfile> = z.object({
|
||||
id: z.string().required(),
|
||||
/** The fields a `models` entry and a `modelOverrides` value share; only the id's home differs. */
|
||||
const modelFields = {
|
||||
name: z.string(),
|
||||
contextWindow: z.number().step(1).min(1),
|
||||
maxTokens: z.number().step(1).min(1),
|
||||
@@ -185,16 +185,15 @@ const modelProfile: z<PiAiModelProfile> = z.object({
|
||||
// installed catalog's capability", while `false` disables reasoning.
|
||||
reasoningEfforts: z.union([z.const(false), reasoningEfforts]),
|
||||
compat: compatProfile,
|
||||
}
|
||||
|
||||
const modelProfile: z<PiAiModelProfile> = z.object({
|
||||
id: z.string().required(),
|
||||
...modelFields,
|
||||
})
|
||||
|
||||
/** A {@link modelProfile} whose id lives in the `modelOverrides` dict key. */
|
||||
const modelOverride: z<PiAiModelOverride> = z.object({
|
||||
name: z.string(),
|
||||
contextWindow: z.number().step(1).min(1),
|
||||
maxTokens: z.number().step(1).min(1),
|
||||
reasoningEfforts: z.union([z.const(false), reasoningEfforts]),
|
||||
compat: compatProfile,
|
||||
})
|
||||
const modelOverride: z<PiAiModelOverride> = z.object(modelFields)
|
||||
|
||||
const profile = z.object({
|
||||
apiKeyEnv: z.string().role('credential-ref'),
|
||||
|
||||
Reference in New Issue
Block a user