ContextError

org.llm4s.error.ContextError
See theContextError companion object
@Stable
final case class ContextError extends LLMError, NonRecoverableError

Context management related errors for token windows and conversation handling.

This is a NonRecoverableError. Build one with the smart constructors in the companion object. Its context map is "contextType" -> contextType plus the details entries.

Value parameters

contextType

short tag for the kind of context operation that failed (e.g. "tokenBudget"), stored in context under the key contextType

details

extra key/value pairs about the failure, merged into context; empty for constructors that set none

message

human-readable description of the failure

Attributes

Example
val error = ContextError.tokenBudgetExceeded(currentTokens = 1200, budget = 1000)
error.context("contextType")   // "tokenBudget"
error.context("currentTokens") // "1200"
Companion
object
Graph
Supertypes
trait LLMError
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def code: Option[String]

Optional error code for programmatic handling

Optional error code for programmatic handling

Attributes

Inherited from:
LLMError
def correlationId: Option[String]

Error correlation IDs for debugging

Error correlation IDs for debugging

Attributes

Inherited from:
LLMError
def formatted: String

Formatted error message with context

Formatted error message with context

Attributes

Inherited from:
LLMError
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

override val context: Map[String, String]

Additional context information

Additional context information

Attributes