BamlClientFinishReasonError

The BamlClientFinishReasonError class represents an error that occurs when an LLM terminates with a disallowed finish reason.

Type Definition

Type Definition
1class BamlClientFinishReasonError extends Error {
2 type: 'BamlClientFinishReasonError'
3 message: string
4 prompt: string
5 raw_output: string
6}

Properties

type
'BamlClientFinishReasonError'

Literal type identifier for the error class.

message
string

Error message describing the specific finish reason that caused the termination.

prompt
string

The original prompt sent to the LLM.

raw_output
string

The partial output received from the LLM before termination.

Type Guards

The error can be identified using TypeScript’s instanceof operator:

Type Check
1if (error instanceof BamlClientFinishReasonError) {
2 // Handle finish reason error
3}
Built with