vibe-sort 0.2.0
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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +27 -0
- data/CHANGELOG.md +101 -0
- data/LICENSE.txt +21 -0
- data/README.md +281 -0
- data/Rakefile +12 -0
- data/docs/IMPLEMENTATION_PLAN.md +534 -0
- data/docs/README.md +211 -0
- data/docs/api_reference.md +440 -0
- data/docs/architecture.md +320 -0
- data/docs/development.md +566 -0
- data/docs/v0.2.0_UPDATE.md +377 -0
- data/lib/vibe/sort/version.rb +7 -0
- data/lib/vibe/sort.rb +10 -0
- data/lib/vibe_sort/client.rb +87 -0
- data/lib/vibe_sort/configuration.rb +21 -0
- data/lib/vibe_sort/error.rb +17 -0
- data/lib/vibe_sort/sorter.rb +125 -0
- data/lib/vibe_sort/version.rb +5 -0
- data/lib/vibe_sort.rb +14 -0
- data/sig/vibe/sort.rbs +6 -0
- metadata +83 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 57341544b7a583956dde5f307ad0705fd01f70994ea5fc634557ddc2ec045b55
|
|
4
|
+
data.tar.gz: 823b1d1d124ae00d2abaae240d74917df07452b6161619ec6e398362f266c8ea
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b0158f11c6899b503b183b50933d14485f19c4bcee3dbf75fb8e8ff3149eb279e8ec5af52a8bd6fea1cd15ca35255dde7a5884a1e0ec133b51d6c3de9f4fad36
|
|
7
|
+
data.tar.gz: d59a672c3b38922cf213ad0011bea552b02b0b66d79e600f42df37dd213e6683ef512f0d7413a98930b8f588e54942868dd3f421dec24e9d86c9f95a268ce9a2
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.0
|
|
3
|
+
NewCops: enable
|
|
4
|
+
Exclude:
|
|
5
|
+
- 'vendor/**/*'
|
|
6
|
+
- 'bin/**/*'
|
|
7
|
+
- 'tmp/**/*'
|
|
8
|
+
|
|
9
|
+
Style/StringLiterals:
|
|
10
|
+
EnforcedStyle: double_quotes
|
|
11
|
+
|
|
12
|
+
Style/StringLiteralsInInterpolation:
|
|
13
|
+
EnforcedStyle: double_quotes
|
|
14
|
+
|
|
15
|
+
Style/Documentation:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
Metrics/BlockLength:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'spec/**/*'
|
|
21
|
+
- '*.gemspec'
|
|
22
|
+
|
|
23
|
+
Metrics/MethodLength:
|
|
24
|
+
Enabled: false
|
|
25
|
+
|
|
26
|
+
Layout/LineLength:
|
|
27
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2025-10-16
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Mixed-Type Array Support**: Arrays can now contain integers, floats, AND strings
|
|
15
|
+
- String sorting capability with case-sensitive alphabetical ordering
|
|
16
|
+
- Mixed-type sorting with standard rules (numbers before strings)
|
|
17
|
+
- Enhanced AI prompt to handle multiple data types intelligently
|
|
18
|
+
- Updated examples in README and documentation for string and mixed-type arrays
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Input validation now accepts `Numeric` or `String` types (previously `Numeric` only)
|
|
23
|
+
- Error message updated to "Input must be an array of numbers or strings"
|
|
24
|
+
- System prompt generalized to handle diverse array compositions
|
|
25
|
+
- Output validation updated to accept numbers and strings
|
|
26
|
+
- API documentation updated to reflect new capabilities
|
|
27
|
+
|
|
28
|
+
### Documentation
|
|
29
|
+
|
|
30
|
+
- Added string sorting examples to README
|
|
31
|
+
- Added mixed-type array examples to README
|
|
32
|
+
- Updated API reference with new sorting rules
|
|
33
|
+
- Added sorting behavior section explaining number/string ordering
|
|
34
|
+
- Updated error messages in documentation
|
|
35
|
+
|
|
36
|
+
### Technical Details
|
|
37
|
+
|
|
38
|
+
- `VibeSort::Client#valid_input?` now checks for `Numeric || String`
|
|
39
|
+
- `VibeSort::Sorter#build_payload` uses generalized AI instructions
|
|
40
|
+
- `VibeSort::Sorter#validate_sorted_array!` accepts both numeric and string values
|
|
41
|
+
- All method signatures and documentation updated accordingly
|
|
42
|
+
|
|
43
|
+
### Sorting Rules
|
|
44
|
+
|
|
45
|
+
- **Numbers only**: Ascending numerical order
|
|
46
|
+
- **Strings only**: Ascending alphabetical order (case-sensitive)
|
|
47
|
+
- **Mixed arrays**: Numbers sorted first, then strings, each group sorted within itself
|
|
48
|
+
|
|
49
|
+
## [0.1.0] - 2025-10-16
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- Initial release of VibeSort gem
|
|
54
|
+
- Core functionality: AI-powered array sorting using OpenAI API
|
|
55
|
+
- `VibeSort::Client` - Main public interface for sorting arrays
|
|
56
|
+
- `VibeSort::Configuration` - Configuration management for API key and temperature
|
|
57
|
+
- `VibeSort::Sorter` - HTTP client for OpenAI API communication via Faraday
|
|
58
|
+
- `VibeSort::ApiError` - Custom exception class for API errors
|
|
59
|
+
- Comprehensive error handling with detailed error messages
|
|
60
|
+
- Input validation for array types and numeric values
|
|
61
|
+
- JSON mode support for reliable, structured API responses
|
|
62
|
+
- Temperature configuration for controlling model behavior
|
|
63
|
+
- Full test suite with RSpec
|
|
64
|
+
- Complete documentation:
|
|
65
|
+
- README with usage examples and installation instructions
|
|
66
|
+
- Architecture documentation (`docs/architecture.md`)
|
|
67
|
+
- API reference (`docs/api_reference.md`)
|
|
68
|
+
- Development guide (`docs/development.md`)
|
|
69
|
+
- Runtime dependencies:
|
|
70
|
+
- `faraday` (~> 2.0) for HTTP requests
|
|
71
|
+
- `faraday-json` (~> 1.0) for JSON middleware
|
|
72
|
+
- Development dependencies:
|
|
73
|
+
- `rspec` (~> 3.0) for testing
|
|
74
|
+
- `pry` (~> 0.14) for debugging
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
- Sort arrays of integers, floats, or mixed numeric types
|
|
79
|
+
- Configurable model temperature (default: 0.0 for deterministic results)
|
|
80
|
+
- Consistent return format with success flag, sorted array, and error messages
|
|
81
|
+
- Support for positive and negative numbers
|
|
82
|
+
- Graceful error handling for invalid inputs and API failures
|
|
83
|
+
- Thread-safe configuration per client instance
|
|
84
|
+
|
|
85
|
+
### Documentation
|
|
86
|
+
|
|
87
|
+
- Comprehensive README with examples and disclaimers
|
|
88
|
+
- Architecture overview with component diagrams
|
|
89
|
+
- Complete API reference for all public methods
|
|
90
|
+
- Development guide with setup instructions and best practices
|
|
91
|
+
- Code examples for common use cases
|
|
92
|
+
- Performance considerations and cost analysis
|
|
93
|
+
- Security best practices for API key management
|
|
94
|
+
|
|
95
|
+
### Notes
|
|
96
|
+
|
|
97
|
+
- This is a proof-of-concept gem for educational purposes
|
|
98
|
+
- Not recommended for production use
|
|
99
|
+
- Traditional sorting algorithms are faster, cheaper, and more reliable
|
|
100
|
+
- Requires OpenAI API key and internet connection
|
|
101
|
+
- Each sort operation incurs API costs (~$0.001-0.002 per request)
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chayut Orapinpatipat
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# ๐ VibeSort
|
|
2
|
+
|
|
3
|
+
> **AI-powered array sorting using OpenAI's GPT models**
|
|
4
|
+
|
|
5
|
+
VibeSort is a proof-of-concept Ruby gem that demonstrates sorting number arrays by leveraging the OpenAI Chat Completions API. Instead of using traditional sorting algorithms, it asks GPT to do the work!
|
|
6
|
+
|
|
7
|
+
[](https://badge.fury.io/rb/vibe-sort)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
## โ ๏ธ Disclaimer
|
|
11
|
+
|
|
12
|
+
This is a **proof-of-concept** and educational project. It is not intended for production use. Traditional sorting algorithms are far more efficient, reliable, and cost-effective. Use this gem to explore AI capabilities, not to sort arrays in real applications!
|
|
13
|
+
|
|
14
|
+
## โจ Features
|
|
15
|
+
|
|
16
|
+
- ๐ค **AI-Powered Sorting**: Uses OpenAI's GPT models to sort arrays
|
|
17
|
+
- ๐ฏ **Simple Interface**: Clean, intuitive API with a single `sort` method
|
|
18
|
+
- ๐ง **Configurable**: Supports custom temperature settings for model behavior
|
|
19
|
+
- ๐ก๏ธ **Error Handling**: Comprehensive error handling with clear error messages
|
|
20
|
+
- ๐ **Structured Output**: Uses JSON mode for reliable, parsable responses
|
|
21
|
+
- ๐ **Type Validation**: Validates input and output to ensure data integrity
|
|
22
|
+
- ๐ **Mixed-Type Support**: Sorts arrays containing integers, floats, and strings
|
|
23
|
+
|
|
24
|
+
## โ
Requirements
|
|
25
|
+
|
|
26
|
+
- Ruby **3.0** or newer (MRI)
|
|
27
|
+
- Bundler **2.0+**
|
|
28
|
+
- An OpenAI API key with access to the Chat Completions API
|
|
29
|
+
- Internet connectivity (each sort performs a remote API call)
|
|
30
|
+
|
|
31
|
+
## ๐ฆ Installation
|
|
32
|
+
|
|
33
|
+
Add this line to your application's Gemfile:
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
gem 'vibe-sort'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
And then execute:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bundle install
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or install it yourself as:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
gem install vibe-sort
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## โก Quick Start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
export OPENAI_API_KEY="your-openai-api-key"
|
|
55
|
+
bundle exec ruby -e "require 'vibe_sort'; client = VibeSort::Client.new(api_key: ENV['OPENAI_API_KEY']); puts client.sort([34, 1, 'Apple', 8.5])"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or fire up the bundled console for interactive experimentation:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
OPENAI_API_KEY=your-openai-api-key bundle exec bin/console
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```ruby
|
|
65
|
+
client = VibeSort::Client.new(api_key: ENV['OPENAI_API_KEY'])
|
|
66
|
+
client.sort([34, 1, 'Apple', 8.5])
|
|
67
|
+
# => { success: true, sorted_array: [1, 8.5, 34, "Apple"] }
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## ๐ Usage
|
|
71
|
+
|
|
72
|
+
### Basic Usage
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
require 'vibe_sort'
|
|
76
|
+
|
|
77
|
+
# Initialize the client with your OpenAI API key
|
|
78
|
+
client = VibeSort::Client.new(api_key: ENV['OPENAI_API_KEY'])
|
|
79
|
+
|
|
80
|
+
# Sort an array of numbers
|
|
81
|
+
numbers = [34, 1, 99, 15, 8]
|
|
82
|
+
result = client.sort(numbers)
|
|
83
|
+
|
|
84
|
+
if result[:success]
|
|
85
|
+
puts "โ
Vibe Sort successful!"
|
|
86
|
+
puts "Original: #{numbers}"
|
|
87
|
+
puts "Sorted: #{result[:sorted_array]}"
|
|
88
|
+
# Output: [1, 8, 15, 34, 99]
|
|
89
|
+
else
|
|
90
|
+
puts "โ Vibe Sort failed: #{result[:error]}"
|
|
91
|
+
end
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Sorting Strings
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
# Sort an array of strings (case-sensitive)
|
|
98
|
+
words = ["banana", "Apple", "cherry", "date"]
|
|
99
|
+
result = client.sort(words)
|
|
100
|
+
|
|
101
|
+
if result[:success]
|
|
102
|
+
puts "Sorted strings: #{result[:sorted_array]}"
|
|
103
|
+
# Output: ["Apple", "banana", "cherry", "date"]
|
|
104
|
+
end
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Sorting Mixed Types
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
# Sort arrays containing both numbers and strings
|
|
111
|
+
mixed_items = [42, "hello", 8, "world", 15.5, "Apple"]
|
|
112
|
+
result = client.sort(mixed_items)
|
|
113
|
+
|
|
114
|
+
if result[:success]
|
|
115
|
+
puts "Sorted mixed array: #{result[:sorted_array]}"
|
|
116
|
+
# Output: [8, 15.5, 42, "Apple", "hello", "world"]
|
|
117
|
+
# Note: Numbers come before strings in the sorted output
|
|
118
|
+
end
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Advanced Configuration
|
|
122
|
+
|
|
123
|
+
You can customize the model's behavior using the `temperature` parameter:
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
# Lower temperature (0.0) = more deterministic, consistent results
|
|
127
|
+
client = VibeSort::Client.new(
|
|
128
|
+
api_key: ENV['OPENAI_API_KEY'],
|
|
129
|
+
temperature: 0.0
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# Higher temperature = more creative/random (not recommended for sorting!)
|
|
133
|
+
creative_client = VibeSort::Client.new(
|
|
134
|
+
api_key: ENV['OPENAI_API_KEY'],
|
|
135
|
+
temperature: 0.5
|
|
136
|
+
)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Error Handling
|
|
140
|
+
|
|
141
|
+
VibeSort provides detailed error information:
|
|
142
|
+
|
|
143
|
+
```ruby
|
|
144
|
+
# Invalid input (unsupported types)
|
|
145
|
+
result = client.sort([5, :symbol, 12])
|
|
146
|
+
puts result[:error]
|
|
147
|
+
# => "Input must be an array of numbers or strings"
|
|
148
|
+
|
|
149
|
+
# Empty array
|
|
150
|
+
result = client.sort([])
|
|
151
|
+
puts result[:error]
|
|
152
|
+
# => "Input must be an array of numbers or strings"
|
|
153
|
+
|
|
154
|
+
# Invalid API key
|
|
155
|
+
bad_client = VibeSort::Client.new(api_key: "invalid-key")
|
|
156
|
+
result = bad_client.sort([1, 2, 3])
|
|
157
|
+
puts result[:error]
|
|
158
|
+
# => "OpenAI API error: Invalid API key"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Return Value Structure
|
|
162
|
+
|
|
163
|
+
The `sort` method always returns a hash with the following structure:
|
|
164
|
+
|
|
165
|
+
```ruby
|
|
166
|
+
{
|
|
167
|
+
success: true/false, # Boolean indicating success or failure
|
|
168
|
+
sorted_array: [...], # Array of sorted elements (empty on failure)
|
|
169
|
+
error: "..." # Error message (only present on failure)
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Sorting Behavior
|
|
174
|
+
|
|
175
|
+
- **Numbers only**: Sorted in ascending numerical order
|
|
176
|
+
- **Strings only**: Sorted in ascending alphabetical order (case-sensitive)
|
|
177
|
+
- **Mixed types**: Numbers come before strings; each group sorted within itself
|
|
178
|
+
|
|
179
|
+
## ๐๏ธ Architecture
|
|
180
|
+
|
|
181
|
+
VibeSort follows a clean, modular architecture:
|
|
182
|
+
|
|
183
|
+
- **`VibeSort::Client`**: Public interface for users
|
|
184
|
+
- **`VibeSort::Configuration`**: Manages API key and settings
|
|
185
|
+
- **`VibeSort::Sorter`**: Handles OpenAI API communication via Faraday
|
|
186
|
+
- **`VibeSort::ApiError`**: Custom exception for API-related errors
|
|
187
|
+
|
|
188
|
+
See the [Architecture Documentation](docs/architecture.md) for more details.
|
|
189
|
+
|
|
190
|
+
## ๐ Documentation
|
|
191
|
+
|
|
192
|
+
- [Architecture Overview](docs/architecture.md)
|
|
193
|
+
- [API Reference](docs/api_reference.md)
|
|
194
|
+
- [Development Guide](docs/development.md)
|
|
195
|
+
|
|
196
|
+
## ๐งช Development
|
|
197
|
+
|
|
198
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Install dependencies
|
|
202
|
+
bundle install
|
|
203
|
+
|
|
204
|
+
# Run tests
|
|
205
|
+
bundle exec rspec
|
|
206
|
+
|
|
207
|
+
# Run console for experimentation
|
|
208
|
+
bin/console
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Running Tests
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# Run all tests
|
|
215
|
+
bundle exec rspec
|
|
216
|
+
|
|
217
|
+
# Run with coverage
|
|
218
|
+
bundle exec rspec --format documentation
|
|
219
|
+
|
|
220
|
+
# Run specific test file
|
|
221
|
+
bundle exec rspec spec/vibe/sort_spec.rb
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## ๐ค Why Does This Exist?
|
|
225
|
+
|
|
226
|
+
This gem was created as an educational exercise to:
|
|
227
|
+
|
|
228
|
+
1. Explore the capabilities and limitations of LLMs for computational tasks
|
|
229
|
+
2. Demonstrate how to integrate OpenAI's API into Ruby applications
|
|
230
|
+
3. Provide a template for building Ruby gems with external API dependencies
|
|
231
|
+
4. Spark conversations about appropriate use cases for AI
|
|
232
|
+
|
|
233
|
+
**Please note**: This is intentionally inefficient and expensive compared to traditional sorting algorithms. It's a conversation starter, not a production solution!
|
|
234
|
+
|
|
235
|
+
## โก Performance Considerations
|
|
236
|
+
|
|
237
|
+
- **Latency**: Each sort requires an API call (typically 1-3 seconds)
|
|
238
|
+
- **Cost**: OpenAI API usage is metered and costs money
|
|
239
|
+
- **Reliability**: Depends on API availability and internet connection
|
|
240
|
+
- **Accuracy**: Generally accurate, but not guaranteed (unlike algorithmic sorting)
|
|
241
|
+
- **Scale**: Not suitable for large arrays or high-frequency sorting
|
|
242
|
+
|
|
243
|
+
Traditional sorting (e.g., Ruby's `Array#sort`) is:
|
|
244
|
+
|
|
245
|
+
- โก **10,000x faster** (microseconds vs seconds)
|
|
246
|
+
- ๐ฐ **Free** (no API costs)
|
|
247
|
+
- ๐ฏ **100% reliable** (deterministic algorithm)
|
|
248
|
+
- ๐ **Scalable** (handles millions of elements)
|
|
249
|
+
|
|
250
|
+
## ๐ Environment Variables
|
|
251
|
+
|
|
252
|
+
Set your OpenAI API key as an environment variable:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
export OPENAI_API_KEY='your-api-key-here'
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Or use a `.env` file with the `dotenv` gem:
|
|
259
|
+
|
|
260
|
+
```ruby
|
|
261
|
+
# Gemfile
|
|
262
|
+
gem 'dotenv'
|
|
263
|
+
|
|
264
|
+
# In your code
|
|
265
|
+
require 'dotenv/load'
|
|
266
|
+
client = VibeSort::Client.new(api_key: ENV['OPENAI_API_KEY'])
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## ๐ License
|
|
270
|
+
|
|
271
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
272
|
+
|
|
273
|
+
## ๐ Acknowledgments
|
|
274
|
+
|
|
275
|
+
- Built with [Faraday](https://lostisland.github.io/faraday/) for HTTP requests
|
|
276
|
+
- Powered by [OpenAI](https://openai.com/) GPT models
|
|
277
|
+
- Inspired by the absurdity and creativity of the AI era
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
**Remember**: With great AI power comes great responsibility (and API bills). Sort wisely! ๐งโโ๏ธ
|