forked from crmne/ruby_llm
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] main from crmne:main #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pull
wants to merge
411
commits into
hemanth:main
Choose a base branch
from
crmne:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+118,283
−6,473
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replacing instructions for a chat with no prior instructions leads to `@messages` being assigned to `nil`. To prevent this from happening, use `reject` instead to ensure an array is always present. Here is an example of this error: ``` irb(main):007> chat = RubyLLM::Chat.new => #<RubyLLM::Chat:0x000000012bd30d70 ... irb(main):008> chat.with_instructions("You are a good assistant", replace: true) /opt/homebrew/lib/ruby/gems/3.4.0/gems/ruby_llm-1.3.0rc1/lib/ruby_llm/chat.rb:109:in 'RubyLLM::Chat#add_message': undefined method '<<' for nil (NoMethodError) messages << message ^^ from /opt/homebrew/lib/ruby/gems/3.4.0/gems/ruby_llm-1.3.0rc1/lib/ruby_llm/chat.rb:44:in 'RubyLLM::Chat#with_instructions' from (irb):8:in '<main>' from <internal:kernel>:168:in 'Kernel#loop' from /opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/gems/3.4.0/gems/irb-1.14.3/exe/irb:9:in '<top (required)>' from /opt/homebrew/opt/ruby/bin/irb:25:in 'Kernel#load' from /opt/homebrew/opt/ruby/bin/irb:25:in '<main>' irb(main):009> ``` Co-authored-by: Carmine Paolino <carmine@paolino.me>
…r error handling Closes #153
…nil and blank values
New extension to the API: Now you can pass a location and a mime_type if we're not able to determine the MIME type for the file from the extension. e.g. RubyLLM.chat.ask "what's this?", with: [{ location: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQzSCawxoHrVtf9AX-o7bp7KVxcmkYWzsIjng&s", mime_type: "image/jpeg" }] I also introduce a new MissingExtensionError for when we can't determine the MIME type and the user didn't provide one.
- Updated media.rb files for Anthropic, Bedrock, Gemini, Ollama, and OpenAI to use attachment types instead of classes for better clarity and maintainability. - Enhanced error handling to raise UnsupportedAttachmentError with attachment type. - Modified format_text_file_for_llm to include mime_type in the output. - Added 'marcel' gem dependency for improved file type detection. - Updated chat_content_spec to verify attachment filename and mime_type for various content types, ensuring accurate handling of remote and local files. - Removed redundant tests and improved error handling for missing extensions and bad URLs.
# Description In reference to issue: #172 - this CR exists to allow for applications requiring different, lower Faraday versions to integrate with this Gem. # Changes Made 1. Updated the gemspec for Faraday and its dependencies to allow use of lower versions in case of a conflict. 2. Updated CICD.yml workflow to validate that lower Faraday versions work. 3. Specs failed on lower Faraday versions so I updated `lib/ruby_llm/streaming.rb` to allow for legacy Faraday versions to stream responses as well. Could use feedback definitely in case this breaks logic in a way you all are uncomfy with. # Testing I ran manually rspec with Faraday Version 2.13.1 and 1.10.3, here are the results prior to CI/CD integration in this repo: | Faraday Version | Validate Gem Install | Test Results | |----------|:-------------:|------:| | 1.10.3 |  |  | | 2.13.1 |  |  |
implement proxy setup in Connection --------- Co-authored-by: jeff.dean <jeff.dean@kakaomobility.com> Co-authored-by: Carmine Paolino <carmine@paolino.me>
…ing a conversation
…rning behavior Closes #191
## What this does Hello, thanks for your work on this library This is my first contribution here. I think that adding RuboCop Performance plugin this can benefit on the long term Each offense has been fixed in an individual commit, with explanation and benchmarks, where possible. Some cops have been temporarily disabled because they can break API ## Type of change - [ ] Bug fix - [ ] New feature - [ ] Breaking change⚠️ ⚠️ ⚠️ **not at the best of my knowledge** - [ ] Documentation - [x] 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 - [x] ~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 <!-- Link issues: "Fixes #123" or "Related to #123" -->
Since we no longer gatekeep capabilities and let providers validate their own features, the logging about assuming model existence is unnecessary.
Tools can now return RubyLLM::Content objects with file attachments, allowing multimodal responses from tool executions. Previously tool results were always converted to strings.
…or proper content attachment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )