yaml env schemas

This commit is contained in:
Dallin Romney 2025-02-24 09:51:49 -08:00
parent 1e10b2bbce
commit 74485e0118
2 changed files with 9 additions and 1 deletions

View file

@ -9,5 +9,5 @@ export * from "./load/proxySecretResolution.js";
export * from "./load/unroll.js";
export * from "./schemas/data/index.js";
export * from "./schemas/index.js";
export type { ModelConfig, ModelRole } from "./schemas/models.js";
export type { EmbedOptions, ModelConfig, ModelRole } from "./schemas/models.js";
export * from "./validation.js";

View file

@ -42,6 +42,12 @@ export const completionOptionsSchema = z.object({
});
export type CompletionOptions = z.infer<typeof completionOptionsSchema>;
export const embedOptionsSchema = z.object({
maxChunkSize: z.number().optional(),
maxBatchSize: z.number().optional(),
});
export type EmbedOptions = z.infer<typeof embedOptionsSchema>;
/** Prompt templates use Handlebars syntax */
const promptTemplatesSchema = z.object({
apply: z.string().optional(),
@ -57,7 +63,9 @@ const baseModelFields = {
roles: modelRolesSchema.array().optional(),
defaultCompletionOptions: completionOptionsSchema.optional(),
requestOptions: requestOptionsSchema.optional(),
embedOptions: embedOptionsSchema.optional(),
promptTemplates: promptTemplatesSchema.optional(),
env: z.record(z.string(), z.string()).optional(),
};
export const modelSchema = z.union([