Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ tmp/
.bundle/
vendor/bundle/

# Development dependencies cloned locally
amazing_print/
openai-ruby/

# Temp demo scripts
demo2/

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

## [0.5.0] - 2025-12-05

### Breaking Changes

- **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.

### Added

- **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").

- **Improved console display**: `AI::Chat`, `AI::Message`, and `AI::Items` now display nicely in IRB and Rails console with colorized, formatted output via AmazingPrint.

- **HTML output for ERB templates**: All display objects have a `to_html` method for rendering in views. Includes dark terminal-style background for readability.

- **`AI::Message` class**: Messages are now `AI::Message` instances (a Hash subclass) with custom display methods.

- **`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.

- **TTY-aware display**: Console output automatically detects TTY and disables colors when output is piped or redirected.

- **New example**: `examples/16_get_items.rb` demonstrates inspecting conversation items including reasoning, web searches, and image generation.

## [0.4.0] - 2025-11-25

### Breaking Changes
Expand Down
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing

Thanks for contributing to `ai-chat`! This gem is intentionally beginner-friendly, so please keep public-facing docs and examples simple and progressively introduced.

## Development setup

- Ruby: `~> 3.2` (see `ai-chat.gemspec`)
- Install dependencies: `bundle install`

## Running the test suite

- Run unit specs: `bundle exec rspec`
- Integration specs make real API calls and require `OPENAI_API_KEY` (they are skipped automatically if it’s not set).
- Disable coverage locally (optional): `NO_COVERAGE=1 bundle exec rspec`

## Code style / quality

- Format/lint: `bundle exec standardrb --fix`
- Smell checks (optional): `bundle exec reek`

## Running examples (real API calls)

The `examples/` directory is both documentation and a practical validation suite.

1. Set `OPENAI_API_KEY` (or create a `.env` file in the repo root):
```bash
OPENAI_API_KEY=your_openai_api_key_here
```
2. Run a quick overview: `bundle exec ruby examples/01_quick.rb`
3. Run everything: `bundle exec ruby examples/all.rb`

## Documentation expectations

- If you change the public API, update `README.md`.
- If you change behavior in a user-visible way, update `CHANGELOG.md`.
- Keep examples easy to paste into IRB; use short variable names (`a`, `b`, `c`, …) to match existing style in `examples/`.

2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ai-chat (0.4.0)
ai-chat (0.5.0)
amazing_print (~> 1.8)
base64 (~> 0.1, > 0.1.1)
json (~> 2.0)
Expand Down
Loading