Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

538 B
Raw Blame
import type { TextStreamPart, ToolSet } from "ai";

/**
 * Message metadata is useful at stream and step boundaries. Returning it for
 * every text/reasoning/tool chunk causes the whole growing telemetry snapshot
 * to be serialized repeatedly into the SSE response.
 */
export const shouldEmitAssistantMessageMetadata = (part: Pick<TextStreamPart<ToolSet>, "type">) => {
  switch (part.type) {
    case "start":
    case "start-step":
    case "finish-step":
    case "finish":
      return true;
    default:
      return false;
  }
};