TagoIO SDK for JavaScript and TypeScript
    Preparing search index...

    Function parseAIGeneration

    • Reads an AI generation job from a callback Analysis scope.

      When a job started with callback reaches a final status, the API runs the callback Analysis with the job as scope[0]. If the API process running the job stops, the callback does not run. Returns the job with its dates parsed, or null when the value is not a generation job, for example when the Analysis also runs from other triggers.

      Type Parameters

      • T = unknown

      Parameters

      • value: unknown

      Returns AIGeneration<T>

      import { Analysis, Utils } from "@tago-io/sdk";
      import type { TagoContext } from "@tago-io/sdk";

      async function handleReport(context: TagoContext, scope: unknown[]) {
      const job = Utils.parseAIGeneration(scope[0]);
      if (job?.status === "completed") {
      console.log(job.output?.text);
      }
      }

      Analysis.use(handleReport);