klue-langcraft 0.0.7 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e6e99cd20f8b4020ee4a895e32c4ffdbed6f4fcb92079db78c973337a73c570
4
- data.tar.gz: 9ac8b289d7d8d5aaa2dafec3d2181d278829df88714680cc986f4652a0d80273
3
+ metadata.gz: 6c27050239df45678f9bf8b8527c20f033532235d023cf22bd255b06f0f48b38
4
+ data.tar.gz: 22e0fab109f694eb0fc501885f38e94b8e0eae55da1e66381093fc8cedbece86
5
5
  SHA512:
6
- metadata.gz: f14b941d93e2b103efa214f50bc3d9b6b151b75a8dfbd7957dec78fd3bee113b1f8026d689d7974447f6b0819b546e0daf189990505e35e056acdd1811909853
7
- data.tar.gz: fe8998e329fbd0cc6bc84c30dee4d98a69dfebd28b8fe60ec4148a0633f11e52db3ec90f5b0cbc820399e38643bbf7799b4f88c2b8505a79db24a914feb63b78
6
+ metadata.gz: 78d038c2e19671fc645c02215820345d9a89f8552869f9eb2f0d0f6769e348bef56f218ff39114bd6f8945ef44001d928b1f5a0f4896e8510ffcebe6ad9f49a3
7
+ data.tar.gz: 80e94051e6ad5104cba4b199b472bbea3f62bdc23903a71974fb04d9399a92beb23627581ef30c9e02a0f8a821d1a9ef48cc9cb7a19a1cd223a1af95085b9c1c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.1.0](https://github.com/appydave/klue-langcraft/compare/v0.0.7...v0.1.0) (2024-09-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * add requirements documentation for sample parser ([c0dbe76](https://github.com/appydave/klue-langcraft/commit/c0dbe76f74d6f3d185a7eb37f507bd1e34578773))
7
+
8
+ ## [0.0.7](https://github.com/appydave/klue-langcraft/compare/v0.0.6...v0.0.7) (2024-09-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * update documentation for usecases ([077689e](https://github.com/appydave/klue-langcraft/commit/077689e085b667b3ac29dd2798b6b38e39a28923))
14
+
1
15
  ## [0.0.6](https://github.com/appydave/klue-langcraft/compare/v0.0.5...v0.0.6) (2024-09-20)
2
16
 
3
17
 
@@ -0,0 +1,105 @@
1
+ # DSL Examples
2
+
3
+ The following examples will build on top of one another to create an Agent as Code DSL designed for Agent Workflows.
4
+
5
+ The example workflow will ben implementation of the agent as code for YouTube Launch Optimization.
6
+
7
+ ### Root Node (#1).
8
+
9
+ The root node for a DSL is named `definition`, it behaves like any other `node` accept that you provide the DSL name.
10
+
11
+ An agentic workflow might take a name and optional description.
12
+
13
+ ```ruby
14
+ # Sample DSL
15
+ workflow :youtube_launch_optimizer, 'Optimize the video publishing for YouTube Titles, Descriptions, Thumbnails and social content' do
16
+ end
17
+ ```
18
+
19
+ ```ruby
20
+ # DSL Definition
21
+ definition :workflow do
22
+ param :name, type: :positional
23
+ param :description, type: :positional, default: nil
24
+ end
25
+ ```
26
+
27
+ ### Root Node (#2).
28
+
29
+ An agentic workflow might take a name only and use a child node for description using a self closing syntax.
30
+
31
+ ```ruby
32
+ # Sample DSL
33
+ workflow :youtube_launch_optimizer do
34
+ description 'Optimize the video publishing for YouTube Titles, Descriptions, Thumbnails and social content'
35
+ end
36
+ ```
37
+
38
+ ```ruby
39
+ # DSL Definition
40
+ definition :workflow do
41
+ param :name, type: :positional
42
+ node :description do
43
+ param :description, type: :positional
44
+ end
45
+ end
46
+ ```
47
+
48
+ ### Single Node with List (#3)
49
+
50
+ Here we have a single node called settings with a list of setting that contains a key and a value.
51
+ Notice `repeat: true` is used to indicate that the setting is a repeatable element.
52
+
53
+ ```ruby
54
+ # Sample DSL
55
+
56
+ workflow :youtube_launch_optimizer do
57
+ settings do
58
+ setting :prompt_path, 'prompts/youtube/launch_optimizer'
59
+ setting :default_llm, :gpt4o
60
+ end
61
+ end
62
+ ```
63
+
64
+ ```ruby
65
+ # DSL Definition
66
+ definition :workflow do
67
+ param :name, type: :positional
68
+ node :settings do
69
+ node :setting, repeat: true do
70
+ param :key, type: :positional
71
+ param :value, type: :positional
72
+ end
73
+ end
74
+ end
75
+ ```
76
+
77
+ ### Single Node with list - declaritve syntax (#4)
78
+
79
+ Like before, we have a single node called settings with a list of setting that contains a key and a value.
80
+ This time the you can use the method name as the first paramater value because it is of type declarative.
81
+ This can make some DSL usage a little easier to understand
82
+
83
+ ```ruby
84
+ # Sample DSL
85
+
86
+ workflow :youtube_launch_optimizer do
87
+ settings do
88
+ prompt_path 'prompts/youtube/launch_optimizer'
89
+ default_llm :gpt4o
90
+ end
91
+ end
92
+ ```
93
+
94
+ ```ruby
95
+ # DSL Definition
96
+ definition :workflow do
97
+ param :name, type: :positional
98
+ node :settings do
99
+ node :setting, repeat: true do
100
+ param :key, type: :declaritive # the method name typed in will be come the value for the key paramater
101
+ param :value, type: :positional
102
+ end
103
+ end
104
+ end
105
+ ```
data/docs/dsl-rules.md CHANGED
@@ -39,7 +39,6 @@ param :a, type: :positional # required: true
39
39
  param :b, type: :positional # required: true
40
40
  ```
41
41
 
42
-
43
42
  #### 2. Optional Parameters
44
43
  - **Description**: These are positional parameters with default values, making them optional.
45
44
  - **Ruby Example**: `def method(a = 1)`
@@ -154,109 +153,3 @@ A container can take parameters based on the defined styles, but they must follo
154
153
  5. The double splat parameter, if present, must be the last parameter.
155
154
  6. You can't have more than one splat or double splat parameter in a container.
156
155
  7. Once you start using keyword parameters, you can't use positional parameters anymore in that container.
157
-
158
- ## Examples
159
-
160
- The following examples will build on top of one another to create an Agent as Code DSL designed for Agent Workflows.
161
-
162
- The example workflow will ben implementation of the agent as code for YouTube Launch Optimization.
163
-
164
- ### Root Node (#1).
165
-
166
- The root node for a DSL is named `definition`, it behaves like any other `node` accept that you provide the DSL name.
167
-
168
- An agentic workflow might take a name and optional description.
169
-
170
- ```ruby
171
- # Sample DSL
172
- workflow :youtube_launch_optimizer, 'Optimize the video publishing for YouTube Titles, Descriptions, Thumbnails and social content' do
173
- end
174
- ```
175
-
176
- ```ruby
177
- # DSL Definition
178
- definition :workflow do
179
- param :name, type: :positional
180
- param :description, type: :positional, default: nil
181
- end
182
- ```
183
-
184
- ### Root Node (#2).
185
-
186
- An agentic workflow might take a name only and use a child node for description using a self closing syntax.
187
-
188
- ```ruby
189
- # Sample DSL
190
- workflow :youtube_launch_optimizer do
191
- description 'Optimize the video publishing for YouTube Titles, Descriptions, Thumbnails and social content'
192
- end
193
- ```
194
-
195
- ```ruby
196
- # DSL Definition
197
- definition :workflow do
198
- param :name, type: :positional
199
- node :description do
200
- param :description, type: :positional
201
- end
202
- end
203
- ```
204
-
205
- ### Single Node with List (#3)
206
-
207
- Here we have a single node called settings with a list of setting that contains a key and a value.
208
- Notice `repeat: true` is used to indicate that the setting is a repeatable element.
209
-
210
- ```ruby
211
- # Sample DSL
212
-
213
- workflow :youtube_launch_optimizer do
214
- settings do
215
- setting :prompt_path, 'prompts/youtube/launch_optimizer'
216
- setting :default_llm, :gpt4o
217
- end
218
- end
219
- ```
220
-
221
- ```ruby
222
- # DSL Definition
223
- definition :workflow do
224
- param :name, type: :positional
225
- node :settings do
226
- node :setting, repeat: true do
227
- param :key, type: :positional
228
- param :value, type: :positional
229
- end
230
- end
231
- end
232
- ```
233
-
234
- ### Single Node with list - declaritve syntax (#4)
235
-
236
- Like before, we have a single node called settings with a list of setting that contains a key and a value.
237
- This time the you can use the method name as the first paramater value because it is of type declarative.
238
- This can make some DSL usage a little easier to understand
239
-
240
- ```ruby
241
- # Sample DSL
242
-
243
- workflow :youtube_launch_optimizer do
244
- settings do
245
- prompt_path 'prompts/youtube/launch_optimizer'
246
- default_llm :gpt4o
247
- end
248
- end
249
- ```
250
-
251
- ```ruby
252
- # DSL Definition
253
- definition :workflow do
254
- param :name, type: :positional
255
- node :settings do
256
- node :setting, repeat: true do
257
- param :key, type: :declaritive # the method name typed in will be come the value for the key paramater
258
- param :value, type: :positional
259
- end
260
- end
261
- end
262
- ```
@@ -0,0 +1,4 @@
1
+ Printspeak DSL
2
+ Project Plan
3
+ Agent As Code
4
+ Make Chapters out of my recordings using a folder and glob pattern geared to my naming convention
@@ -0,0 +1,300 @@
1
+ dsl = Agent.create(:youtube_launch_optimizer) do
2
+ description 'This workflow optimizes video launch by analyzing, preparing, and generating content for various platforms.'
3
+ settings do
4
+ prompt_path Ad::AgentArchitecture.gem_relative_file('prompts/youtube/launch_optimizer')
5
+ default_llm :gpt4o
6
+ end
7
+
8
+ prompts do
9
+ prompt :video_summary_prompt , content: load_file('1-1-summarize-video.txt')
10
+ prompt :video_abridgement_prompt , content: load_file('1-2-1-abridge-video.txt')
11
+ prompt :abridgement_descrepencies_prompt , content: load_file('1-2-2-abridge-video-descrepencies.txt')
12
+ prompt :identify_chapters_prompt , content: load_file('2-1-identify-chapters.txt')
13
+ prompt :refine_chapters_prompt , content: load_file('2-2-refine-chapters.txt')
14
+ prompt :create_chapters_prompt , content: load_file('2-3-create-chapters.txt')
15
+ prompt :analyze_content_essence_prompt , content: load_file('3-1-analyze-content-essence.txt')
16
+ prompt :analyze_audience_engagement_prompt, content: load_file('3-2-analyze-audience-engagement.txt')
17
+ prompt :analyze_cta_competitors_prompt , content: load_file('3-3-analyze-cta-competitors.txt')
18
+ prompt :title_generation_prompt , content: load_file('4-1-generate-title.txt')
19
+ prompt :thumbnail_text_prompt , content: load_file('4-2-generate-thumbnail-text.txt')
20
+ prompt :thumbnail_visual_elements_prompt , content: load_file('4-3-thumbnail-visual-elements.txt')
21
+ prompt :yt_simple_description_prompt , content: load_file('5-1-yt-simple-description.txt')
22
+ prompt :yt_description_prompt , content: load_file('5-2-yt-write-description.txt')
23
+ prompt :yt_format_description_prompt , content: load_file('5-3-yt-format-description.txt')
24
+ prompt :yt_description_custom_gpt_prompt , content: load_file('5-4-yt-description-custom-gpt.txt')
25
+ prompt :yt_pinned_comment_prompt , content: load_file('5-5-yt-pinned-comment.txt')
26
+ prompt :yt_metadata_prompt , content: load_file('5-6-yt-meta-data.txt')
27
+ prompt :tweet_prompt , content: load_file('6-1-create-tweet.txt')
28
+ prompt :facebook_post_prompt , content: load_file('6-2-create-fb-post.txt')
29
+ prompt :linkedin_post_prompt , content: load_file('6-3-create-linkedin-post.txt')
30
+ end
31
+
32
+ attributes do
33
+ attribute :short_title, type: :string
34
+ attribute :transcript, type: :string
35
+ attribute :srt, type: :string
36
+ attribute :summary, type: :string
37
+ attribute :abridgement, type: :string
38
+ attribute :abridgement_descrepencies, type: :string
39
+ attribute :analyze_content_essence, type: :string
40
+ attribute :analyze_audience_engagement, type: :string
41
+ attribute :analyze_cta_competitors, type: :string
42
+ attribute :video_title, type: :string
43
+ attribute :video_url, type: :string
44
+ attribute :video_topic_theme, type: :string
45
+ attribute :video_related_links, type: :array
46
+ attribute :video_keywords, type: :array
47
+ attribute :video_description, type: :string
48
+ attribute :video_description_custom_gpt, type: :string
49
+ attribute :video_pinned_comment, type: :string
50
+ attribute :video_metadata, type: :string
51
+ attribute :content_highlights
52
+ attribute :identify_chapters, type: :string
53
+ attribute :refine_chapters, type: :string
54
+ attribute :chapters, type: :string
55
+ attribute :fold_cta, type: :string
56
+ attribute :primary_cta, type: :string
57
+ attribute :affiliate_cta, type: :array
58
+ attribute :brand_info, type: :string
59
+ attribute :title_ideas, type: :array
60
+ attribute :thumbnail_text, type: :string
61
+ attribute :thumbnail_visual_elements, type: :string
62
+ attribute :tweet_content, type: :string
63
+ attribute :facebook_post, type: :string
64
+ attribute :linkedin_post, type: :string
65
+ end
66
+
67
+ # Clean SRT
68
+ # Intro/Outro/Content Seperation
69
+ # Chapter Name Suggeestions
70
+ # B-Roll Suggestions
71
+ # section('Transcript Analysis') do
72
+ # step('')
73
+ # end
74
+
75
+ section('Video Preparation') do
76
+ step('Configure') do
77
+ input :brand_info
78
+ input :short_title
79
+ input :video_title
80
+ input :video_url
81
+ input :video_related_links
82
+ input :video_keywords
83
+ input :fold_cta
84
+ input :primary_cta
85
+ input :affiliate_cta
86
+ input :chapters
87
+ input :transcript
88
+ input :abridgement
89
+ input :summary
90
+ end
91
+
92
+ step('Script Summary') do
93
+ input :transcript
94
+ prompt :video_summary_prompt
95
+ output :summary
96
+ end
97
+
98
+ step('Script Abridgement') do
99
+ input :transcript
100
+ prompt :video_abridgement_prompt
101
+ output :abridgement
102
+ end
103
+
104
+ step('Abridge QA') do
105
+ input :transcript
106
+ input :abridgement
107
+ prompt :abridgement_descrepencies_prompt
108
+ output :abridgement_descrepencies
109
+ end
110
+ end
111
+
112
+ section('Build Chapters') do
113
+ step('Find Chapters') do
114
+ input :transcript
115
+ input :abridgement
116
+ prompt :identify_chapters_prompt
117
+ output :identify_chapters
118
+ end
119
+
120
+ step('Refine Chapters') do
121
+ input :identify_chapters
122
+ input :refine_chapters
123
+ prompt :refine_chapters_prompt
124
+ output :chapters
125
+ end
126
+
127
+ step('Create Chapters') do
128
+ input :chapters
129
+ input :srt
130
+ prompt :create_chapters_prompt
131
+ output :chapters
132
+ end
133
+ end
134
+
135
+ section('Content Analysis') do
136
+ step('Content Essence') do
137
+ input :abridgement
138
+ prompt :analyze_content_essence_prompt
139
+ output :analyze_content_essence
140
+ end
141
+
142
+ step('Audience Engagement') do
143
+ input :abridgement
144
+ prompt :analyze_audience_engagement_prompt
145
+ output :analyze_audience_engagement
146
+ end
147
+
148
+ step('CTA/Competitors') do
149
+ input :abridgement
150
+ prompt :analyze_cta_competitors_prompt
151
+ output :analyze_cta_competitors
152
+ end
153
+
154
+ # step('Analyze Video') do
155
+ # input :transcript
156
+ # prompt :analyze_content_essence_prompt
157
+ # output :video_topic
158
+ # output :video_keywords
159
+ # end
160
+ end
161
+
162
+ section('Title & Thumbnail') do
163
+ step('Title Ideas') do
164
+ input :short_title #
165
+ input :video_topic_theme # (Main Topic or Theme)
166
+ input :content_highlights # (Keywords/Insites/Takeaways/Audience-Related Insights)
167
+ prompt :title_generation_prompt
168
+ output :title_ideas
169
+ end
170
+
171
+ # Analyze Title Short List
172
+ # Here are the types of prompts or questions you've been writing:
173
+
174
+ # Title Analysis: Requesting evaluations of YouTube titles.
175
+ # Title Suggestions: Asking for new or varied title options.
176
+ # Title Optimization: Seeking ways to improve existing titles.
177
+ # Comparative Analysis: Comparing and analyzing different title versions.
178
+ # Content Strategy: Discussing factors influencing YouTube CTR.
179
+ # Instructional Requests: Asking for concise, actionable recommendations.
180
+ # These types cover the main focus areas of your queries related to optimizing and refining YouTube content titles.
181
+
182
+ step('Thumb Text Ideas') do
183
+ input :video_title
184
+ input :video_topic_theme
185
+ input :content_highlights
186
+ input :title_ideas
187
+ prompt :thumbnail_text_prompt
188
+ output :thumbnail_text
189
+ end
190
+
191
+ step('Visual Element Ideas') do
192
+ input :video_title
193
+ input :content_highlights
194
+ input :title_ideas
195
+ prompt :thumbnail_visual_elements_prompt
196
+ output :thumbnail_visual_elements
197
+ end
198
+
199
+ # Does the Title, Thumbnail Text and Visual Elements align with the content or is it misleading?
200
+ end
201
+
202
+ section('YouTube Meta Data') do
203
+ step('Simple Description') do
204
+ input :video_title
205
+ input :video_keywords
206
+ input :abridgement
207
+ prompt :yt_simple_description_prompt
208
+ output :video_simple_description
209
+ end
210
+
211
+ step('Write Description') do
212
+ input :video_title
213
+ input :chapters
214
+ input :video_simple_description
215
+ input :brand_info
216
+ input :fold_cta
217
+ input :primary_cta
218
+ input :affiliate_cta
219
+ input :video_related_links
220
+ input :video_keywords
221
+ prompt :yt_description_prompt
222
+ output :video_description
223
+ end
224
+
225
+ step('Format Description') do
226
+ input :video_description
227
+ prompt :yt_format_description_prompt
228
+ output :video_description
229
+ end
230
+
231
+ step('Custom GPT Description') do
232
+ input :video_title
233
+ input :chapters
234
+ input :abridgement
235
+ input :brand_info
236
+ input :fold_cta
237
+ input :primary_cta
238
+ input :affiliate_cta
239
+ input :video_related_links
240
+ input :video_keywords
241
+ prompt :yt_description_custom_gpt_prompt
242
+ output :video_description_custom_gpt
243
+ end
244
+
245
+ step('Pinned Comment') do
246
+ # I don't need all these, but not sure which ones I do need yet
247
+ input :video_title
248
+ input :abridgement
249
+ input :chapters
250
+ input :brand_info
251
+ input :fold_cta
252
+ input :primary_cta
253
+ input :affiliate_cta
254
+ input :video_related_links
255
+ input :video_keywords
256
+ input :video_description
257
+ prompt :yt_pinned_comment_prompt
258
+ output :video_pinned_comment
259
+ end
260
+
261
+ step('Extra Metadata') do
262
+ input :video_title
263
+ input :abridgement
264
+ prompt :yt_metadata_prompt
265
+ output :video_metadata
266
+ end
267
+ end
268
+
269
+ section('Social Media Posts') do
270
+ step('Create Tweet') do
271
+ input :video_title
272
+ input :video_link
273
+ input :video_keywords
274
+ input :summary
275
+ prompt :tweet_prompt
276
+ output :tweet_content
277
+ end
278
+
279
+ step('Create FB Post') do
280
+ input :summary
281
+ input :video_keywords
282
+ prompt :facebook_post_prompt
283
+ output :facebook_post
284
+ end
285
+
286
+ step('Create LinkedIn Post') do
287
+ input :video_title
288
+ input :video_link
289
+ input :video_keywords
290
+ input :abridgement
291
+ prompt :linkedin_post_prompt
292
+ output :linkedin_post
293
+ end
294
+ end
295
+ end
296
+
297
+ file = '/Users/davidcruwys/dev/sites/working-with-sean/gpt-agents/src/content/gpt-workflows/youtube-launch-optimizer.json'
298
+ dsl
299
+ .save
300
+ .save_json(file)
@@ -0,0 +1,132 @@
1
+ {
2
+ "definition": {
3
+ "name": "workflow",
4
+ "params": [
5
+ {
6
+ "name": "name",
7
+ "type": "positional"
8
+ }
9
+ ],
10
+ "nodes": [
11
+ {
12
+ "name": "description",
13
+ "params": [
14
+ {
15
+ "name": "description",
16
+ "type": "positional"
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "name": "settings",
22
+ "nodes": [
23
+ {
24
+ "name": "setting",
25
+ "repeat": true,
26
+ "params": [
27
+ {
28
+ "name": "key",
29
+ "type": "declarative"
30
+ },
31
+ {
32
+ "name": "value",
33
+ "type": "positional"
34
+ }
35
+ ]
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "name": "prompts",
41
+ "nodes": [
42
+ {
43
+ "name": "prompt",
44
+ "repeat": true,
45
+ "params": [
46
+ {
47
+ "name": "key",
48
+ "type": "positional"
49
+ },
50
+ {
51
+ "name": "content",
52
+ "type": "named",
53
+ "default": ""
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ "name": "section",
61
+ "repeat": true,
62
+ "params": [
63
+ {
64
+ "name": "name",
65
+ "type": "positional"
66
+ }
67
+ ],
68
+ "nodes": [
69
+ {
70
+ "name": "step",
71
+ "repeat": true,
72
+ "params": [
73
+ {
74
+ "name": "key",
75
+ "type": "positional"
76
+ }
77
+ ],
78
+ "nodes": [
79
+ {
80
+ "name": "input",
81
+ "repeat": true,
82
+ "params": [
83
+ {
84
+ "name": "key",
85
+ "type": "positional"
86
+ }
87
+ ]
88
+ },
89
+ {
90
+ "name": "prompt",
91
+ "params": [
92
+ {
93
+ "name": "key",
94
+ "type": "positional"
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "name": "output",
100
+ "repeat": true,
101
+ "params": [
102
+ {
103
+ "name": "key",
104
+ "type": "positional"
105
+ }
106
+ ]
107
+ }
108
+ ]
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ "name": "actions",
114
+ "nodes": [
115
+ {
116
+ "name": "save",
117
+ "params": []
118
+ },
119
+ {
120
+ "name": "save_json",
121
+ "params": [
122
+ {
123
+ "name": "path",
124
+ "type": "positional"
125
+ }
126
+ ]
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ }
132
+ }