GenAI.Tool.Schema.Enum
(GenAI Core v0.3.2)
Copy Markdown
Represents a schema for enum types, converting JSON schema attributes to Elixir struct fields.
Summary
Functions
Convert Json map to a GenAI.Tool.Schema.Enum struct, handling naming conventions.
Check if json is of type
Types
Functions
Convert Json map to a GenAI.Tool.Schema.Enum struct, handling naming conventions.
Examples
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
iex> GenAI.Tool.Schema.Enum.from_json(%{"type" => "number"})
{:error, :unrecognized_type}
Check if json is of type
Examples
Is of Type
iex> GenAI.Tool.Schema.Enum.is_type(%{"type" => "string", "enum" => ["value1", "value2"]})
trueNot of Type
iex> GenAI.Tool.Schema.Enum.is_type(%{"type" => "string"})
false