vibe-sort 0.3.0 โ 0.3.1
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/CHANGELOG.md +8 -1
- data/README.md +40 -40
- data/docs/IMPLEMENTATION_PLAN.md +50 -50
- data/docs/README.md +20 -20
- data/docs/architecture.md +6 -6
- data/docs/development.md +3 -3
- data/docs/v0.2.0_UPDATE.md +37 -37
- data/lib/vibe_sort/version.rb +1 -1
- metadata +9 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f7d0e027ef929afd808fecba7f64a697a87ff6be489bce20bf9a8da73334847
|
|
4
|
+
data.tar.gz: b59cb7de762f093a8a5c0ac702841b4bad42d68599a346135a69867af54b6407
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53ac2db8b8b227fd151542ed86a350aab7bf6e3a740347cef034348f175465f3e17b7f32b6ca868da4c300bc0ad7b681b5fcdc84375e58838115e0f0d34ec0ac
|
|
7
|
+
data.tar.gz: 604e37c539b045cf9ecc3ff12a88fa467514506fb9149a2e02d85278f5a2dbd468ecf0cacf9259922dca87d21cdff4fd7f247cfad8dcf5752e5289ae82a2662c
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-07-11
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Gemspec summary and description now list all five supported providers (OpenAI, Anthropic Claude, Google Gemini, Groq, SpaceXAI Grok)
|
|
15
|
+
- Added `documentation_uri` and `bug_tracker_uri` gem metadata links
|
|
16
|
+
|
|
10
17
|
## [0.3.0] - 2026-07-10
|
|
11
18
|
|
|
12
19
|
### Added
|
|
@@ -30,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
30
37
|
### Notes
|
|
31
38
|
|
|
32
39
|
- Fully backward compatible: `VibeSort::Client.new(api_key: ...)` still defaults to OpenAI
|
|
33
|
-
- Still zero runtime dependencies beyond Faraday
|
|
40
|
+
- Still zero runtime dependencies beyond Faraday, all providers are called over plain HTTPS
|
|
34
41
|
|
|
35
42
|
## [0.2.0] - 2025-10-16
|
|
36
43
|
|
data/README.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# VibeSort
|
|
2
2
|
|
|
3
3
|
> **AI-powered array sorting using OpenAI, Anthropic Claude, Google Gemini, Groq, or SpaceXAI Grok**
|
|
4
4
|
|
|
5
|
-
VibeSort is a proof-of-concept Ruby gem that demonstrates sorting arrays by leveraging LLM APIs. Instead of using traditional sorting algorithms, it asks an AI model to do the work
|
|
5
|
+
VibeSort is a proof-of-concept Ruby gem that demonstrates sorting arrays by leveraging LLM APIs. Instead of using traditional sorting algorithms, it asks an AI model to do the work. Supports the OpenAI Chat Completions API, the Anthropic Messages API, the Google Gemini API, and the OpenAI-compatible Groq and SpaceXAI (xAI) APIs, with zero dependencies beyond Faraday.
|
|
6
6
|
|
|
7
7
|
[](https://badge.fury.io/rb/vibe-sort)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Disclaimer
|
|
11
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
|
|
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
13
|
|
|
14
|
-
##
|
|
14
|
+
## Features
|
|
15
15
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
16
|
+
- **AI-Powered Sorting**: Uses OpenAI, Anthropic Claude, Google Gemini, Groq, or SpaceXAI Grok models to sort arrays
|
|
17
|
+
- **Multi-Provider**: Switch providers with a single `provider:` option, no extra dependencies
|
|
18
|
+
- **Simple Interface**: Clean, intuitive API with a single `sort` method
|
|
19
|
+
- **Configurable**: Supports custom model and temperature settings
|
|
20
|
+
- **Error Handling**: Comprehensive error handling with clear error messages
|
|
21
|
+
- **Structured Output**: Uses JSON mode for reliable, parsable responses
|
|
22
|
+
- **Type Validation**: Validates input and output to ensure data integrity
|
|
23
|
+
- **Mixed-Type Support**: Sorts arrays containing integers, floats, and strings
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Requirements
|
|
26
26
|
|
|
27
27
|
- Ruby **3.0** or newer (MRI)
|
|
28
28
|
- Bundler **2.0+**
|
|
29
|
-
- An API key for at least one supported provider (OpenAI, Anthropic,
|
|
29
|
+
- An API key for at least one supported provider (OpenAI, Anthropic, Google Gemini, Groq, or SpaceXAI)
|
|
30
30
|
- Internet connectivity (each sort performs a remote API call)
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Installation
|
|
33
33
|
|
|
34
34
|
Add this line to your application's Gemfile:
|
|
35
35
|
|
|
@@ -49,7 +49,7 @@ Or install it yourself as:
|
|
|
49
49
|
gem install vibe-sort
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
##
|
|
52
|
+
## Quick Start
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
55
|
export OPENAI_API_KEY="your-openai-api-key"
|
|
@@ -68,7 +68,7 @@ client.sort([34, 1, 'Apple', 8.5])
|
|
|
68
68
|
# => { success: true, sorted_array: [1, 8.5, 34, "Apple"] }
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
##
|
|
71
|
+
## Usage
|
|
72
72
|
|
|
73
73
|
### Basic Usage
|
|
74
74
|
|
|
@@ -83,12 +83,12 @@ numbers = [34, 1, 99, 15, 8]
|
|
|
83
83
|
result = client.sort(numbers)
|
|
84
84
|
|
|
85
85
|
if result[:success]
|
|
86
|
-
puts "
|
|
86
|
+
puts "Vibe Sort successful!"
|
|
87
87
|
puts "Original: #{numbers}"
|
|
88
88
|
puts "Sorted: #{result[:sorted_array]}"
|
|
89
89
|
# Output: [1, 8, 15, 34, 99]
|
|
90
90
|
else
|
|
91
|
-
puts "
|
|
91
|
+
puts "Vibe Sort failed: #{result[:error]}"
|
|
92
92
|
end
|
|
93
93
|
```
|
|
94
94
|
|
|
@@ -148,7 +148,7 @@ client = VibeSort::Client.new(provider: :spacexai, api_key: ENV['XAI_API_KEY'])
|
|
|
148
148
|
| `:groq` | Chat Completions (OpenAI-compatible) | `llama-3.3-70b-versatile` | any Groq-hosted model |
|
|
149
149
|
| `:spacexai` | Chat Completions (OpenAI-compatible) | `grok-4` | e.g. `grok-4.5` |
|
|
150
150
|
|
|
151
|
-
> **Groq
|
|
151
|
+
> **Groq is not Grok**: Groq is the independent fast-inference company (`api.groq.com`); Grok is SpaceXAI's model (`api.x.ai`). They are unrelated, and VibeSort supports both.
|
|
152
152
|
|
|
153
153
|
```ruby
|
|
154
154
|
# Pick a specific model
|
|
@@ -170,7 +170,7 @@ client = VibeSort::Client.new(
|
|
|
170
170
|
temperature: 0.0
|
|
171
171
|
)
|
|
172
172
|
|
|
173
|
-
# Higher temperature = more creative/random (not recommended for sorting
|
|
173
|
+
# Higher temperature = more creative/random (not recommended for sorting)
|
|
174
174
|
creative_client = VibeSort::Client.new(
|
|
175
175
|
api_key: ENV['OPENAI_API_KEY'],
|
|
176
176
|
temperature: 0.5
|
|
@@ -219,7 +219,7 @@ The `sort` method always returns a hash with the following structure:
|
|
|
219
219
|
- **Strings only**: Sorted in ascending alphabetical order (case-sensitive)
|
|
220
220
|
- **Mixed types**: Numbers come before strings; each group sorted within itself
|
|
221
221
|
|
|
222
|
-
##
|
|
222
|
+
## Architecture
|
|
223
223
|
|
|
224
224
|
VibeSort follows a clean, modular architecture:
|
|
225
225
|
|
|
@@ -227,18 +227,18 @@ VibeSort follows a clean, modular architecture:
|
|
|
227
227
|
- **`VibeSort::Configuration`**: Manages provider, API key, model, and settings
|
|
228
228
|
- **`VibeSort::Sorter`**: Dispatches to the configured provider adapter
|
|
229
229
|
- **`VibeSort::Providers::Base`**: Shared prompt, HTTP plumbing (Faraday), and response validation
|
|
230
|
-
- **`VibeSort::Providers::{OpenAI, Anthropic, Gemini}`**: Provider-specific request/response mapping
|
|
230
|
+
- **`VibeSort::Providers::{OpenAI, Anthropic, Gemini, Groq, SpaceXAI}`**: Provider-specific request/response mapping
|
|
231
231
|
- **`VibeSort::ApiError`**: Custom exception for API-related errors
|
|
232
232
|
|
|
233
233
|
See the [Architecture Documentation](docs/architecture.md) for more details.
|
|
234
234
|
|
|
235
|
-
##
|
|
235
|
+
## Documentation
|
|
236
236
|
|
|
237
237
|
- [Architecture Overview](docs/architecture.md)
|
|
238
238
|
- [API Reference](docs/api_reference.md)
|
|
239
239
|
- [Development Guide](docs/development.md)
|
|
240
240
|
|
|
241
|
-
##
|
|
241
|
+
## Development
|
|
242
242
|
|
|
243
243
|
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.
|
|
244
244
|
|
|
@@ -266,33 +266,33 @@ bundle exec rspec --format documentation
|
|
|
266
266
|
bundle exec rspec spec/vibe/sort_spec.rb
|
|
267
267
|
```
|
|
268
268
|
|
|
269
|
-
##
|
|
269
|
+
## Why Does This Exist?
|
|
270
270
|
|
|
271
271
|
This gem was created as an educational exercise to:
|
|
272
272
|
|
|
273
273
|
1. Explore the capabilities and limitations of LLMs for computational tasks
|
|
274
|
-
2. Demonstrate how to integrate
|
|
274
|
+
2. Demonstrate how to integrate LLM APIs into Ruby applications
|
|
275
275
|
3. Provide a template for building Ruby gems with external API dependencies
|
|
276
276
|
4. Spark conversations about appropriate use cases for AI
|
|
277
277
|
|
|
278
|
-
**Please note**: This is intentionally inefficient and expensive compared to traditional sorting algorithms. It's a conversation starter, not a production solution
|
|
278
|
+
**Please note**: This is intentionally inefficient and expensive compared to traditional sorting algorithms. It's a conversation starter, not a production solution.
|
|
279
279
|
|
|
280
|
-
##
|
|
280
|
+
## Performance Considerations
|
|
281
281
|
|
|
282
282
|
- **Latency**: Each sort requires an API call (typically 1-3 seconds)
|
|
283
|
-
- **Cost**:
|
|
283
|
+
- **Cost**: LLM API usage is metered and costs money
|
|
284
284
|
- **Reliability**: Depends on API availability and internet connection
|
|
285
285
|
- **Accuracy**: Generally accurate, but not guaranteed (unlike algorithmic sorting)
|
|
286
286
|
- **Scale**: Not suitable for large arrays or high-frequency sorting
|
|
287
287
|
|
|
288
288
|
Traditional sorting (e.g., Ruby's `Array#sort`) is:
|
|
289
289
|
|
|
290
|
-
-
|
|
291
|
-
-
|
|
292
|
-
-
|
|
293
|
-
-
|
|
290
|
+
- **10,000x faster** (microseconds vs seconds)
|
|
291
|
+
- **Free** (no API costs)
|
|
292
|
+
- **100% reliable** (deterministic algorithm)
|
|
293
|
+
- **Scalable** (handles millions of elements)
|
|
294
294
|
|
|
295
|
-
##
|
|
295
|
+
## Environment Variables
|
|
296
296
|
|
|
297
297
|
Set the API key for your chosen provider as an environment variable:
|
|
298
298
|
|
|
@@ -315,16 +315,16 @@ require 'dotenv/load'
|
|
|
315
315
|
client = VibeSort::Client.new(api_key: ENV['OPENAI_API_KEY'])
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
##
|
|
318
|
+
## License
|
|
319
319
|
|
|
320
320
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
321
321
|
|
|
322
|
-
##
|
|
322
|
+
## Acknowledgments
|
|
323
323
|
|
|
324
324
|
- Built with [Faraday](https://lostisland.github.io/faraday/) for HTTP requests
|
|
325
|
-
- Powered by [OpenAI](https://openai.com/), [Anthropic](https://www.anthropic.com/),
|
|
325
|
+
- Powered by [OpenAI](https://openai.com/), [Anthropic](https://www.anthropic.com/), [Google Gemini](https://ai.google.dev/), [Groq](https://groq.com/), and [SpaceXAI](https://x.ai/) models
|
|
326
326
|
- Inspired by the absurdity and creativity of the AI era
|
|
327
327
|
|
|
328
328
|
---
|
|
329
329
|
|
|
330
|
-
**Remember**: With great AI power comes great responsibility (and API bills). Sort wisely
|
|
330
|
+
**Remember**: With great AI power comes great responsibility (and API bills). Sort wisely.
|
data/docs/IMPLEMENTATION_PLAN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
This document outlines the complete implementation plan for the **VibeSort** Ruby gem - a proof-of-concept library that sorts number arrays using the OpenAI Chat Completions API.
|
|
6
6
|
|
|
7
|
-
**Status:**
|
|
7
|
+
**Status:** Complete (All tasks finished)
|
|
8
8
|
|
|
9
9
|
**Version:** 0.1.0
|
|
10
10
|
|
|
@@ -16,23 +16,23 @@ This document outlines the complete implementation plan for the **VibeSort** Rub
|
|
|
16
16
|
|
|
17
17
|
### Primary Goals
|
|
18
18
|
|
|
19
|
-
1.
|
|
20
|
-
2.
|
|
21
|
-
3.
|
|
22
|
-
4.
|
|
19
|
+
1. Create a functional Ruby gem that sorts arrays via OpenAI API
|
|
20
|
+
2. Demonstrate AI integration in Ruby applications
|
|
21
|
+
3. Provide clean, well-documented code as a learning resource
|
|
22
|
+
4. Follow Ruby gem best practices and conventions
|
|
23
23
|
|
|
24
24
|
### Non-Goals
|
|
25
25
|
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
26
|
+
- Production-ready sorting solution (this is a proof-of-concept)
|
|
27
|
+
- Performance optimization (intentionally uses AI for education)
|
|
28
|
+
- Support for non-numeric data types
|
|
29
|
+
- Local sorting fallback (requires API)
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
33
|
## Implementation Checklist
|
|
34
34
|
|
|
35
|
-
### Phase 1: Project Setup
|
|
35
|
+
### Phase 1: Project Setup
|
|
36
36
|
|
|
37
37
|
- [x] Initialize gem structure with Bundler
|
|
38
38
|
- [x] Configure gemspec with metadata and dependencies
|
|
@@ -40,7 +40,7 @@ This document outlines the complete implementation plan for the **VibeSort** Rub
|
|
|
40
40
|
- [x] Configure RSpec for testing
|
|
41
41
|
- [x] Add development dependencies (pry for debugging)
|
|
42
42
|
|
|
43
|
-
### Phase 2: Core Implementation
|
|
43
|
+
### Phase 2: Core Implementation
|
|
44
44
|
|
|
45
45
|
- [x] **VibeSort::Configuration** - API key and settings management
|
|
46
46
|
- API key validation
|
|
@@ -70,7 +70,7 @@ This document outlines the complete implementation plan for the **VibeSort** Rub
|
|
|
70
70
|
- Load all components
|
|
71
71
|
- Namespace definition
|
|
72
72
|
|
|
73
|
-
### Phase 3: Documentation
|
|
73
|
+
### Phase 3: Documentation
|
|
74
74
|
|
|
75
75
|
- [x] **README.md** - User-facing documentation
|
|
76
76
|
- Installation instructions
|
|
@@ -174,13 +174,13 @@ This document outlines the complete implementation plan for the **VibeSort** Rub
|
|
|
174
174
|
```
|
|
175
175
|
vibe-sort/
|
|
176
176
|
โโโ lib/
|
|
177
|
-
โ โโโ vibe_sort.rb
|
|
177
|
+
โ โโโ vibe_sort.rb Main entry point
|
|
178
178
|
โ โโโ vibe_sort/
|
|
179
|
-
โ โโโ client.rb
|
|
180
|
-
โ โโโ configuration.rb
|
|
181
|
-
โ โโโ error.rb
|
|
182
|
-
โ โโโ sorter.rb
|
|
183
|
-
โ โโโ version.rb
|
|
179
|
+
โ โโโ client.rb Public API
|
|
180
|
+
โ โโโ configuration.rb Config object
|
|
181
|
+
โ โโโ error.rb Custom exceptions
|
|
182
|
+
โ โโโ sorter.rb API communication
|
|
183
|
+
โ โโโ version.rb Version constant
|
|
184
184
|
โโโ spec/
|
|
185
185
|
โ โโโ spec_helper.rb โณ To be implemented
|
|
186
186
|
โ โโโ vibe_sort/
|
|
@@ -189,19 +189,19 @@ vibe-sort/
|
|
|
189
189
|
โ โโโ sorter_spec.rb โณ To be implemented
|
|
190
190
|
โ โโโ integration_spec.rb โณ To be implemented
|
|
191
191
|
โโโ docs/
|
|
192
|
-
โ โโโ README.md
|
|
193
|
-
โ โโโ architecture.md
|
|
194
|
-
โ โโโ api_reference.md
|
|
195
|
-
โ โโโ development.md
|
|
192
|
+
โ โโโ README.md Documentation index
|
|
193
|
+
โ โโโ architecture.md Architecture guide
|
|
194
|
+
โ โโโ api_reference.md API documentation
|
|
195
|
+
โ โโโ development.md Development guide
|
|
196
196
|
โโโ bin/
|
|
197
|
-
โ โโโ console
|
|
198
|
-
โ โโโ setup
|
|
199
|
-
โโโ Gemfile
|
|
200
|
-
โโโ Rakefile
|
|
201
|
-
โโโ vibe-sort.gemspec
|
|
202
|
-
โโโ README.md
|
|
203
|
-
โโโ CHANGELOG.md
|
|
204
|
-
โโโ LICENSE.txt
|
|
197
|
+
โ โโโ console Interactive console
|
|
198
|
+
โ โโโ setup Setup script
|
|
199
|
+
โโโ Gemfile Dependencies
|
|
200
|
+
โโโ Rakefile Rake tasks
|
|
201
|
+
โโโ vibe-sort.gemspec Gem specification
|
|
202
|
+
โโโ README.md User documentation
|
|
203
|
+
โโโ CHANGELOG.md Version history
|
|
204
|
+
โโโ LICENSE.txt MIT License
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
---
|
|
@@ -299,26 +299,26 @@ client = VibeSort::Client.new(
|
|
|
299
299
|
|
|
300
300
|
### API Key Management
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
**Implemented:**
|
|
303
303
|
- Environment variable support
|
|
304
304
|
- Configuration validation
|
|
305
305
|
- No hardcoded keys in examples
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
**User Responsibility:**
|
|
308
308
|
- Store keys securely
|
|
309
309
|
- Use .env files (not committed)
|
|
310
310
|
- Rotate keys regularly
|
|
311
311
|
|
|
312
312
|
### Input Validation
|
|
313
313
|
|
|
314
|
-
|
|
314
|
+
**Implemented:**
|
|
315
315
|
- Type checking (must be Array)
|
|
316
316
|
- Element validation (must be Numeric)
|
|
317
317
|
- Empty array rejection
|
|
318
318
|
|
|
319
319
|
### Output Validation
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
**Implemented:**
|
|
322
322
|
- Response structure validation
|
|
323
323
|
- Type checking on sorted array
|
|
324
324
|
- Numeric value verification
|
|
@@ -366,7 +366,7 @@ client = VibeSort::Client.new(
|
|
|
366
366
|
|
|
367
367
|
## Release Plan
|
|
368
368
|
|
|
369
|
-
### Version 0.1.0 (Initial Release)
|
|
369
|
+
### Version 0.1.0 (Initial Release)
|
|
370
370
|
|
|
371
371
|
**Release Date:** October 16, 2025
|
|
372
372
|
|
|
@@ -408,7 +408,7 @@ client = VibeSort::Client.new(
|
|
|
408
408
|
|
|
409
409
|
## Success Criteria
|
|
410
410
|
|
|
411
|
-
### Functional Requirements
|
|
411
|
+
### Functional Requirements
|
|
412
412
|
|
|
413
413
|
- [x] Successfully sort arrays of numbers
|
|
414
414
|
- [x] Handle invalid inputs gracefully
|
|
@@ -416,7 +416,7 @@ client = VibeSort::Client.new(
|
|
|
416
416
|
- [x] Integrate with OpenAI API
|
|
417
417
|
- [x] Support configuration options
|
|
418
418
|
|
|
419
|
-
### Non-Functional Requirements
|
|
419
|
+
### Non-Functional Requirements
|
|
420
420
|
|
|
421
421
|
- [x] Clear, comprehensive documentation
|
|
422
422
|
- [x] Clean, readable code
|
|
@@ -424,7 +424,7 @@ client = VibeSort::Client.new(
|
|
|
424
424
|
- [x] Ruby gem best practices
|
|
425
425
|
- [x] MIT License
|
|
426
426
|
|
|
427
|
-
### Documentation Requirements
|
|
427
|
+
### Documentation Requirements
|
|
428
428
|
|
|
429
429
|
- [x] Installation instructions
|
|
430
430
|
- [x] Usage examples
|
|
@@ -441,39 +441,39 @@ client = VibeSort::Client.new(
|
|
|
441
441
|
|
|
442
442
|
| Risk | Impact | Mitigation | Status |
|
|
443
443
|
|------|--------|------------|--------|
|
|
444
|
-
| API rate limits | High | Document limits, add retry logic |
|
|
445
|
-
| API downtime | High | Graceful error handling |
|
|
446
|
-
| API changes | Medium | Version pinning, monitoring |
|
|
447
|
-
| Cost overruns | Medium | Cost warnings in docs |
|
|
448
|
-
| Network issues | Medium | Timeout handling |
|
|
444
|
+
| API rate limits | High | Document limits, add retry logic | Documented |
|
|
445
|
+
| API downtime | High | Graceful error handling | Implemented |
|
|
446
|
+
| API changes | Medium | Version pinning, monitoring | Documented |
|
|
447
|
+
| Cost overruns | Medium | Cost warnings in docs | Documented |
|
|
448
|
+
| Network issues | Medium | Timeout handling | Implemented |
|
|
449
449
|
|
|
450
450
|
### Business Risks
|
|
451
451
|
|
|
452
452
|
| Risk | Impact | Mitigation | Status |
|
|
453
453
|
|------|--------|------------|--------|
|
|
454
|
-
| Misuse in production | Low | Clear disclaimers |
|
|
455
|
-
| API cost complaints | Low | Cost transparency |
|
|
456
|
-
| Performance expectations | Low | Performance warnings |
|
|
454
|
+
| Misuse in production | Low | Clear disclaimers | Documented |
|
|
455
|
+
| API cost complaints | Low | Cost transparency | Documented |
|
|
456
|
+
| Performance expectations | Low | Performance warnings | Documented |
|
|
457
457
|
|
|
458
458
|
---
|
|
459
459
|
|
|
460
460
|
## Lessons Learned
|
|
461
461
|
|
|
462
|
-
### What Went Well
|
|
462
|
+
### What Went Well
|
|
463
463
|
|
|
464
464
|
1. Clean architecture with separation of concerns
|
|
465
465
|
2. Comprehensive documentation from the start
|
|
466
466
|
3. Consistent error handling strategy
|
|
467
467
|
4. Simple, intuitive API design
|
|
468
468
|
|
|
469
|
-
### What Could Be Improved
|
|
469
|
+
### What Could Be Improved
|
|
470
470
|
|
|
471
471
|
1. Test suite should have been implemented first (TDD)
|
|
472
472
|
2. CI/CD pipeline not yet set up
|
|
473
473
|
3. No integration with GitHub Actions
|
|
474
474
|
4. Missing code coverage reporting
|
|
475
475
|
|
|
476
|
-
### Best Practices Applied
|
|
476
|
+
### Best Practices Applied
|
|
477
477
|
|
|
478
478
|
1. **Separation of Concerns:** Client, Configuration, Sorter, Error
|
|
479
479
|
2. **Dependency Injection:** Configuration passed to Sorter
|
|
@@ -513,7 +513,7 @@ client = VibeSort::Client.new(
|
|
|
513
513
|
|
|
514
514
|
The VibeSort gem v0.1.0 is complete and ready for release. All core functionality has been implemented, tested manually, and thoroughly documented. The gem serves as both a proof-of-concept for AI integration and an educational resource for Ruby developers.
|
|
515
515
|
|
|
516
|
-
**Status:**
|
|
516
|
+
**Status:** Ready for Release
|
|
517
517
|
|
|
518
518
|
**Next Milestone:** v0.2.0 with comprehensive test suite
|
|
519
519
|
|
data/docs/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Welcome to the VibeSort documentation! This directory contains comprehensive guides for using, understanding, and contributing to the VibeSort gem.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Documentation Overview
|
|
6
6
|
|
|
7
7
|
### [Architecture Overview](architecture.md)
|
|
8
8
|
|
|
@@ -52,7 +52,7 @@ Welcome to the VibeSort documentation! This directory contains comprehensive gui
|
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
55
|
-
##
|
|
55
|
+
## Quick Links
|
|
56
56
|
|
|
57
57
|
### For Users
|
|
58
58
|
|
|
@@ -76,7 +76,7 @@ Welcome to the VibeSort documentation! This directory contains comprehensive gui
|
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
79
|
-
##
|
|
79
|
+
## Reading Guide
|
|
80
80
|
|
|
81
81
|
### I want to use VibeSort in my project
|
|
82
82
|
|
|
@@ -107,25 +107,25 @@ Welcome to the VibeSort documentation! This directory contains comprehensive gui
|
|
|
107
107
|
|
|
108
108
|
---
|
|
109
109
|
|
|
110
|
-
##
|
|
110
|
+
## Architecture at a Glance
|
|
111
111
|
|
|
112
112
|
```
|
|
113
113
|
User Application
|
|
114
|
-
|
|
114
|
+
|
|
115
115
|
VibeSort::Client (validates input, handles errors)
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
VibeSort::Configuration (stores API key, settings)
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
VibeSort::Sorter (communicates with OpenAI)
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
OpenAI API (GPT model processes request)
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
Sorted Array (returned to user)
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
---
|
|
127
127
|
|
|
128
|
-
##
|
|
128
|
+
## Example Usage
|
|
129
129
|
|
|
130
130
|
```ruby
|
|
131
131
|
require 'vibe_sort'
|
|
@@ -148,7 +148,7 @@ For more examples, see the [README](../README.md) or [API Reference](api_referen
|
|
|
148
148
|
|
|
149
149
|
---
|
|
150
150
|
|
|
151
|
-
##
|
|
151
|
+
## Key Concepts
|
|
152
152
|
|
|
153
153
|
### Configuration
|
|
154
154
|
|
|
@@ -175,7 +175,7 @@ VibeSort never raises exceptions to user code. All errors are caught and returne
|
|
|
175
175
|
|
|
176
176
|
---
|
|
177
177
|
|
|
178
|
-
##
|
|
178
|
+
## Contributing
|
|
179
179
|
|
|
180
180
|
We welcome contributions! Please see:
|
|
181
181
|
|
|
@@ -185,22 +185,22 @@ We welcome contributions! Please see:
|
|
|
185
185
|
|
|
186
186
|
---
|
|
187
187
|
|
|
188
|
-
##
|
|
188
|
+
## Support
|
|
189
189
|
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
190
|
+
- [Report a Bug](https://github.com/chayut/vibe-sort/issues/new?labels=bug)
|
|
191
|
+
- [Request a Feature](https://github.com/chayut/vibe-sort/issues/new?labels=enhancement)
|
|
192
|
+
- [Read the Docs](README.md)
|
|
193
|
+
- [Discussions](https://github.com/chayut/vibe-sort/discussions)
|
|
194
194
|
|
|
195
195
|
---
|
|
196
196
|
|
|
197
|
-
##
|
|
197
|
+
## License
|
|
198
198
|
|
|
199
199
|
VibeSort is released under the [MIT License](../LICENSE.txt).
|
|
200
200
|
|
|
201
201
|
---
|
|
202
202
|
|
|
203
|
-
##
|
|
203
|
+
## Acknowledgments
|
|
204
204
|
|
|
205
205
|
- Built with [Faraday](https://lostisland.github.io/faraday/)
|
|
206
206
|
- Powered by [OpenAI](https://openai.com/)
|
|
@@ -208,4 +208,4 @@ VibeSort is released under the [MIT License](../LICENSE.txt).
|
|
|
208
208
|
|
|
209
209
|
---
|
|
210
210
|
|
|
211
|
-
**Happy Sorting!
|
|
211
|
+
**Happy Sorting! **
|
data/docs/architecture.md
CHANGED
|
@@ -119,11 +119,11 @@ VibeSort follows a layered architecture with clear separation of concerns:
|
|
|
119
119
|
**Adapter hooks** (implemented per provider): `provider_name`, `endpoint`, `headers`, `build_payload`, `extract_content`
|
|
120
120
|
|
|
121
121
|
**Adapters and default models**:
|
|
122
|
-
- `Providers::OpenAI
|
|
123
|
-
- `Providers::Anthropic
|
|
124
|
-
- `Providers::Gemini
|
|
125
|
-
- `Providers::Groq
|
|
126
|
-
- `Providers::SpaceXAI
|
|
122
|
+
- `Providers::OpenAI`: Chat Completions, `gpt-4o-mini`
|
|
123
|
+
- `Providers::Anthropic`: Messages API with structured outputs (JSON schema), `claude-opus-4-8`
|
|
124
|
+
- `Providers::Gemini`: generateContent with JSON response mode, `gemini-2.5-flash`
|
|
125
|
+
- `Providers::Groq`: OpenAI-compatible (subclasses `Providers::OpenAI`), `llama-3.3-70b-versatile`
|
|
126
|
+
- `Providers::SpaceXAI`: OpenAI-compatible (subclasses `Providers::OpenAI`), `grok-4`
|
|
127
127
|
|
|
128
128
|
### VibeSort::ApiError
|
|
129
129
|
|
|
@@ -244,7 +244,7 @@ VibeSort follows a layered architecture with clear separation of concerns:
|
|
|
244
244
|
## Dependencies
|
|
245
245
|
|
|
246
246
|
### Runtime
|
|
247
|
-
- **faraday** (~> 2.0): HTTP client library
|
|
247
|
+
- **faraday** (~> 2.0): HTTP client library, the only runtime dependency; all providers are called over plain HTTPS
|
|
248
248
|
|
|
249
249
|
### Development
|
|
250
250
|
- **rspec** (~> 3.0): Testing framework
|
data/docs/development.md
CHANGED
|
@@ -521,8 +521,8 @@ Document all public methods:
|
|
|
521
521
|
# @return [Hash] Result hash with :success, :sorted_array, :error keys
|
|
522
522
|
#
|
|
523
523
|
# @example
|
|
524
|
-
#
|
|
525
|
-
#
|
|
524
|
+
# client.sort([5, 2, 8])
|
|
525
|
+
# # => { success: true, sorted_array: [2, 5, 8] }
|
|
526
526
|
def sort(array)
|
|
527
527
|
# ...
|
|
528
528
|
end
|
|
@@ -563,4 +563,4 @@ Before submitting a PR:
|
|
|
563
563
|
- Read the documentation
|
|
564
564
|
- Ask in the community
|
|
565
565
|
|
|
566
|
-
Happy coding!
|
|
566
|
+
Happy coding!
|
data/docs/v0.2.0_UPDATE.md
CHANGED
|
@@ -6,23 +6,23 @@ VibeSort has been updated to **version 0.2.0** with support for sorting arrays c
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## What Changed
|
|
10
10
|
|
|
11
11
|
### Core Functionality
|
|
12
12
|
|
|
13
13
|
#### Before (v0.1.0)
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
14
|
+
- Sort arrays of numbers (integers and floats)
|
|
15
|
+
- Strings not supported
|
|
16
|
+
- Mixed-type arrays rejected
|
|
17
17
|
|
|
18
18
|
#### After (v0.2.0)
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
19
|
+
- Sort arrays of numbers (integers and floats)
|
|
20
|
+
- Sort arrays of strings (case-sensitive)
|
|
21
|
+
- Sort mixed-type arrays (numbers + strings)
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Technical Changes
|
|
26
26
|
|
|
27
27
|
### 1. Input Validation (`VibeSort::Client`)
|
|
28
28
|
|
|
@@ -114,7 +114,7 @@ end
|
|
|
114
114
|
|
|
115
115
|
---
|
|
116
116
|
|
|
117
|
-
##
|
|
117
|
+
## New Usage Examples
|
|
118
118
|
|
|
119
119
|
### Sorting Strings
|
|
120
120
|
|
|
@@ -141,24 +141,24 @@ puts result[:sorted_array]
|
|
|
141
141
|
|
|
142
142
|
---
|
|
143
143
|
|
|
144
|
-
##
|
|
144
|
+
## Sorting Rules
|
|
145
145
|
|
|
146
146
|
The AI follows these standard sorting conventions:
|
|
147
147
|
|
|
148
148
|
1. **Numbers Only**: Ascending numerical order
|
|
149
|
-
- `[5, 2, 8, 1]`
|
|
149
|
+
- `[5, 2, 8, 1]` `[1, 2, 5, 8]`
|
|
150
150
|
|
|
151
151
|
2. **Strings Only**: Ascending alphabetical order (case-sensitive)
|
|
152
|
-
- `["banana", "Apple", "cherry"]`
|
|
152
|
+
- `["banana", "Apple", "cherry"]` `["Apple", "banana", "cherry"]`
|
|
153
153
|
- Capital letters come before lowercase in ASCII ordering
|
|
154
154
|
|
|
155
155
|
3. **Mixed Types**: Numbers first, then strings
|
|
156
|
-
- `[42, "hello", 8, "world"]`
|
|
156
|
+
- `[42, "hello", 8, "world"]` `[8, 42, "hello", "world"]`
|
|
157
157
|
- Each group is sorted within itself
|
|
158
158
|
|
|
159
159
|
---
|
|
160
160
|
|
|
161
|
-
##
|
|
161
|
+
## Documentation Updates
|
|
162
162
|
|
|
163
163
|
### Updated Files
|
|
164
164
|
|
|
@@ -185,7 +185,7 @@ The AI follows these standard sorting conventions:
|
|
|
185
185
|
|
|
186
186
|
---
|
|
187
187
|
|
|
188
|
-
##
|
|
188
|
+
## Backward Compatibility
|
|
189
189
|
|
|
190
190
|
**Good News:** This update is **fully backward compatible**!
|
|
191
191
|
|
|
@@ -203,7 +203,7 @@ result = client.sort([5, 2, 8, 1, 9])
|
|
|
203
203
|
|
|
204
204
|
---
|
|
205
205
|
|
|
206
|
-
##
|
|
206
|
+
## Testing Recommendations
|
|
207
207
|
|
|
208
208
|
When upgrading to v0.2.0, test these scenarios:
|
|
209
209
|
|
|
@@ -237,7 +237,7 @@ client.sort([1, { key: "value" }]) # Contains hash
|
|
|
237
237
|
|
|
238
238
|
---
|
|
239
239
|
|
|
240
|
-
##
|
|
240
|
+
## Implementation Notes
|
|
241
241
|
|
|
242
242
|
### Why These Changes?
|
|
243
243
|
|
|
@@ -263,27 +263,27 @@ The OpenAI GPT model (gpt-3.5-turbo-1106) handles mixed-type sorting intelligent
|
|
|
263
263
|
|
|
264
264
|
---
|
|
265
265
|
|
|
266
|
-
##
|
|
266
|
+
## Architecture Remains Clean
|
|
267
267
|
|
|
268
268
|
The core architecture is unchanged:
|
|
269
269
|
|
|
270
270
|
```
|
|
271
271
|
User Application
|
|
272
|
-
|
|
272
|
+
|
|
273
273
|
VibeSort::Client (validates input)
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
VibeSort::Configuration (stores settings)
|
|
276
|
-
|
|
276
|
+
|
|
277
277
|
VibeSort::Sorter (communicates with OpenAI)
|
|
278
|
-
|
|
278
|
+
|
|
279
279
|
OpenAI API (processes request)
|
|
280
|
-
|
|
280
|
+
|
|
281
281
|
Sorted Array (returned to user)
|
|
282
282
|
```
|
|
283
283
|
|
|
284
284
|
---
|
|
285
285
|
|
|
286
|
-
##
|
|
286
|
+
## Upgrade Instructions
|
|
287
287
|
|
|
288
288
|
### Using Bundler
|
|
289
289
|
|
|
@@ -307,7 +307,7 @@ gem install vibe-sort -v 0.2.0
|
|
|
307
307
|
|
|
308
308
|
---
|
|
309
309
|
|
|
310
|
-
##
|
|
310
|
+
## Known Limitations
|
|
311
311
|
|
|
312
312
|
Same limitations as v0.1.0:
|
|
313
313
|
|
|
@@ -326,7 +326,7 @@ Same limitations as v0.1.0:
|
|
|
326
326
|
|
|
327
327
|
---
|
|
328
328
|
|
|
329
|
-
##
|
|
329
|
+
## Future Enhancements
|
|
330
330
|
|
|
331
331
|
Potential features for future versions:
|
|
332
332
|
|
|
@@ -348,27 +348,27 @@ Potential features for future versions:
|
|
|
348
348
|
|
|
349
349
|
---
|
|
350
350
|
|
|
351
|
-
##
|
|
351
|
+
## Support
|
|
352
352
|
|
|
353
|
-
-
|
|
354
|
-
-
|
|
355
|
-
-
|
|
353
|
+
- [Report Issues](https://github.com/chayut/vibe-sort/issues)
|
|
354
|
+
- [Feature Requests](https://github.com/chayut/vibe-sort/issues/new?labels=enhancement)
|
|
355
|
+
- [Documentation](https://github.com/chayut/vibe-sort/tree/main/docs)
|
|
356
356
|
|
|
357
357
|
---
|
|
358
358
|
|
|
359
|
-
##
|
|
359
|
+
## Summary
|
|
360
360
|
|
|
361
361
|
Version 0.2.0 expands VibeSort's capabilities while maintaining:
|
|
362
362
|
|
|
363
|
-
-
|
|
364
|
-
-
|
|
365
|
-
-
|
|
366
|
-
-
|
|
367
|
-
-
|
|
363
|
+
- Same clean API
|
|
364
|
+
- Same architecture
|
|
365
|
+
- Full backward compatibility
|
|
366
|
+
- Same performance characteristics
|
|
367
|
+
- Comprehensive documentation
|
|
368
368
|
|
|
369
369
|
The gem now handles a wider variety of data types, making it more versatile for educational purposes and demonstrations.
|
|
370
370
|
|
|
371
|
-
**Happy Sorting!**
|
|
371
|
+
**Happy Sorting!**
|
|
372
372
|
|
|
373
373
|
---
|
|
374
374
|
|
data/lib/vibe_sort/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vibe-sort
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chayut Orapinpatipat
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -25,8 +25,9 @@ dependencies:
|
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '2.0'
|
|
27
27
|
description: A proof-of-concept Ruby gem that sorts arrays by leveraging LLM APIs
|
|
28
|
-
(OpenAI Chat Completions, Anthropic Messages, Google Gemini
|
|
29
|
-
can be used for computational
|
|
28
|
+
(OpenAI Chat Completions, Anthropic Messages, Google Gemini, and the OpenAI-compatible
|
|
29
|
+
Groq and SpaceXAI Grok APIs). Demonstrates how AI can be used for computational
|
|
30
|
+
tasks.
|
|
30
31
|
email:
|
|
31
32
|
- chayut_o@hotmail.com
|
|
32
33
|
executables: []
|
|
@@ -65,6 +66,8 @@ metadata:
|
|
|
65
66
|
homepage_uri: https://github.com/chayuto/vibe-sort
|
|
66
67
|
source_code_uri: https://github.com/chayuto/vibe-sort
|
|
67
68
|
changelog_uri: https://github.com/chayuto/vibe-sort/blob/main/CHANGELOG.md
|
|
69
|
+
documentation_uri: https://rubydoc.info/gems/vibe-sort
|
|
70
|
+
bug_tracker_uri: https://github.com/chayuto/vibe-sort/issues
|
|
68
71
|
rubygems_mfa_required: 'true'
|
|
69
72
|
post_install_message:
|
|
70
73
|
rdoc_options: []
|
|
@@ -84,5 +87,6 @@ requirements: []
|
|
|
84
87
|
rubygems_version: 3.5.22
|
|
85
88
|
signing_key:
|
|
86
89
|
specification_version: 4
|
|
87
|
-
summary: AI-powered array sorting using OpenAI, Anthropic Claude,
|
|
90
|
+
summary: AI-powered array sorting using OpenAI, Anthropic Claude, Google Gemini, Groq,
|
|
91
|
+
or SpaceXAI Grok
|
|
88
92
|
test_files: []
|