View Source GptAgent.Value (gpt_agent v3.1.0)
A module that provides a macro to define a new type and its validation.
Summary
Functions
Macro to use GptAgent.Value in the current module.
Macro to define a new type.
Macro to define a validation function for the type.
Functions
Macro to use GptAgent.Value in the current module.
Examples
defmodule MyModule do
use GptAgent.Value
end
Macro to define a new type.
Examples
defmodule MyType do
use GptAgent.Value
type String.t()
end
Macro to define a validation function for the type.
Examples
defmodule MyType do
use GptAgent.Value
type String.t()
validate_with fn
value when is_binary(value) ->
case String.trim(value) do
"" -> {:error, "must be a nonblank string"}
_ -> :ok
end
end
end