View Source LangChain.Utils (LangChain v0.1.0)

Collection of helpful utilities mostly for internal use.

Summary

Functions

Return changeset errors as text with comma separated description.

Only add the key to the map if the value is present. When the value is a list, the key will not be added when the list is empty.

Translates an error message using gettext.

Translates the errors for a field from a keyword list of errors.

Functions

Link to this function

changeset_error_to_string(changeset)

View Source

Return changeset errors as text with comma separated description.

Link to this function

conditionally_add_to_map(map, key, value)

View Source
@spec conditionally_add_to_map(
  %{required(atom()) => any()},
  key :: atom(),
  value :: nil | list()
) :: %{
  required(atom()) => any()
}

Only add the key to the map if the value is present. When the value is a list, the key will not be added when the list is empty.

Translates an error message using gettext.

Link to this function

translate_errors(errors, field)

View Source

Translates the errors for a field from a keyword list of errors.