class

OpenAI::FunctionParameters

Inherits JSON::Serializable < Reference < Object

The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.

Omitting parameters defines a function with an empty parameter list.

Constructors

new(type : String = "object", properties : Hash(String, JSON::Any) = Hash(String, JSON::Any).new, required : Array(String) = [] of String, additional_properties : Bool | Hash(String, JSON::Any) | Nil = nil, pattern_properties : Hash(String, JSON::Any) | Nil = nil, min_properties : Int32 | Nil = nil, max_properties : Int32 | Nil = nil, dependencies : Hash(String, JSON::Any) | Nil = nil, property_names : Hash(String, JSON::Any) | Nil = nil, title : String | Nil = nil, description : String | Nil = nil, default : JSON::Any | Nil = nil, examples : Array(JSON::Any) | Nil = nil, enum __arg0 : Array(JSON::Any) | Nil = nil, const : JSON::Any | Nil = nil, all_of : Array(Hash(String, JSON::Any)) | Nil = nil, any_of : Array(Hash(String, JSON::Any)) | Nil = nil, one_of : Array(Hash(String, JSON::Any)) | Nil = nil, not : Hash(String, JSON::Any) | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Class methods

from_type(type : T.class) forall T

Helper method to create a schema from a Crystal type using json-schema shard

Source
simple_schema(properties : Hash(String, Hash(String, JSON::Any)), required : Array(String) = [] of String)

Helper method to create a simple parameter schema

Source

Instance methods

additional_properties
Source
additional_properties=(additional_properties : Bool | Hash(String, JSON::Any) | Nil)
Source
all_of
Source
all_of=(all_of : Array(Hash(String, JSON::Any)) | Nil)
Source
any_of
Source
any_of=(any_of : Array(Hash(String, JSON::Any)) | Nil)
Source
const
Source
const=(const : JSON::Any | Nil)
Source
default
Source
default=(default : JSON::Any | Nil)
Source
dependencies
Source
dependencies=(dependencies : Hash(String, JSON::Any) | Nil)
Source
description
Source
description=(description : String | Nil)
Source
enum
Source
enum=(enum __arg0 : Array(JSON::Any) | Nil)
Source
examples
Source
examples=(examples : Array(JSON::Any) | Nil)
Source
max_properties
Source
max_properties=(max_properties : Int32 | Nil)
Source
min_properties
Source
min_properties=(min_properties : Int32 | Nil)
Source
not=(not : Hash(String, JSON::Any) | Nil)
Source
one_of
Source
one_of=(one_of : Array(Hash(String, JSON::Any)) | Nil)
Source
pattern_properties
Source
pattern_properties=(pattern_properties : Hash(String, JSON::Any) | Nil)
Source
properties
Source
properties=(properties : Hash(String, JSON::Any))
Source
property_names
Source
property_names=(property_names : Hash(String, JSON::Any) | Nil)
Source
required
Source
required=(required : Array(String))
Source
title

Additional JSON Schema fields

Source
title=(title : String | Nil)

Additional JSON Schema fields

Source
type

The JSON Schema object defining the function parameters

Source
type=(type : String)

The JSON Schema object defining the function parameters

Source