vibe-sort 0.2.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 +32 -0
- data/README.md +91 -42
- data/docs/IMPLEMENTATION_PLAN.md +50 -50
- data/docs/README.md +20 -20
- data/docs/api_reference.md +68 -28
- data/docs/architecture.md +64 -46
- data/docs/development.md +3 -3
- data/docs/v0.2.0_UPDATE.md +37 -37
- data/lib/vibe/sort.rb +4 -8
- data/lib/vibe_sort/client.rb +17 -7
- data/lib/vibe_sort/configuration.rb +15 -6
- data/lib/vibe_sort/providers/anthropic.rb +68 -0
- data/lib/vibe_sort/providers/base.rb +147 -0
- data/lib/vibe_sort/providers/gemini.rb +43 -0
- data/lib/vibe_sort/providers/groq.rb +21 -0
- data/lib/vibe_sort/providers/openai.rb +41 -0
- data/lib/vibe_sort/providers/space_x_ai.rb +21 -0
- data/lib/vibe_sort/sorter.rb +10 -103
- data/lib/vibe_sort/version.rb +1 -1
- data/lib/vibe_sort.rb +6 -0
- metadata +17 -8
- data/lib/vibe/sort/version.rb +0 -7
- data/sig/vibe/sort.rbs +0 -6
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,38 @@ 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
|
+
|
|
17
|
+
## [0.3.0] - 2026-07-10
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **Multi-Provider Support**: Sort via OpenAI, Anthropic Claude, Google Gemini, Groq, or SpaceXAI (xAI) Grok
|
|
22
|
+
- `provider:` option on `VibeSort::Client.new` (`:openai` default, `:anthropic`, `:gemini`, `:groq`, `:spacexai`)
|
|
23
|
+
- `model:` option to override each provider's default model
|
|
24
|
+
- `VibeSort::Providers::Base` adapter layer with per-provider subclasses
|
|
25
|
+
- Anthropic adapter uses the Messages API with structured outputs (JSON schema), guaranteeing the response shape
|
|
26
|
+
- Gemini adapter uses `generateContent` with JSON response mode
|
|
27
|
+
- Groq and SpaceXAI adapters reuse the OpenAI-compatible Chat Completions wire format
|
|
28
|
+
- Provider-specific test suites backed by WebMock
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- `VibeSort::Sorter` is now a thin dispatcher to the configured provider adapter
|
|
33
|
+
- OpenAI default model updated from the deprecated `gpt-3.5-turbo-1106` to `gpt-4o-mini`
|
|
34
|
+
- Error messages are prefixed with the provider name (e.g. "Anthropic API error: ...")
|
|
35
|
+
- `temperature` is not sent to Anthropic (current Claude models reject the parameter)
|
|
36
|
+
|
|
37
|
+
### Notes
|
|
38
|
+
|
|
39
|
+
- Fully backward compatible: `VibeSort::Client.new(api_key: ...)` still defaults to OpenAI
|
|
40
|
+
- Still zero runtime dependencies beyond Faraday, all providers are called over plain HTTPS
|
|
41
|
+
|
|
10
42
|
## [0.2.0] - 2025-10-16
|
|
11
43
|
|
|
12
44
|
### Added
|
data/README.md
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# VibeSort
|
|
2
2
|
|
|
3
|
-
> **AI-powered array sorting using OpenAI
|
|
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
|
|
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
|
-
-
|
|
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
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## Requirements
|
|
25
26
|
|
|
26
27
|
- Ruby **3.0** or newer (MRI)
|
|
27
28
|
- Bundler **2.0+**
|
|
28
|
-
- An
|
|
29
|
+
- An API key for at least one supported provider (OpenAI, Anthropic, Google Gemini, Groq, or SpaceXAI)
|
|
29
30
|
- Internet connectivity (each sort performs a remote API call)
|
|
30
31
|
|
|
31
|
-
##
|
|
32
|
+
## Installation
|
|
32
33
|
|
|
33
34
|
Add this line to your application's Gemfile:
|
|
34
35
|
|
|
@@ -48,7 +49,7 @@ Or install it yourself as:
|
|
|
48
49
|
gem install vibe-sort
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
##
|
|
52
|
+
## Quick Start
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
55
|
export OPENAI_API_KEY="your-openai-api-key"
|
|
@@ -67,7 +68,7 @@ client.sort([34, 1, 'Apple', 8.5])
|
|
|
67
68
|
# => { success: true, sorted_array: [1, 8.5, 34, "Apple"] }
|
|
68
69
|
```
|
|
69
70
|
|
|
70
|
-
##
|
|
71
|
+
## Usage
|
|
71
72
|
|
|
72
73
|
### Basic Usage
|
|
73
74
|
|
|
@@ -82,12 +83,12 @@ numbers = [34, 1, 99, 15, 8]
|
|
|
82
83
|
result = client.sort(numbers)
|
|
83
84
|
|
|
84
85
|
if result[:success]
|
|
85
|
-
puts "
|
|
86
|
+
puts "Vibe Sort successful!"
|
|
86
87
|
puts "Original: #{numbers}"
|
|
87
88
|
puts "Sorted: #{result[:sorted_array]}"
|
|
88
89
|
# Output: [1, 8, 15, 34, 99]
|
|
89
90
|
else
|
|
90
|
-
puts "
|
|
91
|
+
puts "Vibe Sort failed: #{result[:error]}"
|
|
91
92
|
end
|
|
92
93
|
```
|
|
93
94
|
|
|
@@ -118,6 +119,46 @@ if result[:success]
|
|
|
118
119
|
end
|
|
119
120
|
```
|
|
120
121
|
|
|
122
|
+
### Choosing a Provider
|
|
123
|
+
|
|
124
|
+
VibeSort defaults to OpenAI, but any supported provider can be selected with the `provider:` option:
|
|
125
|
+
|
|
126
|
+
```ruby
|
|
127
|
+
# OpenAI (default)
|
|
128
|
+
client = VibeSort::Client.new(api_key: ENV['OPENAI_API_KEY'])
|
|
129
|
+
|
|
130
|
+
# Anthropic Claude
|
|
131
|
+
client = VibeSort::Client.new(provider: :anthropic, api_key: ENV['ANTHROPIC_API_KEY'])
|
|
132
|
+
|
|
133
|
+
# Google Gemini
|
|
134
|
+
client = VibeSort::Client.new(provider: :gemini, api_key: ENV['GEMINI_API_KEY'])
|
|
135
|
+
|
|
136
|
+
# Groq (fast open-model inference)
|
|
137
|
+
client = VibeSort::Client.new(provider: :groq, api_key: ENV['GROQ_API_KEY'])
|
|
138
|
+
|
|
139
|
+
# SpaceXAI (formerly xAI) Grok
|
|
140
|
+
client = VibeSort::Client.new(provider: :spacexai, api_key: ENV['XAI_API_KEY'])
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
| Provider | API | Default model | Override with `model:` |
|
|
144
|
+
|---|---|---|---|
|
|
145
|
+
| `:openai` | Chat Completions | `gpt-4o-mini` | any chat model |
|
|
146
|
+
| `:anthropic` | Messages | `claude-opus-4-8` | e.g. `claude-haiku-4-5` for cheaper sorts |
|
|
147
|
+
| `:gemini` | generateContent | `gemini-2.5-flash` | e.g. `gemini-2.5-pro` |
|
|
148
|
+
| `:groq` | Chat Completions (OpenAI-compatible) | `llama-3.3-70b-versatile` | any Groq-hosted model |
|
|
149
|
+
| `:spacexai` | Chat Completions (OpenAI-compatible) | `grok-4` | e.g. `grok-4.5` |
|
|
150
|
+
|
|
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
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
# Pick a specific model
|
|
155
|
+
client = VibeSort::Client.new(
|
|
156
|
+
provider: :anthropic,
|
|
157
|
+
api_key: ENV['ANTHROPIC_API_KEY'],
|
|
158
|
+
model: 'claude-haiku-4-5'
|
|
159
|
+
)
|
|
160
|
+
```
|
|
161
|
+
|
|
121
162
|
### Advanced Configuration
|
|
122
163
|
|
|
123
164
|
You can customize the model's behavior using the `temperature` parameter:
|
|
@@ -129,13 +170,15 @@ client = VibeSort::Client.new(
|
|
|
129
170
|
temperature: 0.0
|
|
130
171
|
)
|
|
131
172
|
|
|
132
|
-
# Higher temperature = more creative/random (not recommended for sorting
|
|
173
|
+
# Higher temperature = more creative/random (not recommended for sorting)
|
|
133
174
|
creative_client = VibeSort::Client.new(
|
|
134
175
|
api_key: ENV['OPENAI_API_KEY'],
|
|
135
176
|
temperature: 0.5
|
|
136
177
|
)
|
|
137
178
|
```
|
|
138
179
|
|
|
180
|
+
> **Note**: current Anthropic Claude models no longer accept a `temperature` parameter, so it is ignored when `provider: :anthropic` is used.
|
|
181
|
+
|
|
139
182
|
### Error Handling
|
|
140
183
|
|
|
141
184
|
VibeSort provides detailed error information:
|
|
@@ -176,24 +219,26 @@ The `sort` method always returns a hash with the following structure:
|
|
|
176
219
|
- **Strings only**: Sorted in ascending alphabetical order (case-sensitive)
|
|
177
220
|
- **Mixed types**: Numbers come before strings; each group sorted within itself
|
|
178
221
|
|
|
179
|
-
##
|
|
222
|
+
## Architecture
|
|
180
223
|
|
|
181
224
|
VibeSort follows a clean, modular architecture:
|
|
182
225
|
|
|
183
226
|
- **`VibeSort::Client`**: Public interface for users
|
|
184
|
-
- **`VibeSort::Configuration`**: Manages API key and settings
|
|
185
|
-
- **`VibeSort::Sorter`**:
|
|
227
|
+
- **`VibeSort::Configuration`**: Manages provider, API key, model, and settings
|
|
228
|
+
- **`VibeSort::Sorter`**: Dispatches to the configured provider adapter
|
|
229
|
+
- **`VibeSort::Providers::Base`**: Shared prompt, HTTP plumbing (Faraday), and response validation
|
|
230
|
+
- **`VibeSort::Providers::{OpenAI, Anthropic, Gemini, Groq, SpaceXAI}`**: Provider-specific request/response mapping
|
|
186
231
|
- **`VibeSort::ApiError`**: Custom exception for API-related errors
|
|
187
232
|
|
|
188
233
|
See the [Architecture Documentation](docs/architecture.md) for more details.
|
|
189
234
|
|
|
190
|
-
##
|
|
235
|
+
## Documentation
|
|
191
236
|
|
|
192
237
|
- [Architecture Overview](docs/architecture.md)
|
|
193
238
|
- [API Reference](docs/api_reference.md)
|
|
194
239
|
- [Development Guide](docs/development.md)
|
|
195
240
|
|
|
196
|
-
##
|
|
241
|
+
## Development
|
|
197
242
|
|
|
198
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.
|
|
199
244
|
|
|
@@ -221,38 +266,42 @@ bundle exec rspec --format documentation
|
|
|
221
266
|
bundle exec rspec spec/vibe/sort_spec.rb
|
|
222
267
|
```
|
|
223
268
|
|
|
224
|
-
##
|
|
269
|
+
## Why Does This Exist?
|
|
225
270
|
|
|
226
271
|
This gem was created as an educational exercise to:
|
|
227
272
|
|
|
228
273
|
1. Explore the capabilities and limitations of LLMs for computational tasks
|
|
229
|
-
2. Demonstrate how to integrate
|
|
274
|
+
2. Demonstrate how to integrate LLM APIs into Ruby applications
|
|
230
275
|
3. Provide a template for building Ruby gems with external API dependencies
|
|
231
276
|
4. Spark conversations about appropriate use cases for AI
|
|
232
277
|
|
|
233
|
-
**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.
|
|
234
279
|
|
|
235
|
-
##
|
|
280
|
+
## Performance Considerations
|
|
236
281
|
|
|
237
282
|
- **Latency**: Each sort requires an API call (typically 1-3 seconds)
|
|
238
|
-
- **Cost**:
|
|
283
|
+
- **Cost**: LLM API usage is metered and costs money
|
|
239
284
|
- **Reliability**: Depends on API availability and internet connection
|
|
240
285
|
- **Accuracy**: Generally accurate, but not guaranteed (unlike algorithmic sorting)
|
|
241
286
|
- **Scale**: Not suitable for large arrays or high-frequency sorting
|
|
242
287
|
|
|
243
288
|
Traditional sorting (e.g., Ruby's `Array#sort`) is:
|
|
244
289
|
|
|
245
|
-
-
|
|
246
|
-
-
|
|
247
|
-
-
|
|
248
|
-
-
|
|
290
|
+
- **10,000x faster** (microseconds vs seconds)
|
|
291
|
+
- **Free** (no API costs)
|
|
292
|
+
- **100% reliable** (deterministic algorithm)
|
|
293
|
+
- **Scalable** (handles millions of elements)
|
|
249
294
|
|
|
250
|
-
##
|
|
295
|
+
## Environment Variables
|
|
251
296
|
|
|
252
|
-
Set
|
|
297
|
+
Set the API key for your chosen provider as an environment variable:
|
|
253
298
|
|
|
254
299
|
```bash
|
|
255
|
-
export OPENAI_API_KEY='your-api-key-here'
|
|
300
|
+
export OPENAI_API_KEY='your-api-key-here' # provider: :openai (default)
|
|
301
|
+
export ANTHROPIC_API_KEY='your-api-key-here' # provider: :anthropic
|
|
302
|
+
export GEMINI_API_KEY='your-api-key-here' # provider: :gemini
|
|
303
|
+
export GROQ_API_KEY='your-api-key-here' # provider: :groq
|
|
304
|
+
export XAI_API_KEY='your-api-key-here' # provider: :spacexai
|
|
256
305
|
```
|
|
257
306
|
|
|
258
307
|
Or use a `.env` file with the `dotenv` gem:
|
|
@@ -266,16 +315,16 @@ require 'dotenv/load'
|
|
|
266
315
|
client = VibeSort::Client.new(api_key: ENV['OPENAI_API_KEY'])
|
|
267
316
|
```
|
|
268
317
|
|
|
269
|
-
##
|
|
318
|
+
## License
|
|
270
319
|
|
|
271
320
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
272
321
|
|
|
273
|
-
##
|
|
322
|
+
## Acknowledgments
|
|
274
323
|
|
|
275
324
|
- Built with [Faraday](https://lostisland.github.io/faraday/) for HTTP requests
|
|
276
|
-
- Powered by [OpenAI](https://openai.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
|
|
277
326
|
- Inspired by the absurdity and creativity of the AI era
|
|
278
327
|
|
|
279
328
|
---
|
|
280
329
|
|
|
281
|
-
**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! **
|