Skip to content

Fix compatibility issue with URL attachments wrong number of arguments#250

Merged
crmne merged 3 commits intocrmne:mainfrom
DustinFisher:fix-ruby-3.3-url-attachment-compatibility
Jul 16, 2025
Merged

Fix compatibility issue with URL attachments wrong number of arguments#250
crmne merged 3 commits intocrmne:mainfrom
DustinFisher:fix-ruby-3.3-url-attachment-compatibility

Conversation

@DustinFisher
Copy link
Contributor

  • Fix ArgumentError: wrong number of arguments (given 2, expected 0..1) that occurs when Marcel processes URI objects
  • Use filename-based MIME detection for URLs instead of passing URI objects to Marcel
  • Add test that reproduces the issue and validates the fix
  • Maintains backward compatibility and improves performance by avoiding network calls
Screenshot 2025-06-16 at 9 34 13 AM

What this does

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Performance improvement

Scope check

  • I read the Contributing Guide
  • This aligns with RubyLLM's focus on LLM communication
  • This isn't application-specific logic that belongs in user code
  • This benefits most users, not just my specific use case

Quality check

  • I ran overcommit --install and all hooks pass
  • I tested my changes thoroughly
  • I updated documentation if needed
  • I didn't modify auto-generated files manually (models.json, aliases.json)

API changes

  • Breaking change
  • New public methods/classes
  • Changed method signatures
  • No API changes

Related issues

Fixes #247

- Fix ArgumentError: wrong number of arguments (given 2, expected 0..1)
  that occurs when Marcel processes URI objects in Ruby 3.3+
- Use filename-based MIME detection for URLs instead of passing URI objects to Marcel
- Add test that reproduces the issue and validates the fix
- Maintains backward compatibility and improves performance by avoiding network calls
Copy link
Owner

@crmne crmne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

I suggested a readability improvement.

@DustinFisher DustinFisher requested a review from crmne June 25, 2025 15:18
@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.72%. Comparing base (f33e5d8) to head (066f622).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #250   +/-   ##
=======================================
  Coverage   89.72%   89.72%           
=======================================
  Files          75       75           
  Lines        2812     2812           
  Branches      555      556    +1     
=======================================
  Hits         2523     2523           
  Misses        289      289           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@crmne crmne merged commit 1212984 into crmne:main Jul 16, 2025
14 checks passed
parruda pushed a commit to parruda/ruby_llm that referenced this pull request Nov 18, 2025
crmne#250)

- Fix ArgumentError: wrong number of arguments (given 2, expected 0..1)
that occurs when Marcel processes URI objects
- Use filename-based MIME detection for URLs instead of passing URI
objects to Marcel
- Add test that reproduces the issue and validates the fix
- Maintains backward compatibility and improves performance by avoiding
network calls

<img width="1316" alt="Screenshot 2025-06-16 at 9 34 13 AM"
src="https://github.com/user-attachments/assets/b0d29eeb-66aa-45b5-aed9-5c33adf0c0b7"
/>

## What this does

<!-- Clear description of what this PR does and why -->

## Type of change

- [x] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation
- [ ] Performance improvement

## Scope check

- [x] I read the [Contributing
Guide](https://github.com/crmne/ruby_llm/blob/main/CONTRIBUTING.md)
- [x] This aligns with RubyLLM's focus on **LLM communication**
- [x] This isn't application-specific logic that belongs in user code
- [x] This benefits most users, not just my specific use case

## Quality check

- [x] I ran `overcommit --install` and all hooks pass
- [x] I tested my changes thoroughly
- [ ] I updated documentation if needed
- [x] I didn't modify auto-generated files manually (`models.json`,
`aliases.json`)

## API changes

- [ ] Breaking change
- [ ] New public methods/classes
- [ ] Changed method signatures
- [x] No API changes

## Related issues

Fixes crmne#247

---------

Co-authored-by: Carmine Paolino <carmine@paolino.me>
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.

[BUG] wrong number of arguments when passing files for ask method

2 participants