omniai 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ab654a67cbbe8a0fca968721a942c14a0e70a1bc0b0ca894c3b63c737e75bde
4
- data.tar.gz: 7cea942027a5864ff5a62c7eeb9b53295fc8729d8b167360aff15b1c641ee8cb
3
+ metadata.gz: 5d80d0c802d1e6b92ece7abe8ef3f9fadf055d517e361f94a7560ac8919009d3
4
+ data.tar.gz: 7dd1f751f9285684211e1bb4045cc8fcc500b09bc2fe58fa7083e739dadb0083
5
5
  SHA512:
6
- metadata.gz: 8053636d067f6c1a09d746a3fcaa4b4d1a873d89ed105149a7eb9fa5a370c21f13bece4b7edf83f0529f442aa7abaaef860bb2e81309d25313c53eef92fbb32e
7
- data.tar.gz: 4d59606ebee19692a25f68b58542105260770dc73ff97b4b96bd6171758b1c3981533e8b6b8e114310f1cc2de1a91be2978a2a7bf39bf77a3d0986e8bb39da5f
6
+ metadata.gz: 3a42a1d89fdf659bce635c37e8a59072099a4595202fd8768a46310addfa46ca66ea030b791e8260c860b4dcf754bbe6e89beda84fe5582262252641a3b890ae
7
+ data.tar.gz: 3c44cde5d4b0d5d98b9f7b6cccfcb209ed695c8e69293e354ddc50dbaf4cb4c6d5be995cf596f55dd5c0fcbe2ccd629a41a20145a4fe472e977ea36188217dc1
data/README.md CHANGED
@@ -456,23 +456,23 @@ client = OmniAI::OpenAI::Client.new(timeout: {
456
456
 
457
457
  ### 💬 Chat
458
458
 
459
- Clients that support chat (e.g. Anthropic w/ "Claude", Google w/ "Gemini", Mistral w/ "LeChat", OpenAI w/ "ChatGPT", etc) generate completions using the following calls:
459
+ Clients that support chat (e.g. Anthropic w/ "Claude", Google w/ "Gemini", Mistral w/ "LeChat", OpenAI w/ "ChatGPT", etc) generate text using the following calls:
460
460
 
461
- #### Completions using a Simple Prompt
461
+ #### Using a Basic Prompt
462
462
 
463
- Generating a completion is as simple as sending in the text:
463
+ A chat response can be generated using a string for a prompt:
464
464
 
465
465
  ```ruby
466
- completion = client.chat('Tell me a joke.')
467
- completion.text # 'Why don't scientists trust atoms? They make up everything!'
466
+ response = client.chat('Tell me a joke.')
467
+ response.text # 'Why don't scientists trust atoms? They make up everything!'
468
468
  ```
469
469
 
470
- #### Completions using a Complex Prompt
470
+ #### Using a Complex Prompt
471
471
 
472
- More complex completions are generated using a block w/ various system / user messages:
472
+ A chat response can be generated using a combination of messages and parts for a prompt:
473
473
 
474
474
  ```ruby
475
- completion = client.chat do |prompt|
475
+ response = client.chat do |prompt|
476
476
  prompt.system 'You are a helpful assistant with an expertise in animals.'
477
477
  prompt.user do |message|
478
478
  message.text 'What animals are in the attached photos?'
@@ -481,12 +481,12 @@ completion = client.chat do |prompt|
481
481
  message.file('./hamster.jpeg', "image/jpeg")
482
482
  end
483
483
  end
484
- completion.text # 'They are photos of a cat, a cat, and a hamster.'
484
+ response.text # 'They are photos of a cat, a cat, and a hamster.'
485
485
  ```
486
486
 
487
- #### Completions using Streaming via Proc
487
+ #### Streaming via Proc
488
488
 
489
- A real-time stream of messages can be generated by passing in a proc:
489
+ A chat real-time stream of chunks can be generated with a proc:
490
490
 
491
491
  ```ruby
492
492
  stream = proc do |chunk|
@@ -495,25 +495,25 @@ end
495
495
  client.chat('Tell me a joke.', stream:)
496
496
  ```
497
497
 
498
- #### Completion using Streaming via IO
498
+ #### Streaming via IO
499
499
 
500
- The above code can also be supplied with any IO object (e.g., `File`, `$stdout`, `$stdin`, etc.):
500
+ A chat real-time stream of chunks can also work with any IO object (e.g., `File`, `$stdout`, `$stdin`, etc.):
501
501
 
502
502
  ```ruby
503
503
  client.chat('Tell me a story', stream: $stdout)
504
504
  ```
505
505
 
506
- #### Completion with Tools
506
+ #### Using Tools
507
507
 
508
- A chat can also be initialized using tools:
508
+ The chat API can be provided with a set of tools to be invoked:
509
509
 
510
510
  ```ruby
511
511
  class WeatherTool
512
512
  description "Lookup the weather at a location in either Celsius or Fahrenheit."
513
513
 
514
- parameter :location, :string, description: "The location to find the weather."
515
- parameter :unit, :string, enum: %w[Celsius Fahrenheit], description: "The unit of measurement."
516
- required %i[location]
514
+ parameter :location, :string, description: "The location to find the weather.", nullable: false
515
+ parameter :unit, :string, enum: %w[Celsius Fahrenheit], description: "The unit of measurement.", nullable: true
516
+ required %i[location unit]
517
517
 
518
518
  # @param location [String]
519
519
  # @param unit [String] "Celsius" or "Fahrenheit"
@@ -16,7 +16,7 @@ module OmniAI
16
16
  # })
17
17
  # array.serialize # => { type: "array", items: { ... }, minItems: 1, maxItems: 5 }
18
18
  # array.parse([{ "name" => "Ringo Starr" }]) # => [{ name: "Ringo Star" }]
19
- class Array
19
+ class Array < Base
20
20
  TYPE = "array"
21
21
 
22
22
  # @!attribute [rw] items
@@ -31,41 +31,29 @@ module OmniAI
31
31
  # @return [Integer, nil]
32
32
  attr_accessor :min_items
33
33
 
34
- # @!attribute [rw] description
35
- # @return [String, nil]
36
- attr_accessor :description
37
-
38
- # @example
39
- # array = OmniAI::Schema::Array.deserialize({
40
- # type: "array",
41
- # items: { type: "string" },
42
- # minItems: 1,
43
- # maxItems: 5,
44
- # description: "A list of strings."
45
- # }) # => OmniAI::Schema::Array
46
- #
47
- # @param data [Hash]
48
- #
49
- # @return [OmniAI::Schema::Array]
50
- def self.deserialize(data)
51
- new(
52
- items: OmniAI::Schema.deserialize(data["items"] || data[:items]),
53
- max_items: data[:maxItems] || data["maxItems"],
54
- min_items: data[:minItems] || data["minItems"],
55
- description: data[:description] || data["description"]
56
- )
57
- end
58
-
59
34
  # @param items [OmniAI::Schema::Object, OmniAI::Schema::Array, OmniAI::Schema::Scalar] required
35
+ # @param title [String] optional
36
+ # @param description [String] optional
37
+ # @param nullable [Boolean] optional
60
38
  # @param min_items [Integer] optional
61
39
  # @param max_items [Integer] optional
62
- # @param description [String] optional
63
- def initialize(items:, min_items: nil, max_items: nil, description: nil)
64
- super()
40
+ def initialize(items:, title: nil, description: nil, min_items: nil, max_items: nil, nullable: nil)
41
+ super(title:, description:, nullable:)
65
42
  @items = items
66
43
  @min_items = min_items
67
44
  @max_items = max_items
68
- @description = description
45
+ end
46
+
47
+ # @example
48
+ # array.parse(["1", "2", "3"]) # => [1, 2, 3]
49
+ #
50
+ # @param data [Array]
51
+ #
52
+ # @return [Array]
53
+ def parse(data)
54
+ return data if data.nil? && nullable?
55
+
56
+ data.map { |arg| @items.parse(arg) }
69
57
  end
70
58
 
71
59
  # @example
@@ -76,7 +64,7 @@ module OmniAI
76
64
  # @return [Hash]
77
65
  def serialize(additional_properties: false)
78
66
  {
79
- type: TYPE,
67
+ type: nullify(TYPE),
80
68
  description: @description,
81
69
  items: @items.serialize(additional_properties:),
82
70
  maxItems: @max_items,
@@ -85,13 +73,27 @@ module OmniAI
85
73
  end
86
74
 
87
75
  # @example
88
- # array.parse(["1", "2", "3"]) # => [1, 2, 3]
76
+ # array = OmniAI::Schema::Array.deserialize({
77
+ # type: "array",
78
+ # items: { type: "string" },
79
+ # minItems: 1,
80
+ # maxItems: 5,
81
+ # description: "A list of strings."
82
+ # }) # => OmniAI::Schema::Array
89
83
  #
90
- # @param data [Array]
84
+ # @param data [Hash]
91
85
  #
92
- # @return [Array]
93
- def parse(data)
94
- data.map { |arg| @items.parse(arg) }
86
+ # @return [OmniAI::Schema::Array]
87
+ def self.deserialize(data)
88
+ nullable = Array(data[:type] || data["type"]).include?("null")
89
+
90
+ new(
91
+ items: OmniAI::Schema.deserialize(data["items"] || data[:items]),
92
+ max_items: data[:maxItems] || data["maxItems"],
93
+ min_items: data[:minItems] || data["minItems"],
94
+ description: data[:description] || data["description"],
95
+ nullable:
96
+ )
95
97
  end
96
98
  end
97
99
  end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module Schema
5
+ # @example
6
+ # object = OmniAI::Tool::Base.deserialize({ ... })
7
+ # object.serialize # => { ... }
8
+ # object.parse(...]
9
+ class Base
10
+ # @!attribute [rw] title
11
+ # @return [String, nil]
12
+ attr_accessor :title
13
+
14
+ # @!attribute [rw] description
15
+ # @return [String, nil]
16
+ attr_accessor :description
17
+
18
+ # @param title [String] optional
19
+ # @param description [String] optional
20
+ # @param nullable [Boolean] optional
21
+ def initialize(title: nil, description: nil, nullable: nil)
22
+ super()
23
+ @title = title
24
+ @description = description
25
+ @nullable = nullable
26
+ end
27
+
28
+ # @param value [Object]
29
+ # @return Object
30
+ def parse(value)
31
+ raise NotImplementedError, "#parse undefined"
32
+ end
33
+
34
+ # @param additional_properties [Boolean]
35
+ #
36
+ # @return [Hash]
37
+ def serialize(additional_properties: false)
38
+ raise NotImplementedError, "#serialize undefined"
39
+ end
40
+
41
+ # @param data [Hash]
42
+ #
43
+ # @return [OmniAI::Schema::Base]
44
+ def self.deserialize(data)
45
+ raise NotImplementedError, ".deserialize undefined"
46
+ end
47
+
48
+ # @return [Boolean]
49
+ def nullable?
50
+ !!@nullable
51
+ end
52
+
53
+ # @return [OmniAI::Schema::Base]
54
+ def nullable
55
+ dup.tap do |object|
56
+ object.nullable = true
57
+ end
58
+ end
59
+
60
+ def nonnullable
61
+ dup.tap do |object|
62
+ object.nullable = false
63
+ end
64
+ end
65
+
66
+ protected
67
+
68
+ def nullify(type)
69
+ nullable? ? ["null", type] : type
70
+ end
71
+ end
72
+ end
73
+ end
@@ -12,7 +12,7 @@ module OmniAI
12
12
  # })
13
13
  # schema.serialize #=> { type: "object", properties: { ... }, required: %i[name] }
14
14
  # schema.parse({ "name" => "John Doe" }) #=> { name: "John Doe" }
15
- class Object
15
+ class Object < Base
16
16
  TYPE = "object"
17
17
 
18
18
  # @!attribute [rw] properties
@@ -23,43 +23,13 @@ module OmniAI
23
23
  # @return [Array<String>]
24
24
  attr_accessor :required
25
25
 
26
- # @!attribute [rw] title
27
- # @return [String, nil]
28
- attr_accessor :title
29
-
30
- # @!attribute [rw] description
31
- # @return [String, nil]
32
- attr_accessor :description
33
-
34
- # @example
35
- # OmniAI::Schema::Object.deserialize({
36
- # type: "object",
37
- # properties: {
38
- # name: { type: "string" }
39
- # },
40
- # required: ["name"],
41
- # }) # => OmniAI::Schema::Object
42
- #
43
- # @param data [Hash]
44
- #
45
- # @return [OmniAI::Schema::Object]
46
- def self.deserialize(data)
47
- title = data["title"] || data[:title]
48
- description = data["description"] || data[:description]
49
- properties = (data["properties"] || data[:properties]).transform_values { |i| OmniAI::Schema.deserialize(i) }
50
- required = data["required"] || data[:required] || []
51
-
52
- new(title:, description:, properties:, required:)
53
- end
54
-
55
26
  # @param title [String] optional
56
27
  # @param description [String] optional
57
28
  # @param properties [Hash] optional
58
29
  # @param required [Array<String>] optional
59
- def initialize(title: nil, description: nil, properties: {}, required: [])
60
- super()
61
- @title = title
62
- @description = description
30
+ # @param nulable [Boolean] optional
31
+ def initialize(title: nil, description: nil, properties: {}, required: [], nullable: nil)
32
+ super(title:, description:, nullable:)
63
33
  @properties = properties
64
34
  @required = required
65
35
  end
@@ -70,16 +40,32 @@ module OmniAI
70
40
  title: @title,
71
41
  description: @description,
72
42
  properties: @properties.dup,
73
- required: @required.dup
43
+ required: @required.dup,
44
+ nullable: @nullable
74
45
  )
75
46
  end
76
47
 
48
+ # @param data [Hash]
49
+ #
50
+ # @return [Hash]
51
+ def parse(data)
52
+ return if data.nil? && nullable?
53
+
54
+ result = {}
55
+ @properties.each do |name, property|
56
+ value = data[String(name)]
57
+ result[name.intern] = property.parse(value) unless value.nil?
58
+ end
59
+ result
60
+ end
61
+
77
62
  # @param additional_properties [Boolean, nil] optional
63
+ # @param require_all [Boolean, nil] optional
78
64
  #
79
65
  # @return [Hash]
80
66
  def serialize(additional_properties: false)
81
67
  {
82
- type: TYPE,
68
+ type: nullify(TYPE),
83
69
  title: @title,
84
70
  description: @description,
85
71
  properties: @properties.transform_values { |value| value.serialize(additional_properties:) },
@@ -88,21 +74,26 @@ module OmniAI
88
74
  }.compact
89
75
  end
90
76
 
91
- # @param name [Symbol]
92
- def property(name, ...)
93
- @properties[name] = OmniAI::Schema::Scalar.build(...)
94
- end
95
-
77
+ # @example
78
+ # OmniAI::Schema::Object.deserialize({
79
+ # type: "object",
80
+ # properties: {
81
+ # name: { type: "string" }
82
+ # },
83
+ # required: ["name"],
84
+ # }) # => OmniAI::Schema::Object
85
+ #
96
86
  # @param data [Hash]
97
87
  #
98
- # @return [Hash]
99
- def parse(data)
100
- result = {}
101
- @properties.each do |name, property|
102
- value = data[String(name)]
103
- result[name.intern] = property.parse(value) unless value.nil?
104
- end
105
- result
88
+ # @return [OmniAI::Schema::Object]
89
+ def self.deserialize(data)
90
+ nullable = Array(data["type"] || data[:type]).include?("null")
91
+ title = data["title"] || data[:title]
92
+ description = data["description"] || data[:description]
93
+ properties = (data["properties"] || data[:properties]).transform_values { |i| OmniAI::Schema.deserialize(i) }
94
+ required = data["required"] || data[:required] || []
95
+
96
+ new(title:, description:, properties:, required:, nullable:)
106
97
  end
107
98
  end
108
99
  end
@@ -22,7 +22,7 @@ module OmniAI
22
22
  # scalar.serialize #=> { type: "boolean" }
23
23
  # scalar.parse(true) #=> true
24
24
  # scalar.parse(false) #=> false
25
- class Scalar
25
+ class Scalar < Base
26
26
  module Type
27
27
  BOOLEAN = "boolean"
28
28
  INTEGER = "integer"
@@ -34,14 +34,14 @@ module OmniAI
34
34
  # @return [String]
35
35
  attr_accessor :type
36
36
 
37
- # @!attribute [rw] description
38
- # @return [String, nil]
39
- attr_accessor :description
40
-
41
37
  # @!attribute [rw] enum
42
38
  # @return [Array<String>, nil]
43
39
  attr_accessor :enum
44
40
 
41
+ # @!attribute [rw] nullable
42
+ # @return [Boolean, nil]
43
+ attr_accessor :nullable
44
+
45
45
  # @example
46
46
  # property = OmniAI::Schema::Scalar.deserialize({
47
47
  # type: "string",
@@ -68,32 +68,39 @@ module OmniAI
68
68
  #
69
69
  # @return [OmniAI::Schema::Scalar]
70
70
  def self.deserialize(data)
71
- type = data["type"] || data[:type] || Type::STRING
71
+ types = Array(data["type"] || data[:type] || Type::STRING)
72
+ type = types.find { |type| !type.eql?("null") }
73
+ title = data["title"] || data[:title]
72
74
  description = data["description"] || data[:description]
73
75
  enum = data["enum"] || data[:enum]
74
76
 
75
- new(type:, description:, enum:)
77
+ new(type:, title:, description:, enum:, nullable: types.include?("null"))
76
78
  end
77
79
 
78
80
  # @param type [String] required - the type of the property
81
+ # @param title [String] optional - a title of the property
79
82
  # @param description [String] optional - a description of the property
80
83
  # @param enum [Array] optional - the possible values of the property
84
+ # @param nullable [Boolean] optional - if the property may be null
81
85
  #
82
86
  # @return [OmniAI::Schema::Scalar]
83
- def initialize(type:, description: nil, enum: nil)
84
- super()
87
+ def initialize(type:, title: nil, description: nil, enum: nil, nullable: nil)
88
+ super(title:, description:, nullable:)
85
89
  @type = type
86
- @description = description
87
90
  @enum = enum
88
91
  end
89
92
 
90
93
  # @example
91
94
  # property.serialize #=> { type: "string" }
92
95
  #
96
+ # @example
97
+ # property.serialize #=> { type: ["strig", "null"] }
98
+ #
93
99
  # @return [Hash]
94
100
  def serialize(*)
95
101
  {
96
- type: @type,
102
+ type: nullify(@type),
103
+ title: @title,
97
104
  description: @description,
98
105
  enum: @enum,
99
106
  }.compact
@@ -106,6 +113,8 @@ module OmniAI
106
113
  #
107
114
  # @return [String, Integer, Float, Boolean, Object]
108
115
  def parse(value)
116
+ return if value.nil? && nullable?
117
+
109
118
  case @type
110
119
  when Type::INTEGER then Integer(value)
111
120
  when Type::STRING then String(value)
data/lib/omniai/schema.rb CHANGED
@@ -47,7 +47,9 @@ module OmniAI
47
47
  #
48
48
  # @param data [OmniAI::Schema::Object, OmniAI::Schema::Array, OmniAI::Schema::Scalar]
49
49
  def self.deserialize(data)
50
- case data["type"] || data[:type]
50
+ type = Array(data["type"] || data[:type]).find { |type| !type.eql?("null") }
51
+
52
+ case type
51
53
  when OmniAI::Schema::Array::TYPE then OmniAI::Schema::Array.deserialize(data)
52
54
  when OmniAI::Schema::Object::TYPE then OmniAI::Schema::Object.deserialize(data)
53
55
  else OmniAI::Schema::Scalar.deserialize(data)
@@ -80,10 +82,11 @@ module OmniAI
80
82
  # @param min_items [Integer] optional - the minimum number of items
81
83
  # @param max_items [Integer] optional - the maximum number of items
82
84
  # @param description [String] optional - a description of the array
85
+ # @param nullable [Boolean] optional - if the array may be null
83
86
  #
84
87
  # @return [OmniAI::Schema::Array]
85
- def self.array(items:, min_items: nil, max_items: nil, description: nil)
86
- OmniAI::Schema::Array.new(items:, description:, min_items:, max_items:)
88
+ def self.array(items:, min_items: nil, max_items: nil, description: nil, nullable: nil)
89
+ OmniAI::Schema::Array.new(items:, description:, min_items:, max_items:, nullable:)
87
90
  end
88
91
 
89
92
  # @example
@@ -101,54 +104,63 @@ module OmniAI
101
104
  # @param properties [Hash<String, OmniAI::Schema::Scalar>] required - the properties of the object
102
105
  # @param required [Array<Symbol>] optional - the required properties
103
106
  # @param description [String] optional - a description of the object
107
+ # @param nullable [Boolean] optional - if the object may be null
104
108
  #
105
109
  # @return [OmniAI::Schema::Array]
106
- def self.object(title: nil, properties: {}, required: [], description: nil)
107
- OmniAI::Schema::Object.new(title:, properties:, required:, description:)
110
+ def self.object(title: nil, properties: {}, required: [], description: nil, nullable: nil)
111
+ OmniAI::Schema::Object.new(title:, properties:, required:, description:, nullable:)
108
112
  end
109
113
 
110
114
  # @example
111
115
  # OmniAI::Schema.boolean(description: "Is the person employed?") #=> OmniAI::Schema::Scalar
112
116
  #
117
+ # @param title [String] optional - the title of the property
113
118
  # @param description [String] optional - a description of the property
114
119
  # @param enum [Array<Boolean>] optional - the possible values of the property
120
+ # @param nullable [Boolean] optional - if the property may be null
115
121
  #
116
122
  # @return [OmniAI::Schema::Scalar]
117
- def self.boolean(description: nil, enum: nil)
118
- OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::BOOLEAN, description:, enum:)
123
+ def self.boolean(title: nil, description: nil, enum: nil, nullable: nil)
124
+ OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::BOOLEAN, title:, description:, enum:, nullable:)
119
125
  end
120
126
 
121
127
  # @example
122
128
  # OmniAI::Schema.integer(description: "The age of the person") #=> OmniAI::Schema::Scalar
123
129
  #
130
+ # @param title [String] optional - the title of the property
124
131
  # @param description [String] optional - a description of the property
125
- # @param enum [Array<Integer>] optinoal - the possible values of the property
132
+ # @param enum [Array<Integer>] optional - the possible values of the property
133
+ # @param nullable [Boolean] optional - if the property may be null
126
134
  #
127
135
  # @return [OmniAI::Schema::Scalar]
128
- def self.integer(description: nil, enum: nil)
129
- OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::INTEGER, description:, enum:)
136
+ def self.integer(title: nil, description: nil, enum: nil, nullable: nil)
137
+ OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::INTEGER, title:, description:, enum:, nullable:)
130
138
  end
131
139
 
132
140
  # @example
133
141
  # OmniAI::Schema.string(description: "The name of the person.") #=> OmniAI::Schema::Scalar
134
142
  #
143
+ # @param title [String] optional - the title of the property
135
144
  # @param description [String] optional - a description of the property
136
145
  # @param enum [Array<String>] optional - the possible values of the property
146
+ # @param nullable [Boolean] optional - if the property may be null
137
147
  #
138
148
  # @return [OmniAI::Schema::Scalar]
139
- def self.string(description: nil, enum: nil)
140
- OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::STRING, description:, enum:)
149
+ def self.string(title: nil, description: nil, enum: nil, nullable: nil)
150
+ OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::STRING, title:, description:, enum:, nullable:)
141
151
  end
142
152
 
143
153
  # @example
144
154
  # OmniAI::Schema.number(description: "The current temperature.") #=> OmniAI::Schema::Scalar
145
155
  #
156
+ # @param title [String] optional - the title of the property
146
157
  # @param description [String] optional - a description of the property
147
158
  # @param enum [Array<Number>] optional - the possible values of the property
159
+ # @param nullable [Boolean] optional - if the property may be null
148
160
  #
149
161
  # @return [OmniAI::Schema::Scalar]
150
- def self.number(description: nil, enum: nil)
151
- OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::NUMBER, description:, enum:)
162
+ def self.number(title: nil, description: nil, enum: nil, nullable: nil)
163
+ OmniAI::Schema::Scalar.new(type: OmniAI::Schema::Scalar::Type::NUMBER, title:, description:, enum:, nullable:)
152
164
  end
153
165
 
154
166
  # @example
@@ -156,6 +168,7 @@ module OmniAI
156
168
  #
157
169
  # @param name [String] required
158
170
  # @param schema [OmniAI::Schema::Object] required
171
+ # @param nullable [Boolean] optional
159
172
  #
160
173
  # @return [OmniAI::Schema::Format]
161
174
  def self.format(name:, schema:)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniAI
4
- VERSION = "3.1.0"
4
+ VERSION = "3.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
@@ -139,6 +139,7 @@ files:
139
139
  - lib/omniai/parse_error.rb
140
140
  - lib/omniai/schema.rb
141
141
  - lib/omniai/schema/array.rb
142
+ - lib/omniai/schema/base.rb
142
143
  - lib/omniai/schema/format.rb
143
144
  - lib/omniai/schema/object.rb
144
145
  - lib/omniai/schema/scalar.rb