openai_101 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.builders/_.rb +1 -0
- data/.builders/boot.rb +39 -0
- data/.builders/generators/01-bootstrap.rb +135 -0
- data/.releaserc.json +1 -1
- data/.rubocop.yml +7 -24
- data/.tool-versions +1 -1
- data/CHANGELOG.md +11 -11
- data/README.md +41 -65
- data/lib/openai_101/version.rb +1 -1
- data/lib/openai_101.rb +0 -11
- data/package-lock.json +2225 -1386
- data/package.json +2 -5
- metadata +11 -89
- data/bin/automate-chatgpt.js +0 -60
- data/bin/automate-midjourney.js +0 -75
- data/bin/convert_webp_to_png.rb +0 -86
- data/bin/gpt_context_gatherer.rb +0 -63
- data/course/course.md +0 -64
- data/course/images/beautiful-llm-models.png +0 -0
- data/course/images/prompts/beautiful-llm-models.txt +0 -1
- data/course/images/prompts/series-2-appydave-gpt-summit.txt +0 -1
- data/course/images/series-2-appydave-gpt-summit.png +0 -0
- data/gpt-context/openai-documentation.md +0 -498
- data/gpt-context/ruby-openai-documenation.md +0 -747
- data/gpt-context/theme-prompts.csv +0 -21
- data/lib/openai_101/config/openai.rb +0 -15
- data/lib/openai_101/tools/automate-images-chatgpt.js +0 -60
- data/lib/openai_101/tools/automate-images-midjourney.js +0 -75
- data/lib/openai_101/tools/bulk_image_bot/base_automator.js +0 -53
- data/lib/openai_101/tools/bulk_image_bot/chatgpt_automator.js +0 -27
- data/lib/openai_101/tools/bulk_image_bot/midjourney_automator.js +0 -49
- data/lib/openai_101/tools/clean_ruby_errors.rb +0 -274
- data/lib/openai_101/tools/edl_to_chapters.rb +0 -56
- data/lib/openai_101/tools/file_content_gatherer.rb +0 -36
- data/lib/openai_101/tools/webp_to_png.rb +0 -124
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 736a2e322937831de006aa62307bd82605fc2cb77d9e6558ae6899b637ec5c02
|
4
|
+
data.tar.gz: b6ff2b19719ea9314efc81579c29fe1f157cc26535ed74a0e99b45e9acc81707
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1140a2e1d2076876595ffa2e79d3195248e027b0599a9937ce2d2ca1b717324c5f1b409bfe2dcdb1b66c5cce167989a4d7c8440715886e22ab2e3e9a3dd2cc84
|
7
|
+
data.tar.gz: 6d81917562203fa94a619f3f00eac01ba3c4d9a8ecea46a70e6ac761b8439241bebaedd776ce0dd262ed0f2f642e8499c1d920690549890eb2f03c59440b4175
|
data/.builders/_.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# require_relative './path/here'
|
data/.builders/boot.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Boot Sequence
|
2
|
+
|
3
|
+
include KLog::Logging
|
4
|
+
|
5
|
+
CONFIG_KEY = :openai_101
|
6
|
+
|
7
|
+
log.kv 'working folder', Dir.pwd
|
8
|
+
|
9
|
+
KConfig.configure do |config|
|
10
|
+
config.handlebars.defaults.add_all_defaults
|
11
|
+
end
|
12
|
+
|
13
|
+
def k_builder
|
14
|
+
@k_builder ||= KBuilder::BaseBuilder.init(KConfig.configuration(CONFIG_KEY))
|
15
|
+
end
|
16
|
+
|
17
|
+
KConfig.configure(CONFIG_KEY) do |config|
|
18
|
+
builder_folder = Dir.pwd
|
19
|
+
base_folder = File.expand_path('../', builder_folder)
|
20
|
+
global_template = File.expand_path('~/dev/kgems/k_templates/templates')
|
21
|
+
|
22
|
+
config.template_folders.add(:global_template , global_template)
|
23
|
+
config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
|
24
|
+
|
25
|
+
config.target_folders.add(:app , base_folder)
|
26
|
+
config.target_folders.add(:builder , builder_folder)
|
27
|
+
end
|
28
|
+
|
29
|
+
KConfig.configuration(CONFIG_KEY).debug
|
30
|
+
|
31
|
+
area = KManager.add_area(CONFIG_KEY)
|
32
|
+
resource_manager = area.resource_manager
|
33
|
+
resource_manager
|
34
|
+
.fileset
|
35
|
+
.glob('*.rb', exclude: ['boot.rb'])
|
36
|
+
.glob('generators/**/*.rb')
|
37
|
+
resource_manager.add_resources
|
38
|
+
|
39
|
+
KManager.boot
|
@@ -0,0 +1,135 @@
|
|
1
|
+
KManager.action :bootstrap do
|
2
|
+
action do
|
3
|
+
application_name = :openai_101
|
4
|
+
|
5
|
+
# Ruby Gem Bootstrap
|
6
|
+
director = KDirector::Dsls::RubyGemDsl
|
7
|
+
.init(k_builder,
|
8
|
+
on_exist: :skip, # %i[skip write compare]
|
9
|
+
on_action: :queue # %i[queue execute]
|
10
|
+
)
|
11
|
+
.data(
|
12
|
+
ruby_version: '3.0',
|
13
|
+
application: application_name,
|
14
|
+
application_description: 'OpenAI 101 working through the API endpoints',
|
15
|
+
application_lib_path: application_name.to_s, # need a specialized handlebars helper to turn this into a path, e.g ps-common => ps/common
|
16
|
+
application_lib_namespace: 'Openai101',
|
17
|
+
namespaces: ['Openai101'],
|
18
|
+
author: 'David Cruwys',
|
19
|
+
author_email: 'david@ideasmen.com.au',
|
20
|
+
initial_semver: '0.0.1',
|
21
|
+
main_story: 'As a Developer, I want to understand openai/chatgpt APIs, so that I can build AI applications effectively',
|
22
|
+
copyright_date: '2024',
|
23
|
+
website: 'http://appydave.com/gems/openai_101'
|
24
|
+
)
|
25
|
+
.github(
|
26
|
+
active: false,
|
27
|
+
repo_name: application_name,
|
28
|
+
organization: 'appydave'
|
29
|
+
) do
|
30
|
+
create_repository
|
31
|
+
# delete_repository
|
32
|
+
# list_repositories
|
33
|
+
open_repository
|
34
|
+
# run_command('git init')
|
35
|
+
end
|
36
|
+
.blueprint(
|
37
|
+
active: false,
|
38
|
+
name: :bin_hook,
|
39
|
+
description: 'initialize repository',
|
40
|
+
on_exist: :write) do
|
41
|
+
|
42
|
+
cd(:app)
|
43
|
+
|
44
|
+
run_template_script('bin/runonce/git-setup.sh', dom: dom)
|
45
|
+
|
46
|
+
add('.githooks/commit-msg').run_command('chmod +x .githooks/commit-msg')
|
47
|
+
add('.githooks/pre-commit').run_command('chmod +x .githooks/pre-commit')
|
48
|
+
|
49
|
+
add('.gitignore')
|
50
|
+
|
51
|
+
run_command('git config core.hooksPath .githooks') # enable sharable githooks (developer needs to turn this on before editing rep)
|
52
|
+
|
53
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
54
|
+
run_command("gh repo edit -d \"#{dom[:application_description]}\"")
|
55
|
+
end
|
56
|
+
.package_json(
|
57
|
+
active: false,
|
58
|
+
name: :package_json,
|
59
|
+
description: 'Set up the package.json file for semantic versioning'
|
60
|
+
) do
|
61
|
+
self
|
62
|
+
.add('package.json', dom: dom)
|
63
|
+
.play_actions
|
64
|
+
|
65
|
+
self
|
66
|
+
.add_script('release', 'semantic-release')
|
67
|
+
.sort
|
68
|
+
.development
|
69
|
+
.npm_add_group('semver-ruby')
|
70
|
+
|
71
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
72
|
+
end
|
73
|
+
.blueprint(
|
74
|
+
active: false,
|
75
|
+
name: :opinionated,
|
76
|
+
description: 'opinionated GEM files',
|
77
|
+
on_exist: :write) do
|
78
|
+
|
79
|
+
cd(:app)
|
80
|
+
|
81
|
+
add('bin/setup')
|
82
|
+
add('bin/console')
|
83
|
+
|
84
|
+
applet_path = typed_dom.namespaces.map { |ns| ns.downcase }.join('/')
|
85
|
+
|
86
|
+
add("lib/#{applet_path}.rb" , template_file: 'lib/applet_name.rb' , dom: dom)
|
87
|
+
add("lib/#{applet_path}/version.rb" , template_file: 'lib/applet_name/version.rb' , dom: dom)
|
88
|
+
|
89
|
+
add('spec/spec_helper.rb')
|
90
|
+
add("spec/#{applet_path}_spec.rb" , template_file: 'spec/applet_name_spec.rb', dom: dom)
|
91
|
+
|
92
|
+
add("#{typed_dom.application}.gemspec" , template_file: 'applet_name.gemspec', dom: dom)
|
93
|
+
add('Gemfile', dom: dom)
|
94
|
+
add('Guardfile', dom: dom)
|
95
|
+
add('Rakefile', dom: dom)
|
96
|
+
add('.rspec', dom: dom)
|
97
|
+
add('.rubocop.yml', dom: dom)
|
98
|
+
add('README.md', dom: dom)
|
99
|
+
add('CODE_OF_CONDUCT.md', dom: dom)
|
100
|
+
add('LICENSE.txt', dom: dom)
|
101
|
+
|
102
|
+
run_command("rubocop -a")
|
103
|
+
|
104
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
105
|
+
end
|
106
|
+
.blueprint(
|
107
|
+
active: true,
|
108
|
+
name: :ci_cd,
|
109
|
+
description: 'github actions (CI/CD)',
|
110
|
+
on_exist: :write) do
|
111
|
+
|
112
|
+
cd(:app)
|
113
|
+
|
114
|
+
# run_command("gh secret set SLACK_WEBHOOK --body \"$SLACK_REPO_WEBHOOK\"")
|
115
|
+
run_command("gh secret set GEM_HOST_API_KEY --body \"$GEM_HOST_API_KEY\"")
|
116
|
+
|
117
|
+
add('.github/workflows/main.yml')
|
118
|
+
add('.releaserc.json')
|
119
|
+
|
120
|
+
run_command("git add .; git commit -m 'chore: #{self.options.description.downcase}'; git push")
|
121
|
+
end
|
122
|
+
|
123
|
+
director.play_actions
|
124
|
+
# director.builder.logit
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
KManager.opts.app_name = 'openai_101'
|
129
|
+
KManager.opts.sleep = 2
|
130
|
+
KManager.opts.reboot_on_kill = 0
|
131
|
+
KManager.opts.reboot_sleep = 4
|
132
|
+
KManager.opts.exception_style = :short
|
133
|
+
KManager.opts.show.time_taken = true
|
134
|
+
KManager.opts.show.finished = true
|
135
|
+
KManager.opts.show.finished_message = 'FINISHED :)'
|
data/.releaserc.json
CHANGED
data/.rubocop.yml
CHANGED
@@ -7,14 +7,13 @@ require:
|
|
7
7
|
- rubocop-rake
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
TargetRubyVersion: 3.
|
10
|
+
TargetRubyVersion: 3.0
|
11
11
|
DisplayCopNames: true
|
12
12
|
ExtraDetails: true
|
13
13
|
NewCops: enable
|
14
14
|
Exclude:
|
15
15
|
- ".builders/**/*"
|
16
16
|
- "spec/samples/**/*"
|
17
|
-
- "spec/openai_101/tools/**/*"
|
18
17
|
|
19
18
|
Metrics/BlockLength:
|
20
19
|
Exclude:
|
@@ -40,22 +39,8 @@ Metrics/BlockLength:
|
|
40
39
|
- shared_examples_for
|
41
40
|
- transaction
|
42
41
|
|
43
|
-
Metrics/AbcSize:
|
44
|
-
Max: 25
|
45
|
-
Exclude:
|
46
|
-
- "lib/openai_101/tools/edl_to_chapters.rb"
|
47
|
-
- "lib/openai_101/tools/clean_ruby_errors.rb"
|
48
|
-
|
49
|
-
Metrics/CyclomaticComplexity:
|
50
|
-
Exclude:
|
51
|
-
- "lib/openai_101/tools/clean_ruby_errors.rb"
|
52
|
-
|
53
42
|
Metrics/MethodLength:
|
54
|
-
|
55
|
-
- "lib/openai_101/tools/edl_to_chapters.rb"
|
56
|
-
- "lib/openai_101/tools/clean_ruby_errors.rb"
|
57
|
-
- "lib/openai_101/tools/sanitize_all_webp_files"
|
58
|
-
- "lib/openai_101/tools/webp_to_png.rb"
|
43
|
+
Max: 25
|
59
44
|
|
60
45
|
Layout/LineLength:
|
61
46
|
Max: 200
|
@@ -110,14 +95,12 @@ Layout/SpaceBeforeComma:
|
|
110
95
|
RSpec/NestedGroups:
|
111
96
|
Max: 5
|
112
97
|
|
113
|
-
RSpec/
|
114
|
-
|
115
|
-
|
98
|
+
RSpec/SpecFilePathFormat:
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
RSpec/SpecFilePathSuffix:
|
102
|
+
Enabled: true
|
116
103
|
|
117
104
|
RSpec/NamedSubject:
|
118
105
|
Exclude:
|
119
106
|
- "**/spec/**/*"
|
120
|
-
|
121
|
-
RSpec/DescribeClass:
|
122
|
-
Exclude:
|
123
|
-
- 'spec/openai_101/config/openai_spec.rb'
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.3.3
|
data/CHANGELOG.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
|
1
|
+
# [0.2.0](https://github.com/appydave/openai_101/compare/v0.1.0...v0.2.0) (2024-06-19)
|
2
2
|
|
3
3
|
|
4
|
-
###
|
4
|
+
### Features
|
5
5
|
|
6
|
-
*
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
*
|
6
|
+
* moved repo to appydave organization ([dd59698](https://github.com/appydave/openai_101/commit/dd596981dc69723a1c59b53db845f29d616f0540))
|
7
|
+
|
8
|
+
# [0.1.0](https://github.com/appydave/openai_101/compare/v0.0.1...v0.1.0) (2024-06-19)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* moved repo to appydave organization ([3b01048](https://github.com/appydave/openai_101/commit/3b01048e2e0f381a6ab5bc0a7cfb4cedd83da88f))
|
14
14
|
|
15
15
|
## [Unreleased]
|
16
16
|
|
17
|
-
## [0.1.0] - 2024-
|
17
|
+
## [0.1.0] - 2024-06-19
|
18
18
|
|
19
19
|
- Initial release
|
data/README.md
CHANGED
@@ -1,22 +1,6 @@
|
|
1
|
-
DAVID: Check this out, should add it into the openAI course:
|
2
|
-
|
3
|
-
https://www.loom.com/share/117eb552f1974f3d8e28463e9f1809e1
|
4
|
-
|
5
|
-
Based on:
|
6
|
-
|
7
|
-
https://innovate-aiml-data-apj.virtual.awsevents.com/media/10.%20Codenator%3A%20Enhancing%20user%20productivity%20through%20AI-powered%20code%20generation%20and%20secure%20execution/1_0kzrwmxu/330865472
|
8
|
-
|
9
|
-
|
10
|
-
|
11
1
|
# Openai 101
|
12
2
|
|
13
|
-
> OpenAI 101
|
14
|
-
|
15
|
-
**Focus Story**
|
16
|
-
|
17
|
-
As a software developer, I want to understand OpenAI endpoints and capabilities, so that I can use ChatGPT effectively
|
18
|
-
|
19
|
-
|
3
|
+
> OpenAI 101 working through the API endpoints
|
20
4
|
|
21
5
|
## Installation
|
22
6
|
|
@@ -38,84 +22,76 @@ Or install it yourself as:
|
|
38
22
|
gem install openai_101
|
39
23
|
```
|
40
24
|
|
41
|
-
##
|
25
|
+
## Stories
|
42
26
|
|
43
|
-
|
27
|
+
### Main Story
|
44
28
|
|
45
|
-
|
29
|
+
As a Developer, I want to understand openai/chatgpt APIs, so that I can build AI applications effectively
|
46
30
|
|
47
|
-
|
31
|
+
See all [stories](./STORIES.md)
|
48
32
|
|
49
|
-
```bash
|
50
|
-
npm install
|
51
|
-
```
|
52
33
|
|
53
|
-
##
|
34
|
+
## Usage
|
54
35
|
|
55
|
-
|
56
|
-
- [OpenAI Documentation](gpt-context/openai-documentation.md) is used as reference material for code generation prompts, this information has been summarized from source documentation
|
57
|
-
- [Ruby OpenAI Documentation](gpt-context/ruby-openai-documenation.md) is used as reference material for code generation prompts and shows examples of how to use the Ruby OpenAI gem
|
36
|
+
See all [usage examples](./USAGE.md)
|
58
37
|
|
59
38
|
|
60
|
-
See all [stories](./STORIES.md)
|
61
39
|
|
62
40
|
## Development
|
63
41
|
|
64
42
|
Checkout the repo
|
65
43
|
|
66
44
|
```bash
|
67
|
-
git clone https://github.com/
|
45
|
+
git clone https://github.com/appydave/openai_101
|
68
46
|
```
|
69
47
|
|
70
48
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
71
49
|
|
72
50
|
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
73
51
|
|
74
|
-
|
75
|
-
|
76
|
-
### Bulk MidJourney Image Generation
|
77
|
-
|
78
|
-
Automates MidJourney prompts on Discord.
|
79
|
-
|
80
|
-
`automate-images-midjourney`
|
81
|
-
|
82
|
-
This tool will read prompts from a file and then paste them into the MidJourney Discord channel in an unattented manner. This is useful for automating the process of generating images from prompts in bulk. NOTE: You start the script and then you place the cursor in the Discord channel and the script will do the rest.
|
83
|
-
|
84
|
-
### Bulk ChatGPT Image Generation
|
85
|
-
|
86
|
-
Automates image prompts in ChatGPT.
|
87
|
-
|
88
|
-
`automate-images-chatgpt`
|
89
|
-
|
90
|
-
This tool will read prompts from a file and then paste them into the current focused ChatGPT window in unattented mode. This is useful for automating the process of generating images from prompts in bulk using the DALE-3 feature in ChatGPT Plus. NOTE: You start the script and then you place the cursor in the ChatGPT window and the script will do the rest.
|
52
|
+
```bash
|
53
|
+
bin/console
|
91
54
|
|
92
|
-
|
55
|
+
Aaa::Bbb::Program.execute()
|
56
|
+
# => ""
|
57
|
+
```
|
93
58
|
|
94
|
-
|
59
|
+
`openai_101` is setup with Guard, run `guard`, this will watch development file changes and run tests automatically, if successful, it will then run rubocop for style quality.
|
95
60
|
|
96
|
-
`
|
61
|
+
To release a new version, update the version number in `version.rb`, build the gem and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
97
62
|
|
98
|
-
|
63
|
+
```bash
|
64
|
+
rake publish
|
65
|
+
rake clean
|
66
|
+
```
|
99
67
|
|
100
|
-
|
68
|
+
## Git helpers used by this project
|
101
69
|
|
102
|
-
`
|
70
|
+
Add the follow helpers to your `alias` file
|
103
71
|
|
104
|
-
Usage on Mac
|
105
72
|
```bash
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
73
|
+
function kcommit()
|
74
|
+
{
|
75
|
+
echo 'git add .'
|
76
|
+
git add .
|
77
|
+
echo "git commit -m "$1""
|
78
|
+
git commit -m "$1"
|
79
|
+
echo 'git pull'
|
80
|
+
git pull
|
81
|
+
echo 'git push'
|
82
|
+
git push
|
83
|
+
sleep 3
|
84
|
+
run_id="$(gh run list --limit 1 | grep -Eo "[0-9]{9,11}")"
|
85
|
+
gh run watch $run_id --exit-status && echo "run completed and successful" && git pull && git tag | sort -V | tail -1
|
86
|
+
}
|
87
|
+
function kchore () { kcommit "chore: $1" }
|
88
|
+
function kdocs () { kcommit "docs: $1" }
|
89
|
+
function kfix () { kcommit "fix: $1" }
|
90
|
+
function kfeat () { kcommit "feat: $1" }
|
91
|
+
function ktest () { kcommit "test: $1" }
|
92
|
+
function krefactor () { kcommit "refactor: $1" }
|
115
93
|
```
|
116
94
|
|
117
|
-
This tool automates the conversion of WEBP images to PNG format, stores associated prompts, manages source backups, and cleans up after processing.
|
118
|
-
|
119
95
|
## Contributing
|
120
96
|
|
121
97
|
Bug reports and pull requests are welcome on GitHub at https://github.com/klueless-io/openai_101. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/openai_101/version.rb
CHANGED
data/lib/openai_101.rb
CHANGED
@@ -1,21 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'clipboard'
|
4
|
-
require 'openai'
|
5
3
|
require 'openai_101/version'
|
6
|
-
require 'mini_magick'
|
7
|
-
|
8
|
-
require_relative 'openai_101/config/openai'
|
9
|
-
require_relative 'openai_101/tools/webp_to_png'
|
10
|
-
require_relative 'openai_101/tools/edl_to_chapters'
|
11
|
-
require_relative 'openai_101/tools/file_content_gatherer'
|
12
|
-
require_relative 'openai_101/tools/clean_ruby_errors'
|
13
4
|
|
14
5
|
module Openai101
|
15
6
|
# raise Openai101::Error, 'Sample message'
|
16
7
|
Error = Class.new(StandardError)
|
17
|
-
|
18
|
-
# Your code goes here...
|
19
8
|
end
|
20
9
|
|
21
10
|
if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
|