sublayer 0.0.8 → 0.0.9
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 +4 -4
- data/lib/sublayer/version.rb +1 -1
- metadata +3 -7
- data/lib/sublayer/generators/examples/code_from_blueprint_generator.rb +0 -30
- data/lib/sublayer/generators/examples/code_from_description_generator.rb +0 -26
- data/lib/sublayer/generators/examples/description_from_code_generator.rb +0 -23
- data/lib/sublayer/generators/examples/invalid_to_valid_json_generator.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0353b3446a610be215fd6fb1da6fbbf4bcf256de04ac5be24fb1e81da4c30aa5
|
4
|
+
data.tar.gz: 71a807c0e6d9aeb6c5af1a8b8d96fb6cbf3613064afebbb2a8af1f7aab469749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71a12929da5eea7c578bb682d2fa76e3293bc8ae288581ad33b5267f762ac7c454b61e3794ce386000b82013f1c76907f74a79efb8fe231148d756aefc8a0174
|
7
|
+
data.tar.gz: 49527df3972fa76c9e9e4bae501571264d440c95a082f29c9df68402803eecfc88d78b07531f6e5baa4e5a24a8a0532ae5744279db4e7fc2cf226969508f25ac
|
data/lib/sublayer/version.rb
CHANGED
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.9
|
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-05-
|
11
|
+
date: 2024-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-openai
|
@@ -181,10 +181,6 @@ files:
|
|
181
181
|
- lib/sublayer/components/output_adapters.rb
|
182
182
|
- lib/sublayer/components/output_adapters/single_string.rb
|
183
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
|
188
184
|
- lib/sublayer/providers/claude.rb
|
189
185
|
- lib/sublayer/providers/gemini.rb
|
190
186
|
- lib/sublayer/providers/groq.rb
|
@@ -216,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
212
|
- !ruby/object:Gem::Version
|
217
213
|
version: '0'
|
218
214
|
requirements: []
|
219
|
-
rubygems_version: 3.3
|
215
|
+
rubygems_version: 3.5.3
|
220
216
|
signing_key:
|
221
217
|
specification_version: 4
|
222
218
|
summary: A model-agnostic Ruby GenerativeAI DSL and Framework
|
@@ -1,30 +0,0 @@
|
|
1
|
-
class CodeFromBlueprintGenerator < Sublayer::Generators::Base
|
2
|
-
llm_output_adapter type: :single_string,
|
3
|
-
name: "generated_code",
|
4
|
-
description: "The generated code for the description"
|
5
|
-
|
6
|
-
def initialize(blueprint_description:, blueprint_code:, description:)
|
7
|
-
@blueprint_description = blueprint_description
|
8
|
-
@blueprint_code = blueprint_code
|
9
|
-
@description = description
|
10
|
-
end
|
11
|
-
|
12
|
-
def generate
|
13
|
-
super
|
14
|
-
end
|
15
|
-
|
16
|
-
def prompt
|
17
|
-
<<-PROMPT
|
18
|
-
You are an expert programmer and are great at looking at and understanding existing patterns and applying them to new situations.
|
19
|
-
|
20
|
-
The blueprint we're working with is: #{@blueprint_description}.
|
21
|
-
The code for that blueprint is:
|
22
|
-
#{@blueprint_code}
|
23
|
-
|
24
|
-
You need to use the blueprint above and modify it so that it satisfied the following description:
|
25
|
-
#{@description}
|
26
|
-
|
27
|
-
Take a deep breath and think step by step before you start coding.
|
28
|
-
PROMPT
|
29
|
-
end
|
30
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
class CodeFromDescriptionGenerator < Sublayer::Generators::Base
|
2
|
-
llm_output_adapter type: :single_string,
|
3
|
-
name: "generated_code",
|
4
|
-
description: "The generated code in the requested language"
|
5
|
-
|
6
|
-
def initialize(description:, technologies:)
|
7
|
-
@description = description
|
8
|
-
@technologies = technologies
|
9
|
-
end
|
10
|
-
|
11
|
-
def generate
|
12
|
-
super
|
13
|
-
end
|
14
|
-
|
15
|
-
def prompt
|
16
|
-
<<-PROMPT
|
17
|
-
You are an expert programmer in #{@technologies.join(", ")}.
|
18
|
-
|
19
|
-
You are tasked with writing code using the following technologies: #{@technologies.join(", ")}.
|
20
|
-
|
21
|
-
The description of the task is #{@description}
|
22
|
-
|
23
|
-
Take a deep breath and think step by step before you start coding.
|
24
|
-
PROMPT
|
25
|
-
end
|
26
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class DescriptionFromCodeGenerator < Sublayer::Generators::Base
|
2
|
-
llm_output_adapter type: :single_string,
|
3
|
-
name: "code_description",
|
4
|
-
description: "A description of what the code in the file does"
|
5
|
-
|
6
|
-
def initialize(code:)
|
7
|
-
@code = code
|
8
|
-
end
|
9
|
-
|
10
|
-
def generate
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
def prompt
|
15
|
-
<<-PROMPT
|
16
|
-
You are an experienced software engineer. Below is a chunk of code:
|
17
|
-
|
18
|
-
#{@code}
|
19
|
-
|
20
|
-
Please read the code carefully and provide a high-level description of what this code does, including its purpose, functionalities, and any noteworthy details.
|
21
|
-
PROMPT
|
22
|
-
end
|
23
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class InvalidToValidJsonGenerator < Sublayer::Generators::Base
|
2
|
-
llm_output_adapter type: :single_string,
|
3
|
-
name: "valid_json",
|
4
|
-
description: "The valid JSON string"
|
5
|
-
|
6
|
-
def initialize(invalid_json:)
|
7
|
-
@invalid_json = invalid_json
|
8
|
-
end
|
9
|
-
|
10
|
-
def generate
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
def prompt
|
15
|
-
<<-PROMPT
|
16
|
-
You are an expert in JSON parsing.
|
17
|
-
|
18
|
-
The given string is not a valid JSON: #{@invalid_json}
|
19
|
-
|
20
|
-
Please fix this and produce a valid JSON.
|
21
|
-
PROMPT
|
22
|
-
end
|
23
|
-
end
|