concat method

  1. @override
LLMResult concat(
  1. LanguageModelResult<String> other
)
override

Merges this result with another by concatenating the outputs.

Implementation

@override
LLMResult concat(
  final LanguageModelResult<String> other,
) {
  return LLMResult(
    id: other.id,
    output: output + other.output,
    finishReason: finishReason != FinishReason.unspecified &&
            other.finishReason == FinishReason.unspecified
        ? finishReason
        : other.finishReason,
    metadata: {
      ...metadata,
      ...other.metadata,
    },
    usage: usage.concat(other.usage),
    streaming: other.streaming,
  );
}