lluminary 0.1.2 → 0.1.4

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.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lluminary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Hughes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-16 00:00:00.000000000 Z
11
+ date: 2025-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '9'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,23 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '9'
33
+ - !ruby/object:Gem::Dependency
34
+ name: aws-sdk-bedrock
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: aws-sdk-bedrockruntime
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +72,20 @@ dependencies:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
74
  version: '6.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: awesome_print
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.9'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.9'
55
89
  - !ruby/object:Gem::Dependency
56
90
  name: dotenv
57
91
  requirement: !ruby/object:Gem::Requirement
@@ -149,7 +183,11 @@ extra_rdoc_files: []
149
183
  files:
150
184
  - lib/lluminary.rb
151
185
  - lib/lluminary/config.rb
152
- - lib/lluminary/field_description.rb
186
+ - lib/lluminary/models/base.rb
187
+ - lib/lluminary/models/bedrock/amazon_nova_pro_v1.rb
188
+ - lib/lluminary/models/bedrock/anthropic_claude_instant_v1.rb
189
+ - lib/lluminary/models/bedrock/base.rb
190
+ - lib/lluminary/models/openai/gpt35_turbo.rb
153
191
  - lib/lluminary/provider_error.rb
154
192
  - lib/lluminary/providers/base.rb
155
193
  - lib/lluminary/providers/bedrock.rb
@@ -165,13 +203,16 @@ files:
165
203
  - spec/examples/color_analyzer_spec.rb
166
204
  - spec/examples/content_analyzer_spec.rb
167
205
  - spec/examples/historical_event_analyzer_spec.rb
206
+ - spec/examples/meal_suggester_spec.rb
168
207
  - spec/examples/price_analyzer_spec.rb
169
208
  - spec/examples/quote_task_spec.rb
170
209
  - spec/examples/sentiment_analysis_spec.rb
171
210
  - spec/examples/summarize_text_spec.rb
172
211
  - spec/lluminary/config_spec.rb
173
- - spec/lluminary/field_description_spec.rb
174
- - spec/lluminary/providers/base_spec.rb
212
+ - spec/lluminary/models/base_spec.rb
213
+ - spec/lluminary/models/bedrock/amazon_nova_pro_v1_spec.rb
214
+ - spec/lluminary/models/bedrock/anthropic_claude_instant_v1_spec.rb
215
+ - spec/lluminary/models/openai/gpt35_turbo_spec.rb
175
216
  - spec/lluminary/providers/bedrock_spec.rb
176
217
  - spec/lluminary/providers/openai_spec.rb
177
218
  - spec/lluminary/providers/test_spec.rb
@@ -1,153 +0,0 @@
1
- # frozen_string_literal: true
2
- module Lluminary
3
- # Represents a field in a schema with its type, description, and validations.
4
- # Used to generate human-readable descriptions and validate field values.
5
- class FieldDescription
6
- def initialize(name, field)
7
- @name = name
8
- @type = field[:type]
9
- @description = field[:description]
10
- @validations = field[:validations] || []
11
- end
12
-
13
- def to_s
14
- parts = []
15
- parts << "#{@name} (#{type_description})"
16
- parts << ": #{@description}" if @description
17
- if validation_descriptions.any?
18
- parts << " (#{validation_descriptions.join(", ")})"
19
- end
20
- parts.join
21
- end
22
-
23
- def to_schema_s
24
- parts = []
25
- parts << "#{@name} (#{type_description})"
26
- parts << ": #{@description}" if @description
27
- if validation_descriptions.any?
28
- parts << "\nValidation: #{validation_descriptions.join(", ")}"
29
- end
30
- parts << "\nExample: #{example_value}"
31
- parts.join
32
- end
33
-
34
- private
35
-
36
- def type_description
37
- case @type
38
- when :datetime
39
- "datetime in ISO8601 format"
40
- else
41
- @type.to_s
42
- end
43
- end
44
-
45
- def validation_descriptions
46
- @validations
47
- .map do |_, options|
48
- case options.keys.first
49
- when :absence
50
- "must be absent"
51
- when :comparison
52
- comparison_descriptions(options[:comparison])
53
- when :exclusion
54
- "must not be one of: #{options[:exclusion][:in].join(", ")}"
55
- when :format
56
- "must match format: #{options[:format][:with]}"
57
- when :inclusion
58
- "must be one of: #{options[:inclusion][:in].join(", ")}"
59
- when :length
60
- length_descriptions(options[:length])
61
- when :numericality
62
- numericality_descriptions(options[:numericality])
63
- when :presence
64
- "must be present"
65
- end
66
- end
67
- .compact
68
- end
69
-
70
- def comparison_descriptions(options)
71
- descriptions = []
72
- if options[:greater_than]
73
- descriptions << "must be greater than #{options[:greater_than]}"
74
- end
75
- if options[:greater_than_or_equal_to]
76
- descriptions << "must be greater than or equal to #{options[:greater_than_or_equal_to]}"
77
- end
78
- if options[:equal_to]
79
- descriptions << "must be equal to #{options[:equal_to]}"
80
- end
81
- if options[:less_than]
82
- descriptions << "must be less than #{options[:less_than]}"
83
- end
84
- if options[:less_than_or_equal_to]
85
- descriptions << "must be less than or equal to #{options[:less_than_or_equal_to]}"
86
- end
87
- if options[:other_than]
88
- descriptions << "must be other than #{options[:other_than]}"
89
- end
90
- descriptions.join(", ")
91
- end
92
-
93
- def length_descriptions(options)
94
- descriptions = []
95
- if options[:minimum]
96
- descriptions << "must be at least #{options[:minimum]} characters"
97
- end
98
- if options[:maximum]
99
- descriptions << "must be at most #{options[:maximum]} characters"
100
- end
101
- if options[:is]
102
- descriptions << "must be exactly #{options[:is]} characters"
103
- end
104
- if options[:in]
105
- descriptions << "must be between #{options[:in].min} and #{options[:in].max} characters"
106
- end
107
- descriptions.join(", ")
108
- end
109
-
110
- def numericality_descriptions(options)
111
- descriptions = []
112
- if options[:greater_than]
113
- descriptions << "must be greater than #{options[:greater_than]}"
114
- end
115
- if options[:greater_than_or_equal_to]
116
- descriptions << "must be greater than or equal to #{options[:greater_than_or_equal_to]}"
117
- end
118
- if options[:equal_to]
119
- descriptions << "must be equal to #{options[:equal_to]}"
120
- end
121
- if options[:less_than]
122
- descriptions << "must be less than #{options[:less_than]}"
123
- end
124
- if options[:less_than_or_equal_to]
125
- descriptions << "must be less than or equal to #{options[:less_than_or_equal_to]}"
126
- end
127
- if options[:other_than]
128
- descriptions << "must be other than #{options[:other_than]}"
129
- end
130
- if options[:in]
131
- descriptions << "must be in: #{options[:in].to_a.join(", ")}"
132
- end
133
- descriptions << "must be odd" if options[:odd]
134
- descriptions << "must be even" if options[:even]
135
- descriptions.join(", ")
136
- end
137
-
138
- def example_value
139
- case @type
140
- when :string
141
- "\"your #{@name} here\""
142
- when :integer
143
- "0"
144
- when :datetime
145
- "\"2024-01-01T12:00:00+00:00\""
146
- when :boolean
147
- "true"
148
- when :float
149
- "0.0"
150
- end
151
- end
152
- end
153
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
- require "spec_helper"
3
-
4
- RSpec.describe Lluminary::FieldDescription do
5
- describe "#to_s" do
6
- it "generates a description for a string field" do
7
- field = { type: :string, description: "A test field" }
8
- description = described_class.new("test_field", field)
9
- expect(description.to_s).to eq("test_field (string): A test field")
10
- end
11
-
12
- it "generates a description for a field without a description" do
13
- field = { type: :integer }
14
- description = described_class.new("count", field)
15
- expect(description.to_s).to eq("count (integer)")
16
- end
17
-
18
- it "includes validation descriptions when present" do
19
- field = {
20
- type: :string,
21
- description: "A test field",
22
- validations: [
23
- [{}, { length: { minimum: 5, maximum: 10 } }],
24
- [{}, { format: { with: "/^[A-Z]+$/" } }]
25
- ]
26
- }
27
- description = described_class.new("test_field", field)
28
- expected = <<~DESCRIPTION.chomp
29
- test_field (string): A test field (must be at least 5 characters, must be at most 10 characters, must match format: /^[A-Z]+$/)
30
- DESCRIPTION
31
- expect(description.to_s).to eq(expected)
32
- end
33
- end
34
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
- require "lluminary"
3
-
4
- RSpec.describe Lluminary::Providers::Base do
5
- describe "#initialize" do
6
- it "accepts configuration options" do
7
- config = { api_key: "test_key", model: "test_model" }
8
- provider = described_class.new(**config)
9
- expect(provider.config).to eq(config)
10
- end
11
- end
12
-
13
- describe "#call" do
14
- it "raises NotImplementedError" do
15
- expect do
16
- described_class.new.call("test", double("Task"))
17
- end.to raise_error(NotImplementedError)
18
- end
19
- end
20
- end