GenAI.Tool.Schema.Number (GenAI Core v0.2.0)
Represents a schema for number types, including integers and floating-point numbers.
Link to this section Summary
Functions
Convert Json map to a GenAI.Tool.Schema.Number
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.Number
struct, handling naming conventions.
examples
Examples
is-of-type
Is of Type
iex> GenAI.Tool.Schema.Number.from_json(%{"type" => "number", "description" => "A number value"})
{:ok, %GenAI.Tool.Schema.Number{description: "A number value"}}
not-of-type
Not of Type
iex> GenAI.Tool.Schema.Number.from_json(%{"type" => "string"})
{: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.Number.is_type(%{"type" => "number"})
true
not-of-type
Not of Type
iex> GenAI.Tool.Schema.Number.is_type(%{"type" => "string"})
false