Class MessageRoleException

Thrown when the order of the messages role is not alternating between 'user' and 'assistant'.

Example

conversation.addMessage(new Message("user", "Hello!"));
conversation.addMessage(new Message("user", "How are you?")); // This throws a MessageRoleException

Hierarchy

  • Error
    • MessageRoleException

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Type declaration

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

Generated using TypeDoc