sublayer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/sublayer/components/output_adapters.rb +15 -1
- data/lib/sublayer/providers/claude.rb +1 -1
- data/lib/sublayer/providers/open_ai.rb +1 -1
- data/lib/sublayer/version.rb +1 -1
- data/sublayer.gemspec +4 -1
- metadata +35 -6
- /data/{examples → lib/sublayer/generators/examples}/code_from_blueprint_generator.rb +0 -0
- /data/{examples → lib/sublayer/generators/examples}/code_from_description_generator.rb +0 -0
- /data/{examples → lib/sublayer/generators/examples}/description_from_code_generator.rb +0 -0
- /data/{examples → lib/sublayer/generators/examples}/invalid_to_valid_json_generator.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07ead9b290805b3d7e173f8e613dd4670bdd304a094cb7a00505ac9d94285b9b
|
4
|
+
data.tar.gz: 89eba4a05eebb012013a68e06f4d44e8a1710db0ea8a808ed03557241f4baf74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6f07414c4a7a2798f2b93133bd921cae8ffe380104f813564109ab16b985dd58c416f6b176f33d75910898b56d47ea98262a1f1035071cb29dddf2f53277b82
|
7
|
+
data.tar.gz: 45953c8a3a63c526bd310f4928a1570210e54e6e1be5718ff50b28041a8e9e93ca175d8d984ca6abd8aa729b87f5c84bf922e547c6a8f22ef62272bd240eade2
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Sublayer is model-agnostic and can be used with any AI model. Below are the
|
|
26
26
|
|
27
27
|
Expects you to have an OpenAI API key set in the `OPENAI_API_KEY` environment variable.
|
28
28
|
|
29
|
-
Visit [OpenAI](https://openai.com/product) to get an API key.
|
29
|
+
Visit [OpenAI](https://openai.com/product) to get an API key.
|
30
30
|
|
31
31
|
Usage:
|
32
32
|
```ruby
|
@@ -133,12 +133,12 @@ Generators are responsible for generating specific outputs based on input data.
|
|
133
133
|
They focus on a single generation task and do not perform any actions or complex
|
134
134
|
decision-making. Generators are the building blocks of the Sublayer framework.
|
135
135
|
|
136
|
-
Examples (in the /examples
|
137
|
-
- CodeFromDescriptionGenerator
|
136
|
+
Examples (in the `/lib/sublayer/generators/examples` directory):
|
137
|
+
- `CodeFromDescriptionGenerator`: Generates code based on a description and the
|
138
138
|
technologies used.
|
139
|
-
- DescriptionFromCodeGenerator
|
139
|
+
- `DescriptionFromCodeGenerator`: Generates a description of the code passed in to
|
140
140
|
it.
|
141
|
-
- CodeFromBlueprintGenerator
|
141
|
+
- `CodeFromBlueprintGenerator`: Generates code based on a blueprint, a blueprint
|
142
142
|
description, and a description of the desired code.
|
143
143
|
|
144
144
|
|
@@ -4,7 +4,21 @@ module Sublayer
|
|
4
4
|
attr_reader :name
|
5
5
|
|
6
6
|
def self.create(options)
|
7
|
-
|
7
|
+
klass = if options.has_key?(:class)
|
8
|
+
klass = options[:class]
|
9
|
+
if klass.is_a?(String)
|
10
|
+
klass.constantize
|
11
|
+
elsif klass.is_a?(Class)
|
12
|
+
klass
|
13
|
+
else
|
14
|
+
raise "Invalid :class option"
|
15
|
+
end
|
16
|
+
elsif (type = options[:type])
|
17
|
+
"Sublayer::Components::OutputAdapters::#{type.to_s.camelize}".constantize
|
18
|
+
else
|
19
|
+
raise "Output adapter must be specified with :class or :type"
|
20
|
+
end
|
21
|
+
klass.new(options)
|
8
22
|
end
|
9
23
|
end
|
10
24
|
end
|
@@ -30,7 +30,7 @@ module Sublayer
|
|
30
30
|
response = HTTParty.post(
|
31
31
|
"https://api.anthropic.com/v1/messages",
|
32
32
|
headers: {
|
33
|
-
"x-api-key": ENV
|
33
|
+
"x-api-key": ENV.fetch("ANTHROPIC_API_KEY"),
|
34
34
|
"anthropic-version": "2023-06-01",
|
35
35
|
"content-type": "application/json"
|
36
36
|
},
|
@@ -5,7 +5,7 @@ module Sublayer
|
|
5
5
|
module Providers
|
6
6
|
class OpenAI
|
7
7
|
def self.call(prompt:, output_adapter:)
|
8
|
-
client = ::OpenAI::Client.new(access_token: ENV
|
8
|
+
client = ::OpenAI::Client.new(access_token: ENV.fetch("OPENAI_API_KEY"))
|
9
9
|
|
10
10
|
response = client.chat(
|
11
11
|
parameters: {
|
data/lib/sublayer/version.rb
CHANGED
data/sublayer.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata["homepage_uri"] = "https://docs.sublayer.com"
|
18
18
|
spec.metadata["documentation_uri"] = "https://docs.sublayer.com"
|
19
19
|
spec.metadata["bug_tracker_uri"] = "https://github.com/sublayerapp/sublayer/issues"
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/sublayerapp/sublayer"
|
20
21
|
|
21
22
|
# Specify which files should be added to the gem when it is released.
|
22
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -37,6 +38,8 @@ Gem::Specification.new do |spec|
|
|
37
38
|
spec.add_dependency "httparty"
|
38
39
|
|
39
40
|
spec.add_development_dependency "rspec", "~> 3.12"
|
40
|
-
spec.add_development_dependency "pry", "
|
41
|
+
spec.add_development_dependency "pry", "~> 0.14"
|
42
|
+
spec.add_development_dependency "vcr", "~> 6.0"
|
43
|
+
spec.add_development_dependency "webmock", "~> 3.0"
|
41
44
|
spec.add_development_dependency "clag"
|
42
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sublayer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-openai
|
@@ -122,6 +122,34 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.14'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: vcr
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '6.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '6.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: webmock
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: clag
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,16 +175,16 @@ files:
|
|
147
175
|
- LICENSE
|
148
176
|
- README.md
|
149
177
|
- Rakefile
|
150
|
-
- examples/code_from_blueprint_generator.rb
|
151
|
-
- examples/code_from_description_generator.rb
|
152
|
-
- examples/description_from_code_generator.rb
|
153
|
-
- examples/invalid_to_valid_json_generator.rb
|
154
178
|
- lib/sublayer.rb
|
155
179
|
- lib/sublayer/actions/base.rb
|
156
180
|
- lib/sublayer/agents/base.rb
|
157
181
|
- lib/sublayer/components/output_adapters.rb
|
158
182
|
- lib/sublayer/components/output_adapters/single_string.rb
|
159
183
|
- lib/sublayer/generators/base.rb
|
184
|
+
- lib/sublayer/generators/examples/code_from_blueprint_generator.rb
|
185
|
+
- lib/sublayer/generators/examples/code_from_description_generator.rb
|
186
|
+
- lib/sublayer/generators/examples/description_from_code_generator.rb
|
187
|
+
- lib/sublayer/generators/examples/invalid_to_valid_json_generator.rb
|
160
188
|
- lib/sublayer/providers/claude.rb
|
161
189
|
- lib/sublayer/providers/gemini.rb
|
162
190
|
- lib/sublayer/providers/groq.rb
|
@@ -172,6 +200,7 @@ metadata:
|
|
172
200
|
homepage_uri: https://docs.sublayer.com
|
173
201
|
documentation_uri: https://docs.sublayer.com
|
174
202
|
bug_tracker_uri: https://github.com/sublayerapp/sublayer/issues
|
203
|
+
source_code_uri: https://github.com/sublayerapp/sublayer
|
175
204
|
post_install_message:
|
176
205
|
rdoc_options: []
|
177
206
|
require_paths:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|