functai for TypeScript - v0.1.0
    Preparing search index...

    Function module

    • A module: your code that calls AI functions, as a program with a declared interface. input and output (or outputs) say what it takes and gives, as ai() does, and are checked on every call (InterfaceError); run gets the inputs by name (a left-out input takes its default), and the call's signal. uses lists the AI functions and modules it calls, so its version changes when they are improved. A field t.opaque() takes values with no JSON form, unchecked.

      Type Parameters

      • I extends Fields
      • O extends Fields | undefined = undefined
      • A extends FieldSpec | undefined = undefined

      Parameters

      • name: string
      • spec: ModuleSpec<I, O, A>
      • run: (
            inputs: {
                [K in string | number | symbol]: (
                    { [K in string
                    | number
                    | symbol]: ValueOf<I[K]> } & {
                        [K in string | number | symbol]?: Exclude<ValueOf<I[K]>, undefined>
                    }
                )[K]
            },
            context: ModuleContext,
        ) => ModuleResult<O, A> | Promise<ModuleResult<O, A>>

      Returns Module<
          {
              [K in string
              | number
              | symbol]: (
                  { [K in string
                  | number
                  | symbol]: InputValueOf<I[K]> } & {
                      [K in string | number | symbol]?: InputValueOf<I[K]>
                  }
              )[K]
          },
          ModuleResult<O, A>,
      >