View Source GptAgent.Values.NonblankString (gpt_agent v3.1.0)

A message that a user has sent to the GPT agent

Summary

Functions

Creates a new instance of the type.

Types

@type t() :: %GptAgent.Values.NonblankString{value: String.t()}

Functions

@spec new(any()) :: {:ok, t()} | {:error, String.t()}

Creates a new instance of the type.

The function validates the value and returns a new struct if the value is valid. If the value is invalid, it returns an error tuple with the error message.

Params

  • value: The value to be validated and set in the struct.

Examples

iex> MyType.new("valid value")
%MyType{value: "valid value"}

iex> MyType.new("invalid value")
{:error, "error message"}