effect-io-ai

Package: @effect/ai
Module: Response

Response.FinishPart

Response part indicating the completion of a response generation.

Example

import { Response } from "@effect/ai"

const finishPart: Response.FinishPart = Response.makePart("finish", {
  reason: "stop",
  usage: {
    inputTokens: 50,
    outputTokens: 25,
    totalTokens: 75
  }
})

Signature

export interface FinishPart extends BasePart<"finish", FinishPartMetadata> {
  /**
   * The reason why the model finished generating the response.
   */
  readonly reason: FinishReason
  /**
   * Token usage statistics for the request.
   */
  readonly usage: Usage
}

Source

Since v1.0.0