lluminary 0.1.2 → 0.1.3

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,29 +1,43 @@
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.3
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
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
18
25
  - !ruby/object:Gem::Version
19
- version: '5.2'
26
+ version: 5.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk-bedrock
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ">="
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '5.2'
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: aws-sdk-bedrockruntime
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +150,20 @@ dependencies:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
152
  version: '6.2'
153
+ - !ruby/object:Gem::Dependency
154
+ name: awesome_print
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.9'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.9'
139
167
  description: 'Lluminary is a framework for building applications that leverage Large
140
168
  Language Models. It provides a structured way to define tasks, manage prompts, and
141
169
  handle LLM interactions.
@@ -149,7 +177,11 @@ extra_rdoc_files: []
149
177
  files:
150
178
  - lib/lluminary.rb
151
179
  - lib/lluminary/config.rb
152
- - lib/lluminary/field_description.rb
180
+ - lib/lluminary/models/base.rb
181
+ - lib/lluminary/models/bedrock/amazon_nova_pro_v1.rb
182
+ - lib/lluminary/models/bedrock/anthropic_claude_instant_v1.rb
183
+ - lib/lluminary/models/bedrock/base.rb
184
+ - lib/lluminary/models/openai/gpt35_turbo.rb
153
185
  - lib/lluminary/provider_error.rb
154
186
  - lib/lluminary/providers/base.rb
155
187
  - lib/lluminary/providers/bedrock.rb
@@ -165,13 +197,16 @@ files:
165
197
  - spec/examples/color_analyzer_spec.rb
166
198
  - spec/examples/content_analyzer_spec.rb
167
199
  - spec/examples/historical_event_analyzer_spec.rb
200
+ - spec/examples/meal_suggester_spec.rb
168
201
  - spec/examples/price_analyzer_spec.rb
169
202
  - spec/examples/quote_task_spec.rb
170
203
  - spec/examples/sentiment_analysis_spec.rb
171
204
  - spec/examples/summarize_text_spec.rb
172
205
  - spec/lluminary/config_spec.rb
173
- - spec/lluminary/field_description_spec.rb
174
- - spec/lluminary/providers/base_spec.rb
206
+ - spec/lluminary/models/base_spec.rb
207
+ - spec/lluminary/models/bedrock/amazon_nova_pro_v1_spec.rb
208
+ - spec/lluminary/models/bedrock/anthropic_claude_instant_v1_spec.rb
209
+ - spec/lluminary/models/openai/gpt35_turbo_spec.rb
175
210
  - spec/lluminary/providers/bedrock_spec.rb
176
211
  - spec/lluminary/providers/openai_spec.rb
177
212
  - 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