Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/classify/set"

Index

Functions

Functions

classifySet

  • classifySet(context: IContextMutable, target: ITargetImmutable, classification: IDataImmutable): IDataImmutable
  • Sets the result of a classification into a classify context

    example
    import { IContextMutable, IClassifyContextMutable } from '@ef-carbon/conversation';
    const context: IContextMutable = {};
    const classified: IClassifyContextMutable = {};
    for await (const { target, ...rest } of classify(input, targets)) {
      set(classified, target, { ...rest });
    }
    if (Object.keys(classified)) {
      context.response = classified;
    }

    Parameters

    • context: IContextMutable

      the classification context. This is a constrained version of the normal conversation context that is specific for representing classification outputs

    • target: ITargetImmutable

      the target that was classified

    • classification: IDataImmutable

      the classification data to set (or override)

    Returns IDataImmutable

    the set or updated data