GenAI.Tool.Schema.Enum (GenAI Core v0.2.0)
Represents a schema for enum types, converting JSON schema attributes to Elixir struct fields.
Link to this section Summary
Functions
Convert Json map to a GenAI.Tool.Schema.Enum
struct, handling naming conventions.
Check if json is of type
Link to this section Types
Link to this section Functions
Link to this function
from_json(json)
Convert Json map to a GenAI.Tool.Schema.Enum
struct, handling naming conventions.
examples
Examples
is-of-type
Is of Type
iex> GenAI.Tool.Schema.Enum.from_json(%{"type" => "string", "enum" => ["value1", "value2"], "description" => "An enum value"})
{:ok, %GenAI.Tool.Schema.Enum{type: "string", enum: ["value1", "value2"], description: "An enum value"}}
not-of-type
Not of Type
iex> GenAI.Tool.Schema.Enum.from_json(%{"type" => "number"})
{:error, :unrecognized_type}
Link to this function
is_type(arg1)
Check if json is of type
examples
Examples
is-of-type
Is of Type
iex> GenAI.Tool.Schema.Enum.is_type(%{"type" => "string", "enum" => ["value1", "value2"]})
true
not-of-type
Not of Type
iex> GenAI.Tool.Schema.Enum.is_type(%{"type" => "string"})
false