LeXtract.Error.External.TokenizerLoad exception (lextract v0.1.2)

View Source

Error for tokenizer loading failures.

Raised when a tokenizer cannot be loaded from Hugging Face or when tokenizer initialization fails.

Examples

iex> error = LeXtract.Error.External.TokenizerLoad.exception(
...>   reason: "network timeout"
...> )
iex> Exception.message(error)
"Failed to load tokenizer: network timeout"

iex> error = LeXtract.Error.External.TokenizerLoad.exception(
...>   reason: "model not found",
...>   model_identifier: "invalid-model"
...> )
iex> String.contains?(Exception.message(error), "invalid-model")
true

Summary

Functions

Formats the error message for tokenizer loading failures.

Types

t()

@type t() :: %LeXtract.Error.External.TokenizerLoad{
  __exception__: true,
  bread_crumbs: term(),
  class: term(),
  model_identifier: String.t() | nil,
  path: term(),
  reason: String.t(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}

Functions

exception(args)

@spec exception(opts :: Keyword.t()) :: %LeXtract.Error.External.TokenizerLoad{
  __exception__: true,
  bread_crumbs: term(),
  class: term(),
  model_identifier: term(),
  path: term(),
  reason: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}

Create an Elixir.LeXtract.Error.External.TokenizerLoad without raising it.

Keys

  • :reason
  • :model_identifier

message(exception)

@spec message(t()) :: String.t()

Formats the error message for tokenizer loading failures.