GenAI.Tool.Schema.Number (GenAI Core v0.3.1)

Copy Markdown

Represents a schema for number types, including integers and floating-point numbers.

Summary

Functions

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

Check if json is of type

Types

t()

@type t() :: %GenAI.Tool.Schema.Number{
  description: String.t() | nil,
  exclusive_maximum: boolean() | nil,
  exclusive_minimum: boolean() | nil,
  maximum: float() | nil,
  minimum: float() | nil,
  multiple_of: float() | nil,
  type: String.t()
}

Functions

from_json(json)

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

Examples

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

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

is_type(arg1)

Check if json is of type

Examples

Is of Type

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

Not of Type

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