Skip to content

Commit 3c4a734

Browse files
committed
Improve inspect output for IRB, Rails console, ERB
- Add AI::Message class (Hash subclass) with custom display - Add AI::Items class (SimpleDelegator) wrapping API response - Rename items to get_items to indicate API call - Enable reasoning summaries when reasoning_effort is set - Add to_html methods with dark terminal-style background - TTY-aware colorization (disabled when piped/redirected) - Add examples/16_get_items.rb demonstrating item inspection
1 parent 308c9f5 commit 3c4a734

17 files changed

+798
-176
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ tmp/
1515
.bundle/
1616
vendor/bundle/
1717

18-
# Development dependencies cloned locally
19-
amazing_print/
20-
openai-ruby/
21-
2218
# Temp demo scripts
2319
demo2/
2420

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.0] - 2025-12-05
9+
10+
### Breaking Changes
11+
12+
- **Renamed `items` to `get_items`**: The method now clearly indicates it makes an API call. Returns an `AI::Items` wrapper that delegates to the underlying response while providing nice display formatting.
13+
14+
### Added
15+
16+
- **Reasoning summaries**: When `reasoning_effort` is set, the API now returns chain-of-thought summaries in `get_items`. These show the model's reasoning process (e.g., "Planning Ruby version search", "Confirming image tool usage").
17+
18+
- **Improved console display**: `AI::Chat`, `AI::Message`, and `AI::Items` now display nicely in IRB and Rails console with colorized, formatted output via AmazingPrint.
19+
20+
- **HTML output for ERB templates**: All display objects have a `to_html` method for rendering in views. Includes dark terminal-style background for readability.
21+
22+
- **`AI::Message` class**: Messages are now `AI::Message` instances (a Hash subclass) with custom display methods.
23+
24+
- **`AI::Items` class**: Wraps the conversation items API response with nice display methods while delegating all other methods (like `.data`, `.has_more`, etc.) to the underlying response.
25+
26+
- **TTY-aware display**: Console output automatically detects TTY and disables colors when output is piped or redirected.
27+
28+
- **New example**: `examples/16_get_items.rb` demonstrates inspecting conversation items including reasoning, web searches, and image generation.
29+
830
## [0.4.0] - 2025-11-25
931

1032
### Breaking Changes

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
ai-chat (0.4.0)
4+
ai-chat (0.5.0)
55
amazing_print (~> 1.8)
66
base64 (~> 0.1, > 0.1.1)
77
json (~> 2.0)

0 commit comments

Comments
 (0)