class AI::Provider::InvalidPromptError

Overview

Error thrown when a prompt is invalid.

This error should be thrown by providers when they cannot process a prompt due to structural or content issues.

Defined in:

ai/provider/errors/invalid_prompt_error.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class AI::Provider::AISDKError

name : String name, to_s(io : IO) : Nil to_s

Constructor methods inherited from class AI::Provider::AISDKError

new(*, name : String, message : String, cause : Exception | Nil = nil) new

Class methods inherited from class AI::Provider::AISDKError

instance?(error) : Bool instance?

Constructor Detail

def self.new(*, prompt, message : String, cause : Exception | Nil = nil) #

Creates a new InvalidPromptError.

Parameters:

  • prompt: The invalid prompt value (any type)
  • message: Description of why the prompt is invalid
  • cause: Optional underlying exception

[View source]

Class Method Detail

def self.instance?(error) : Bool #

Checks if the given value is an instance of InvalidPromptError.


[View source]

Instance Method Detail

def prompt : JSON::Any | Nil #

The invalid prompt value. Stored as JSON::Any to handle any type.


[View source]