UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

109 lines (108 loc) • 4.25 kB
import { An as never, Et as _enum, Fn as object, Jn as string, Lt as boolean, Nt as array, Pn as number, Yt as discriminatedUnion, xn as literal } from "./schemas-Cy6abvsu.mjs"; //#region packages/model-catalog-core/src/model-inference-capabilities.ts const positiveInteger = number().int().positive().max(Number.MAX_SAFE_INTEGER); const questionType = _enum([ "boolean", "choice", "score", "sort", "tags", "box" ]); const questionTypes = array(questionType).min(1).max(6).refine((e) => new Set(e).size === e.length); const probabilitySemantics = _enum([ "boolean", "categorical", "independent", "provider-defined", "none" ]); const question = object({ /** Meaning of the supplied numbers, not a claim of calibrated accuracy. */ probabilities: probabilitySemantics, /** The selected answer may be absent even when probabilities are present. */ abstention: boolean(), minOptions: positiveInteger.optional(), maxOptions: positiveInteger.optional(), maxImageOptions: positiveInteger.optional(), requiresCriteria: boolean().optional() }).refine((e) => e.minOptions === void 0 || e.maxOptions === void 0 || e.minOptions <= e.maxOptions); const questions = object({ boolean: question.optional(), choice: question.optional(), score: question.optional(), sort: question.optional(), tags: question.optional(), box: question.optional() }).refine((e) => Object.values(e).some(Boolean)); const reasoningMode = _enum([ "auto", "off", "on" ]); const reasoning = object({ modes: array(reasoningMode).min(1).max(3).refine((e) => new Set(e).size === e.length), default: reasoningMode.optional(), questionTypes: questionTypes.optional(), /** Execution metadata is different from generated reasoning text. */ metadata: boolean().optional() }).refine((e) => e.default === void 0 || e.modes.includes(e.default)); const billingSource = _enum([ "provider-docs", "provider-catalog", "configured" ]); const billing = discriminatedUnion("unit", [object({ unit: literal("tokens"), source: billingSource, /** Omitted rates are unknown; explicit zero is a published free token bucket. */ usdPerMillion: object({ input: number().nonnegative().finite().optional(), output: number().nonnegative().finite().optional() }).optional() }), object({ unit: _enum(["decision-units", "requests"]), source: billingSource, usdPerMillion: never().optional() })]); /** Provider-declared facts for one physical route; never execution or grounding authority. */ const ModelInferenceCapabilitiesSchema = object({ /** Explicit declarations never infer chat support from text encoding or structured output. */ chat: boolean(), decision: object({ /** Provider-owned wire adapter identifier, not an endpoint or credential identity. */ protocol: string().max(64).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/), input: array(_enum(["text", "image"])).min(1).max(2).refine((e) => new Set(e).size === e.length), /** Absent means undeclared kinds/semantics, not an invented support claim. */ questions: questions.optional(), confidence: _enum(["provider-specific", "none"]).optional(), reasoning: reasoning.optional(), /** Support only. A request still needs explicit shared policy for extra egress/billing. */ grounding: object({ webSearch: boolean(), questionTypes: questionTypes.optional() }).optional(), limits: object({ maxQuestions: positiveInteger.optional(), maxRequestTokens: positiveInteger.optional(), maxStateAndQuestionTokens: positiveInteger.optional(), maxInputTokens: positiveInteger.optional(), inputTokenScope: _enum(["encoded-question", "state-plus-each-criterion"]).optional(), image: object({ maxBytes: positiveInteger, mimeTypes: array(_enum([ "image/png", "image/jpeg", "image/webp" ])).min(1).max(3), remoteUrls: boolean() }).optional() }).optional(), billing: billing.optional() }).refine((e) => { const supported = (t) => e.questions === void 0 || e.questions[t] !== void 0; return (e.reasoning?.questionTypes?.every(supported) ?? true) && (e.grounding?.questionTypes?.every(supported) ?? true) && (e.limits?.image === void 0 || e.input.includes("image")); }).optional() }); //#endregion export { ModelInferenceCapabilitiesSchema as t };