rasti-ai 3.0.0 → 3.0.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: f40d9534d2254ebcf7efe528f42b7187841ee5eb96ff4b406fcfd6a27a7bdf79
4
- data.tar.gz: 87a8eb4fbcae1b57ae77c4a9676424b80bb8fbfd8d29e61bb89425c0ed5d5d32
3
+ metadata.gz: 53a61c4811f7fc87198609ce9311d5208d5e6a3dfb3a616c40e17c2c8bb99e5d
4
+ data.tar.gz: 96314ebda147f3cfbf79e2c096fd33783a02d1038b8e233ef45e26121642d54a
5
5
  SHA512:
6
- metadata.gz: cfc8303f52540e6c6058df5d7a7fe353e5bffd88a6b9122f789066877d0b8a87e7fb5daef1c78db740e54e159c2877dd6ea6540a080eed1a4feb2a1f466326ba
7
- data.tar.gz: 745f6ea9e9e2a95497514e1330feccebd3a7660709477f43fce3a6dfb03193d8f18f8012a44a976ed574dd4267d4b6979a59c970655e1a6580ef50291ccdd28d
6
+ metadata.gz: 2265c2a95f49854abef4259cec47b93e1e587f1e9397f547244c94f16d8cb3c4b31feba616275658beed6569267ec6398687d61478698ab396943e7c62e0b5cc
7
+ data.tar.gz: d7b8bd65dc9cda869ac6515a05e9eb93c9ff32affbad5a90669d0c0f5e363303ed0322944a06e2b668fa789370b8815b825382884644bb3519c19029a6d171da
@@ -66,7 +66,7 @@ module Rasti
66
66
  when :integer then {type: 'integer'}
67
67
  when :float then {type: 'number'}
68
68
  when :boolean then {type: 'boolean'}
69
- when :time then {type: 'string', format: 'date'}
69
+ when :time then json_schema_for_time_format(type_hash[:format])
70
70
  when :enum then {type: 'string', enum: type_hash[:values]}
71
71
  when :array then {type: 'array', items: json_schema_for_type(type_hash[:items])}
72
72
  when :model then json_schema_from_model_schema(type_hash[:schema])
@@ -79,6 +79,21 @@ module Rasti
79
79
  description.split("\n").map(&:strip).join(' ').strip
80
80
  end
81
81
 
82
+ def json_schema_for_time_format(format)
83
+ return {type: 'string'} unless format.is_a?(::String)
84
+
85
+ has_date = format.include?('%F') || format.include?('%Y')
86
+ has_time = format.include?('%T') || format.include?('%H')
87
+
88
+ if has_date && has_time
89
+ {type: 'string', format: 'date-time'}
90
+ elsif has_date
91
+ {type: 'string', format: 'date'}
92
+ else
93
+ {type: 'string'}
94
+ end
95
+ end
96
+
82
97
  end
83
98
  end
84
99
  end
@@ -1,5 +1,5 @@
1
1
  module Rasti
2
2
  module AI
3
- VERSION = '3.0.0'
3
+ VERSION = '3.0.1'
4
4
  end
5
5
  end
@@ -115,7 +115,7 @@ describe Rasti::AI::ToolSerializer do
115
115
  tool_class.verify
116
116
  end
117
117
 
118
- it 'Time' do
118
+ it 'Time with date and time' do
119
119
  form_class = Rasti::Form[timestamp: Rasti::Types::Time['%Y-%m-%dT%H:%M:%S%z']]
120
120
 
121
121
  tool_class = build_tool_class form_class
@@ -123,7 +123,37 @@ describe Rasti::AI::ToolSerializer do
123
123
  serialization = serializer.serialize tool_class
124
124
 
125
125
  expeted_serialization = build_serializaton param_name: 'timestamp', param_type: 'string'
126
- expeted_serialization[:inputSchema][:properties][:timestamp][:format] = 'date'
126
+ expeted_serialization[:inputSchema][:properties][:timestamp][:format] = 'date-time'
127
+
128
+ assert_equal expeted_serialization, serialization
129
+
130
+ tool_class.verify
131
+ end
132
+
133
+ it 'Time with milliseconds and timezone' do
134
+ form_class = Rasti::Form[started_at: Rasti::Types::Time['%FT%T.%L%z']]
135
+
136
+ tool_class = build_tool_class form_class
137
+
138
+ serialization = serializer.serialize tool_class
139
+
140
+ expeted_serialization = build_serializaton param_name: 'started_at', param_type: 'string'
141
+ expeted_serialization[:inputSchema][:properties][:started_at][:format] = 'date-time'
142
+
143
+ assert_equal expeted_serialization, serialization
144
+
145
+ tool_class.verify
146
+ end
147
+
148
+ it 'Time with date only' do
149
+ form_class = Rasti::Form[day: Rasti::Types::Time['%Y-%m-%d']]
150
+
151
+ tool_class = build_tool_class form_class
152
+
153
+ serialization = serializer.serialize tool_class
154
+
155
+ expeted_serialization = build_serializaton param_name: 'day', param_type: 'string'
156
+ expeted_serialization[:inputSchema][:properties][:day][:format] = 'date'
127
157
 
128
158
  assert_equal expeted_serialization, serialization
129
159
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rasti-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-23 00:00:00.000000000 Z
11
+ date: 2026-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_require