openai_101 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -1
- data/CHANGELOG.md +14 -0
- data/README.md +63 -39
- data/bin/automate-chatgpt.js +60 -0
- data/bin/automate-midjourney.js +75 -0
- data/bin/convert_webp_to_png.rb +86 -0
- data/bin/gpt_context_gatherer.rb +63 -0
- data/course/course.md +64 -0
- data/course/images/beautiful-llm-models.png +0 -0
- data/course/images/prompts/beautiful-llm-models.txt +1 -0
- data/course/images/prompts/series-2-appydave-gpt-summit.txt +1 -0
- data/course/images/series-2-appydave-gpt-summit.png +0 -0
- data/gpt-context/openai-documentation.md +498 -0
- data/gpt-context/ruby-openai-documenation.md +747 -0
- data/gpt-context/theme-prompts.csv +21 -0
- data/lib/openai_101/config/openai.rb +15 -0
- data/lib/openai_101/tools/automate-images-chatgpt.js +60 -0
- data/lib/openai_101/tools/automate-images-midjourney.js +75 -0
- data/lib/openai_101/tools/bulk_image_bot/base_automator.js +53 -0
- data/lib/openai_101/tools/bulk_image_bot/chatgpt_automator.js +27 -0
- data/lib/openai_101/tools/bulk_image_bot/midjourney_automator.js +49 -0
- data/lib/openai_101/tools/clean_ruby_errors.rb +274 -0
- data/lib/openai_101/tools/edl_to_chapters.rb +56 -0
- data/lib/openai_101/tools/file_content_gatherer.rb +36 -0
- data/lib/openai_101/tools/webp_to_png.rb +124 -0
- data/lib/openai_101/version.rb +1 -1
- data/lib/openai_101.rb +9 -0
- data/package-lock.json +1154 -159
- data/package.json +4 -1
- metadata +83 -6
- data/.builders/_.rb +0 -1
- data/.builders/boot.rb +0 -39
- data/.builders/generators/01-bootstrap.rb +0 -134
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d33410818e89daeeb9011d5a75ed0063fb91fe86c6d5f7a3ab792fc2017d45c0
|
4
|
+
data.tar.gz: 6ffeba5c3a534647b3fa05835086cf5fdc481c296962795f60880b26415a2626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3403d3d15af8f001c6056c1d120ab3f683854cef5d2cec1275d88a4edfb96a4342bb6cd836d86b9451d571e4324e9b9313d9be56f11c1c582b52204d932fb03
|
7
|
+
data.tar.gz: c624cd17e5603d40c30e13a7753243a3882dd3f1e592e84935eb1b9b46b3edb7be715af15d198f95c6af9241a4d49fa064828f0477625d2b2a51efeae5de179a
|
data/.rubocop.yml
CHANGED
@@ -14,6 +14,7 @@ AllCops:
|
|
14
14
|
Exclude:
|
15
15
|
- ".builders/**/*"
|
16
16
|
- "spec/samples/**/*"
|
17
|
+
- "spec/openai_101/tools/**/*"
|
17
18
|
|
18
19
|
Metrics/BlockLength:
|
19
20
|
Exclude:
|
@@ -39,8 +40,22 @@ Metrics/BlockLength:
|
|
39
40
|
- shared_examples_for
|
40
41
|
- transaction
|
41
42
|
|
42
|
-
Metrics/
|
43
|
+
Metrics/AbcSize:
|
43
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
|
+
Metrics/MethodLength:
|
54
|
+
Exclude:
|
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"
|
44
59
|
|
45
60
|
Layout/LineLength:
|
46
61
|
Max: 200
|
@@ -102,3 +117,7 @@ RSpec/FilePath:
|
|
102
117
|
RSpec/NamedSubject:
|
103
118
|
Exclude:
|
104
119
|
- "**/spec/**/*"
|
120
|
+
|
121
|
+
RSpec/DescribeClass:
|
122
|
+
Exclude:
|
123
|
+
- 'spec/openai_101/config/openai_spec.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [0.0.2](https://github.com/klueless-io/openai_101/compare/v0.0.1...v0.0.2) (2024-02-08)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* namespace issue ([cbcbeb8](https://github.com/klueless-io/openai_101/commit/cbcbeb80c204954a1cfb6db4102e9acaa6844a52))
|
7
|
+
* ruby 2.7 & 3.2 ([0af05e1](https://github.com/klueless-io/openai_101/commit/0af05e1e0e99bf08ebc4e7396bd55d10005d25e8))
|
8
|
+
* ruby 3.2 only ([d9c463a](https://github.com/klueless-io/openai_101/commit/d9c463a2775efd19d88e4d73402392fbe8c42d01))
|
9
|
+
* semantic release 19 ([c123a3f](https://github.com/klueless-io/openai_101/commit/c123a3f9cfa85dfa96769e38ea9f98b84cf94156))
|
10
|
+
* semantic release 19 ([e5251b1](https://github.com/klueless-io/openai_101/commit/e5251b1a8ac102533fb9253f8ffb1676c86e385d))
|
11
|
+
* semantic release 21 ([62ba587](https://github.com/klueless-io/openai_101/commit/62ba5870dabfe24c150943cdcd62e1a24c53a885))
|
12
|
+
* update ruby version ([142cff3](https://github.com/klueless-io/openai_101/commit/142cff346b41aac6e8b6083f970a03c1681c23ad))
|
13
|
+
* update ruby version ([f378f52](https://github.com/klueless-io/openai_101/commit/f378f520a8578372834ec57bdf6b2f4b16be813c))
|
14
|
+
|
1
15
|
## [Unreleased]
|
2
16
|
|
3
17
|
## [0.1.0] - 2024-02-09
|
data/README.md
CHANGED
@@ -1,7 +1,23 @@
|
|
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
|
+
|
1
11
|
# Openai 101
|
2
12
|
|
3
13
|
> OpenAI 101 Series on using OpenAI ChatGPT, DALL·E, and other OpenAI endpoints
|
4
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
|
+
|
20
|
+
|
5
21
|
## Installation
|
6
22
|
|
7
23
|
Add this line to your application's Gemfile:
|
@@ -22,20 +38,26 @@ Or install it yourself as:
|
|
22
38
|
gem install openai_101
|
23
39
|
```
|
24
40
|
|
25
|
-
##
|
41
|
+
## JavaScript Dependencies Installation
|
26
42
|
|
27
|
-
|
43
|
+
This optional step is only required if you plan to use the JavaScript tools included in this gem from the command line.
|
28
44
|
|
29
|
-
|
45
|
+
[Javascript Tools]
|
30
46
|
|
31
|
-
|
47
|
+
This gem includes tools written in JavaScript, requiring Node.js and associated packages. After installing the gem, navigate to the gem's root directory and run:
|
32
48
|
|
49
|
+
```bash
|
50
|
+
npm install
|
51
|
+
```
|
33
52
|
|
34
|
-
##
|
53
|
+
## Resources
|
35
54
|
|
36
|
-
|
55
|
+
- [Course Outline](./COURSE.md)
|
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
|
37
58
|
|
38
59
|
|
60
|
+
See all [stories](./STORIES.md)
|
39
61
|
|
40
62
|
## Development
|
41
63
|
|
@@ -49,49 +71,51 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
49
71
|
|
50
72
|
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
51
73
|
|
52
|
-
|
53
|
-
bin/console
|
74
|
+
## Command line tools
|
54
75
|
|
55
|
-
|
56
|
-
# => ""
|
57
|
-
```
|
76
|
+
### Bulk MidJourney Image Generation
|
58
77
|
|
59
|
-
|
78
|
+
Automates MidJourney prompts on Discord.
|
60
79
|
|
61
|
-
|
80
|
+
`automate-images-midjourney`
|
62
81
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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.
|
67
91
|
|
68
|
-
|
92
|
+
### WEBP to PNG Converter:
|
69
93
|
|
70
|
-
|
94
|
+
Converts WEBP images to PNG, manages prompts.
|
71
95
|
|
96
|
+
`web3_to_png`
|
97
|
+
|
98
|
+
### EDL to Chapters
|
99
|
+
|
100
|
+
Converts EDL time codes to chapters in YouTube video description.
|
101
|
+
|
102
|
+
`edl_to_chapters`
|
103
|
+
|
104
|
+
Usage on Mac
|
72
105
|
```bash
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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" }
|
106
|
+
# make the script executable
|
107
|
+
chmod +x bin/convert_webp_to_png.rb
|
108
|
+
|
109
|
+
# run the script
|
110
|
+
./bin/convert_webp_to_png.rb -s path/to/source -t path/to/target -f target_filename -p optional_prefix
|
111
|
+
|
112
|
+
# Example
|
113
|
+
./bin/convert_webp_to_png.rb -p series-2 -f woman-grey-tabby-cat -s /Users/davidcruwys/Sync/smart-downloads/download-images
|
114
|
+
-t /Volumes/Expansion/Sync/tube-channels/a-cast/cast-active/a35-automate-image-generation/assets
|
93
115
|
```
|
94
116
|
|
117
|
+
This tool automates the conversion of WEBP images to PNG format, stores associated prompts, manages source backups, and cleans up after processing.
|
118
|
+
|
95
119
|
## Contributing
|
96
120
|
|
97
121
|
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.
|
@@ -0,0 +1,60 @@
|
|
1
|
+
const { Command } = require('commander');
|
2
|
+
const fs = require('fs');
|
3
|
+
const robot = require("robotjs");
|
4
|
+
|
5
|
+
const program = new Command();
|
6
|
+
|
7
|
+
program
|
8
|
+
.option('-f, --file <filename>', 'The file to read prompts from', 'prompts.txt')
|
9
|
+
.option('-o, --completed-file <filename>', 'The file to write completed prompts to', 'completed.txt')
|
10
|
+
.option('-i, --interval <seconds>', 'The interval in seconds between prompts', 80)
|
11
|
+
.option('-m, --max-images <number>', 'The maximum number of images to process', 20);
|
12
|
+
|
13
|
+
program.parse(process.argv);
|
14
|
+
|
15
|
+
function read_prompts_from_file(file, maxImages) {
|
16
|
+
const prompts = fs.readFileSync(file, 'utf-8').split('\n').filter(Boolean);
|
17
|
+
return prompts.slice(0, maxImages);
|
18
|
+
}
|
19
|
+
|
20
|
+
function remove_prompt_from_file(file, prompt) {
|
21
|
+
const prompts = fs.readFileSync(file, 'utf-8').split('\n').filter(Boolean);
|
22
|
+
const index = prompts.indexOf(prompt);
|
23
|
+
if (index !== -1) {
|
24
|
+
prompts.splice(index, 1);
|
25
|
+
fs.writeFileSync(file, prompts.join('\n'));
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
function append_prompt_to_file(file, prompt) {
|
30
|
+
fs.appendFileSync(file, `${prompt}\n`);
|
31
|
+
}
|
32
|
+
|
33
|
+
function wait(ms) {
|
34
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
35
|
+
}
|
36
|
+
|
37
|
+
async function send_prompt_to_chat(prompt) {
|
38
|
+
const formattedPrompt = `create image: ${prompt}`;
|
39
|
+
robot.typeString(formattedPrompt);
|
40
|
+
robot.keyTap('enter');
|
41
|
+
}
|
42
|
+
|
43
|
+
async function start() {
|
44
|
+
console.log('Starting Image Creation Automation');
|
45
|
+
console.log('Please open the ChatGPT interface where you intend to use this script.');
|
46
|
+
console.log('Automation will begin in 10 seconds.');
|
47
|
+
await wait(10000);
|
48
|
+
|
49
|
+
const prompts = read_prompts_from_file(program.opts().file, parseInt(program.opts().maxImages));
|
50
|
+
for (let prompt of prompts) {
|
51
|
+
console.log(`Sending prompt "${prompt}"...`);
|
52
|
+
await send_prompt_to_chat(prompt);
|
53
|
+
await wait(program.opts().interval * 1000);
|
54
|
+
remove_prompt_from_file(program.opts().file, prompt);
|
55
|
+
append_prompt_to_file(program.opts().completedFile, prompt);
|
56
|
+
}
|
57
|
+
console.log('Automation complete.');
|
58
|
+
}
|
59
|
+
|
60
|
+
start();
|
@@ -0,0 +1,75 @@
|
|
1
|
+
const { Command } = require('commander');
|
2
|
+
const fs = require('fs');
|
3
|
+
const robot = require("robotjs");
|
4
|
+
|
5
|
+
const program = new Command();
|
6
|
+
|
7
|
+
program
|
8
|
+
.option('-f, --file <filename>', 'The file to read prompts from', 'prompts.txt')
|
9
|
+
.option('-o, --completed-file <filename>', 'The file to write completed prompts to', 'completed.txt')
|
10
|
+
.option('-i, --interval <seconds>', 'The interval in seconds between prompts', 4)
|
11
|
+
.option('-p, --prompts-per-session <prompts>', 'The number of prompts to process in a session', 7)
|
12
|
+
.option('-w, --wait-between-sessions <seconds>', 'The number of seconds to wait between sessions', 180);
|
13
|
+
|
14
|
+
program.parse(process.argv);
|
15
|
+
|
16
|
+
function read_next_prompt_from_file(file) {
|
17
|
+
const prompts = fs.readFileSync(file, 'utf-8').split('\n').filter(Boolean);
|
18
|
+
return prompts.shift();
|
19
|
+
}
|
20
|
+
|
21
|
+
function remove_prompt_from_file(file, prompt) {
|
22
|
+
const lockfile = `${file}.lock`;
|
23
|
+
fs.writeFileSync(lockfile, '', { flag: 'wx' });
|
24
|
+
const prompts = fs.readFileSync(file, 'utf-8').split('\n').filter(Boolean);
|
25
|
+
const index = prompts.indexOf(prompt);
|
26
|
+
prompts.splice(index, 1);
|
27
|
+
fs.writeFileSync(file, prompts.join('\n'));
|
28
|
+
fs.unlinkSync(lockfile);
|
29
|
+
}
|
30
|
+
|
31
|
+
function append_prompt_to_file(file, prompt) {
|
32
|
+
const lockfile = `${file}.lock`;
|
33
|
+
fs.writeFileSync(lockfile, '', { flag: 'wx' });
|
34
|
+
fs.appendFileSync(file, `${prompt}\n`);
|
35
|
+
fs.unlinkSync(lockfile);
|
36
|
+
}
|
37
|
+
|
38
|
+
function wait(ms) {
|
39
|
+
const end = Date.now() + ms;
|
40
|
+
while (Date.now() < end) {
|
41
|
+
// Wait
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
function send_prompt_to_discord(prompt) {
|
46
|
+
const formattedPrompt = `/imagine prompt: ${prompt}`;
|
47
|
+
robot.typeString(formattedPrompt);
|
48
|
+
robot.keyTap('enter');
|
49
|
+
}
|
50
|
+
|
51
|
+
function start() {
|
52
|
+
console.log('Starting MidJourney Automation');
|
53
|
+
console.log('Please open Discord and navigate to the MidJourney channel.');
|
54
|
+
console.log('Automation will begin in 10 seconds.');
|
55
|
+
wait(10 * 1000);
|
56
|
+
|
57
|
+
let index = 0;
|
58
|
+
let prompt = read_next_prompt_from_file(program.opts().file);
|
59
|
+
while (prompt) {
|
60
|
+
console.log(`Sending prompt "${prompt}"...`);
|
61
|
+
send_prompt_to_discord(prompt);
|
62
|
+
wait(program.opts().interval * 1000);
|
63
|
+
remove_prompt_from_file(program.opts().file, prompt);
|
64
|
+
append_prompt_to_file(program.opts().completedFile, prompt);
|
65
|
+
index++;
|
66
|
+
if (index % program.opts().promptsPerSession === 0) {
|
67
|
+
console.log(`Pausing for ${program.opts().waitBetweenSessions} seconds.`);
|
68
|
+
wait(program.opts().waitBetweenSessions * 1000);
|
69
|
+
}
|
70
|
+
prompt = read_next_prompt_from_file(program.opts().file);
|
71
|
+
}
|
72
|
+
console.log('Automation complete.');
|
73
|
+
}
|
74
|
+
|
75
|
+
start();
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'pry'
|
5
|
+
require 'optparse'
|
6
|
+
require_relative '../lib/openai_101/tools/webp_to_png'
|
7
|
+
|
8
|
+
options = {
|
9
|
+
prefix: nil,
|
10
|
+
debug: false,
|
11
|
+
dry_run: false
|
12
|
+
}
|
13
|
+
|
14
|
+
OptionParser.new do |opts|
|
15
|
+
opts.banner = 'Usage: convert_webp_to_png.rb [options]'
|
16
|
+
|
17
|
+
opts.on('-s', '--source=SOURCE', 'Source directory containing WEBP files') do |source|
|
18
|
+
options[:source_folder] = source
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on('-t', '--target=TARGET', 'Target directory for PNG files') do |target|
|
22
|
+
options[:target_folder] = target
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on('-f', '--filename=FILENAME', 'Specific target filename for the PNG output') do |filename|
|
26
|
+
options[:target_filename] = filename
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on('-p', '--prefix=PREFIX', 'Optional prefix for the target filename') do |prefix|
|
30
|
+
options[:prefix] = prefix
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on('-d', '--debug', 'Enable debug mode') do
|
34
|
+
options[:debug] = true
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on('--dry-run', 'Simulate the conversion process without making any changes') do
|
38
|
+
options[:dry_run] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on('-h', '--help', 'Prints this help') do
|
42
|
+
puts opts
|
43
|
+
exit
|
44
|
+
end
|
45
|
+
end.parse!
|
46
|
+
|
47
|
+
unless options[:target_filename]
|
48
|
+
puts 'A target filename is required.'
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
|
52
|
+
converter = Openai101::Tools::WebpToPng.new(
|
53
|
+
source_folder: options[:source_folder],
|
54
|
+
target_folder: options[:target_folder],
|
55
|
+
target_filename: options[:target_filename],
|
56
|
+
prefix: options[:prefix]
|
57
|
+
)
|
58
|
+
|
59
|
+
if options[:debug]
|
60
|
+
puts "Source folder : #{converter.source_folder}"
|
61
|
+
puts "Target folder : #{converter.target_folder}"
|
62
|
+
puts "Target filename : #{converter.target_filename}"
|
63
|
+
puts "Source filename : #{converter.source_filename}"
|
64
|
+
puts "Prefix : #{converter.prefix}"
|
65
|
+
puts "Target prompt : #{converter.prompt}"
|
66
|
+
puts "Target PNG file : #{converter.target_png_file}"
|
67
|
+
puts "Target Prompt file : #{converter.target_prompt_file}"
|
68
|
+
end
|
69
|
+
|
70
|
+
if options[:dry_run]
|
71
|
+
puts 'Dry run enabled - no changes will be made.'
|
72
|
+
exit
|
73
|
+
end
|
74
|
+
|
75
|
+
converter.sanitize_all_webp_files
|
76
|
+
|
77
|
+
if converter.source?
|
78
|
+
converter
|
79
|
+
.convert
|
80
|
+
.store_prompt
|
81
|
+
.backup_source
|
82
|
+
.delete_source
|
83
|
+
puts 'Conversion and processing complete.'
|
84
|
+
else
|
85
|
+
puts "\e[31mNo source file found\e[0m"
|
86
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Usage:
|
5
|
+
# ./bin/gpt_context_gatherer.rb -d -i 'lib/openai_101/tools/**/*.rb'
|
6
|
+
# ./bin/gpt_context_gatherer.rb -d -i 'lib/openai_101/tools/**/*' -e 'node_modules/**/*' -e 'package-lock.json' -e 'lib/openai_101/tools/prompts/*.txt'
|
7
|
+
#
|
8
|
+
# Get GPT Context Gatherer code
|
9
|
+
# ./bin/gpt_context_gatherer.rb -i 'bin/**/*gather*.rb' -i 'lib/openai_101/tools/**/*gather*.rb'
|
10
|
+
require 'optparse'
|
11
|
+
require 'clipboard'
|
12
|
+
require_relative '../lib/openai_101/tools/file_content_gatherer'
|
13
|
+
|
14
|
+
options = {
|
15
|
+
include_patterns: [],
|
16
|
+
exclude_patterns: [],
|
17
|
+
debug: false
|
18
|
+
}
|
19
|
+
|
20
|
+
OptionParser.new do |opts|
|
21
|
+
opts.banner = 'Usage: gather_content.rb [options]'
|
22
|
+
|
23
|
+
opts.on('-i', '--include PATTERN', 'Pattern or file to include (can be used multiple times)') do |pattern|
|
24
|
+
options[:include_patterns] << pattern
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on('-e', '--exclude PATTERN', 'Pattern or file to exclude (can be used multiple times)') do |pattern|
|
28
|
+
options[:exclude_patterns] << pattern
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on('-d', '--debug', 'Enable debug mode') do
|
32
|
+
options[:debug] = true
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
36
|
+
puts opts
|
37
|
+
puts "\nExamples:"
|
38
|
+
puts " #{File.basename($PROGRAM_NAME)} -i 'lib/**/*.rb' -e 'lib/excluded/**/*.rb' -d"
|
39
|
+
puts " #{File.basename($PROGRAM_NAME)} --include 'src/**/*.js' --exclude 'src/vendor/**/*.js'"
|
40
|
+
|
41
|
+
puts ''
|
42
|
+
puts ' # Get GPT Context Gatherer code that is found in any folder (bin, lib & spec)'
|
43
|
+
puts " #{File.basename($PROGRAM_NAME)} -i '**/*gather*.rb'"
|
44
|
+
exit
|
45
|
+
end
|
46
|
+
end.parse!
|
47
|
+
|
48
|
+
pp options if options[:debug]
|
49
|
+
|
50
|
+
gatherer = Openai101::Tools::FileContentGatherer.new(
|
51
|
+
include_patterns: options[:include_patterns],
|
52
|
+
exclude_patterns: options[:exclude_patterns]
|
53
|
+
)
|
54
|
+
|
55
|
+
content = gatherer.build
|
56
|
+
|
57
|
+
if options[:debug]
|
58
|
+
puts '-' * 80
|
59
|
+
puts content
|
60
|
+
puts '-' * 80
|
61
|
+
end
|
62
|
+
|
63
|
+
Clipboard.copy(content)
|
data/course/course.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# OpenAI 101
|
2
|
+
|
3
|
+
> OpenAI 101 Series on using OpenAI ChatGPT, DALL·E, and other OpenAI endpoints
|
4
|
+
|
5
|
+
As a software developer, I want to understand OpenAI endpoints and capabilities, so that I can use ChatGPT effectively
|
6
|
+
|
7
|
+
## Overview
|
8
|
+
|
9
|
+
Compreshensive guide to using OpenAI endpoints and capabilities, in this section we will look at the building blocks for this series and what we plan to cover.
|
10
|
+
|
11
|
+
- [Built On](#built-on)
|
12
|
+
- [Hello World](#achieving-hello-world-status)
|
13
|
+
- Configure OpenAI API
|
14
|
+
|
15
|
+
|
16
|
+
## Built On
|
17
|
+
|
18
|
+
- Ruby Gem (Library)
|
19
|
+
- Dependencies
|
20
|
+
- `dotenv` for environment variables
|
21
|
+
- `ruby-openai` for OpenAI API
|
22
|
+
- Tools
|
23
|
+
- `convert_webp_to_png` for converting ChatGPT images from WebP to PNG
|
24
|
+
- `automate-images-chatgpt` for running bulk image creation in ChatGPT/DALL·E
|
25
|
+
- `automate-images-midjourney` for running bulk image creation in MidJourney
|
26
|
+
- `edl_to_chapters` for converting EDL time codes to chapters in YouTube video description
|
27
|
+
|
28
|
+
- GPT Context Documents
|
29
|
+
- OpenAI documentation
|
30
|
+
- Ruby OpenAI documentation
|
31
|
+
|
32
|
+
## Achieving Hello World Status
|
33
|
+
|
34
|
+
- Configure OpenAI API
|
35
|
+
- Create an account
|
36
|
+
- Create an API key
|
37
|
+
- Add API key to `.env` file
|
38
|
+
- Load `.env` file
|
39
|
+
- Use API key to authenticate with OpenAI API
|
40
|
+
- Make first simple prompt request
|
41
|
+
- text completion
|
42
|
+
- Models are Sexy
|
43
|
+
- Model list
|
44
|
+
|
45
|
+
## What we will cover infographic
|
46
|
+
|
47
|
+
TODO: Add infographic
|
48
|
+
|
49
|
+
Notes:
|
50
|
+
|
51
|
+
- List of endpoints
|
52
|
+
- List of usecases
|
53
|
+
- 2nd Brain
|
54
|
+
- GPT Context used for code generation
|
55
|
+
- Code Generation
|
56
|
+
- Text to Image
|
57
|
+
- Image to Text (Vision)
|
58
|
+
- Text to Speech
|
59
|
+
- Speech to Text
|
60
|
+
- Samples in 4 languages (GPT as a Polyglot Developer)
|
61
|
+
- Ruby
|
62
|
+
- Python
|
63
|
+
- JavaScript
|
64
|
+
- REST API (cURL)
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
A mystical illustration depicting three beautiful women representing large language models, set in an environment inspired by Pocahontas. Each woman
|
@@ -0,0 +1 @@
|
|
1
|
+
An_image_of_a_computer_nerd__characterized_by_glasses_and_casual_tech-themed_attire__standing_confidently_on_a_stage._The_backdrop_is_a_large_screen_d
|
Binary file
|