Type alias LoadedModel

LoadedModel: {
    bias: Bias;
    cancel: (() => Promise<void>);
    decode: ((tokens) => string);
    encode: ((text) => number[]);
    generate: ((params, config?) => Promise<string>);
    totalTokenCount: number;
}

The loaded model to give to ad to create an ad context.

Type declaration

  • bias: Bias
  • cancel: (() => Promise<void>)
      • (): Promise<void>
      • Returns Promise<void>

  • decode: ((tokens) => string)
      • (tokens): string
      • Parameters

        • tokens: number[]

        Returns string

  • encode: ((text) => number[])
      • (text): number[]
      • Parameters

        • text: string

        Returns number[]

  • generate: ((params, config?) => Promise<string>)
      • (params, config?): Promise<string>
      • Parameters

        • params: {
              preprompt?: string;
              priorCompletion: string;
              prompt: string;
              stops: string[];
              system?: string;
          }
          • Optional preprompt?: string
          • priorCompletion: string
          • prompt: string
          • stops: string[]
          • Optional system?: string
        • Optional config: GenerateOptions

        Returns Promise<string>

  • totalTokenCount: number

Example

const { context, a, prompt } = ad(loadedModel)

Generated using TypeDoc