Skip to content

[BUG] RubyLLM.models.refresh! raises ArgumentError: comparison of Array with Array failed (ArgumentError) #270

@K4sku

Description

@K4sku

Basic checks

  • I searched existing issues - this hasn't been reported
  • I can reproduce this consistently
  • This is a RubyLLM bug, not my application code

What's broken?

Running bundle exec rails runner "RubyLLM.models.refresh!" raises ArgumentError

How to reproduce

  1. Install RubyLLM gem
  2. Run bundle exec rails runner "RubyLLM.models.refresh!"

Expected behavior

The models should be updated.
No errors would be raised.

What actually happened

It raises error

ArgumentError: comparison of Array with Array failed (ArgumentError)
  from ruby_llm/models.rb:123:in `sort_by'
  from ruby_llm/models.rb:123:in `merge_models'
  from ruby_llm/models.rb:34:in `refresh!'
  from ruby_llm/models.rb:208:in `refresh!'
  from rails/commands/runner/runner_command.rb:49:in `<main>'
  from rails/commands/runner/runner_command.rb:49:in `eval'
  from rails/commands/runner/runner_command.rb:49:in `block in perform'
  from active_support/execution_wrapper.rb:91:in `wrap'
  from rails/commands/runner/runner_command.rb:70:in `conditional_executor'
  from rails/commands/runner/runner_command.rb:48:in `perform'
  from thor/command.rb:28:in `run'
  from thor/invocation.rb:127:in `invoke_command'
  from rails/command/base.rb:178:in `invoke_command'
  from thor.rb:538:in `dispatch'
  from rails/command/base.rb:73:in `perform'
  from rails/command.rb:71:in `block in invoke'
  from rails/command.rb:149:in `with_argv'
  from rails/command.rb:69:in `invoke'
  from rails/commands.rb:18:in `<top (required)>'
  from bundled_gems.rb:69:in `require'
  from bundled_gems.rb:69:in `block (2 levels) in replace_require'
  from bin/rails:4:in `<main>'

Environment

  • Ruby version 3.3.7
  • RubyLLM version 1.3.1
  • Providers configured: OpenAI
  • OS: macOS locally, some linux on Heroku

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions