Packages
langchain
0.3.0-rc.0
0.9.2
0.9.1
0.9.0
0.8.14
0.8.13
0.8.12
0.8.11
0.8.10
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.0
0.6.3
0.6.2
0.6.1
0.6.0
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.4.0-rc.3
0.4.0-rc.2
0.4.0-rc.1
0.4.0-rc.0
0.3.3
0.3.2
0.3.1
0.3.0
0.3.0-rc.2
0.3.0-rc.1
0.3.0-rc.0
0.2.0
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Elixir implementation of a LangChain style framework that lets Elixir projects integrate with and leverage LLMs.
Current section
Files
Jump to
Current section
Files
lib/langchain_error.ex
defmodule LangChain.LangChainError do
@moduledoc """
Exception used for raising LangChain specific errors.
It stores the `:message`. Passing an Ecto.Changeset with an error
converts the error into a string message.
raise LangChainError, changeset
raise LangChainError, "Message text"
"""
import LangChain.Utils, only: [changeset_error_to_string: 1]
alias __MODULE__
@type t :: %LangChainError{}
defexception [:message]
@doc """
Create the exception using either a message or a changeset who's errors are
converted to a message.
"""
@spec exception(message :: String.t() | Ecto.Changeset.t()) :: t()
def exception(message) when is_binary(message) do
%LangChainError{message: message}
end
def exception(%Ecto.Changeset{} = changeset) do
text_reason = changeset_error_to_string(changeset)
%LangChainError{message: text_reason}
end
end