GenAI.Tool.Schema.Bool (GenAI Core v0.2.0)

Represents a schema for boolean types, converting JSON schema attributes to Elixir struct fields.

Link to this section Summary

Functions

Convert Json map to a GenAI.Tool.Schema.Bool struct, handling naming conventions.

Check if json is of type

Link to this section Functions

Link to this function

from_json(json)

Convert Json map to a GenAI.Tool.Schema.Bool struct, handling naming conventions.

examples

Examples

is-of-type

Is of Type

iex> GenAI.Tool.Schema.Bool.from_json(%{"type" => "boolean", "description" => "A boolean value"})
{:ok, %GenAI.Tool.Schema.Bool{description: "A boolean value"}}

not-of-type

Not of Type

iex> GenAI.Tool.Schema.Bool.from_json(%{"type" => "number"})
{:error, :unrecognized_type}

Check if json is of type

examples

Examples

is-of-type

Is of Type

iex> GenAI.Tool.Schema.Bool.is_type(%{"type" => "boolean"})
true

not-of-type

Not of Type

iex> GenAI.Tool.Schema.Bool.is_type(%{"type" => "string"})
false