Skip to content

Conversation

@obie
Copy link
Owner

@obie obie commented Jun 20, 2025

Summary

  • Replaced Raix dependency with direct API client implementations for better control and clarity
  • Added three new model adapters: Anthropic, OpenAI, and OpenRouter
  • Fixed rubocop issues and improved console experience

Changes

Removed Dependencies

  • Removed raix gem dependency

Added Dependencies

  • ruby-openai (~> 7.0) - Official OpenAI Ruby client
  • anthropic (~> 0.3) - Official Anthropic Ruby client
  • open_router (~> 0.3) - OpenRouter API client

New Model Adapters

  1. Desiru::Models::Anthropic - Direct integration with Anthropic's Claude API
  2. Desiru::Models::OpenAI - Direct integration with OpenAI's API with dynamic model fetching
  3. Desiru::Models::OpenRouter - Integration with OpenRouter for access to multiple models

Key Features

  • Dynamic model fetching for OpenAI and OpenRouter (cached for 1 hour)
  • Proper error handling for each provider
  • Consistent interface across all adapters
  • Increased default max_tokens from 1000 to 4096 to prevent truncated responses

Console Improvements

  • Added dotenv gem for loading environment variables from .env file
  • Better error messages when configuration fails
  • Pre-loaded common modules ($predict, $cot) for quick experimentation
  • Added debug_call helper to inspect raw LLM responses
  • Fixed namespace issues by including necessary modules

Updated Files

  • All example files updated to use new model classes
  • .env.example includes OpenRouter configuration
  • bin/console and bin/examples support all three providers
  • Fixed prompt formatting in ChainOfThought and Predict modules for better LLM responses

Rubocop Compliance

  • Fixed all 30 rubocop offenses
  • All tests pass

Testing

# Configure your API key in .env
echo "ANTHROPIC_API_KEY=your-key-here" >> .env

# Try the console
bin/console

# In console:
cot = ChainOfThought.new(Signature.new('problem -> solution'))
result = cot.call(problem: "How do I reverse a string in Ruby?")
puts result.solution

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

obie and others added 7 commits June 19, 2025 10:32
- Changed required_ruby_version from 3.4.0 to 3.2.0 in gemspec
- Restored CI testing for Ruby 3.2.6, 3.3.6, and 3.4.2

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Updated required_ruby_version to 3.3.0 in gemspec
- Updated TargetRubyVersion to 3.3 in .rubocop.yml to match
- Removed Ruby 3.2.6 from CI matrix
- Fixed rubocop Gemspec/RequiredRubyVersion warning

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Updated job tests to work with MockRedis in CI environment
- Changed from instance_double expectations to actual MockRedis usage
- Added flushdb to ensure clean state between tests
- All tests now pass in both local and CI environments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@obie obie merged commit 795a18b into main Jun 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants