Z ZPI 文档 v0.3.8
介绍页

源码

packages/ai/src/utils/option-map/types.ts

typescript26 行查看原文
// Adapted from ZCode packages/model-option-map (Apache-2.0).
export type JsonPrimitive = string | number | boolean | null;
export type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];

export interface JsonObject {
  readonly [key: string]: JsonValue;
}

export type RestrictedCelValue = string | number;
export type ModelOptionName = "reasoningLevel" | "maxOutputTokens";

export interface ModelOptionMapProgram {
  readonly source: string;
  evaluate(input: RestrictedCelValue): JsonObject;
}

export class RestrictedCelError extends Error {
  readonly offset: number;

  constructor(message: string, offset: number) {
    super(`${message} at offset ${offset}`);
    this.name = "RestrictedCelError";
    this.offset = offset;
  }
}