-
-
Notifications
You must be signed in to change notification settings - Fork 306
Add Chat#on_tool_call callback #299
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
Merged
Merged
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
This is useful when you want to show to the user tool calls as they are made, particularly when handling streamed output.
2e30ed7 to
bcce1d0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #299 +/- ##
==========================================
+ Coverage 86.62% 86.64% +0.01%
==========================================
Files 79 79
Lines 3125 3129 +4
Branches 612 613 +1
==========================================
+ Hits 2707 2711 +4
Misses 418 418 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
crmne
approved these changes
Jul 30, 2025
Owner
crmne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
17 tasks
crmne
pushed a commit
that referenced
this pull request
Aug 1, 2025
## What this does An `on_tool_call` callback was added in `1.4.0` via #299, but it doens't work with a model using the rails integration via `acts_as_chat`. This PR wires up the missing method so it works with the integration. ## 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 - [ ] ~I ran `overcommit --install` and all hooks pass~ - When I tried to commit the hooks generated a bunch of changes to `models.json` and `aliases.json` and broke a bunch of the specs, so I removed the hooks and ran specs and rubocop manually - [x] I tested my changes thoroughly - [x] I updated documentation if needed - No need - [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" -->
tpaulshippy
pushed a commit
to tpaulshippy/ruby_llm
that referenced
this pull request
Aug 3, 2025
## What this does This PR adds a new callback hook to `Chat` that sends information when a tool call is initiated by the model. This is useful when building a coding agent to show the user progress of interactions inline with streaming responses. ## Type of change - [ ] Bug fix - [x] 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 - this is beneficial to all users who want to show tool call indications to the user ## 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 - [x] New public methods/classes - [ ] Changed method signatures - [ ] No API changes ## Related issues N/A --------- Co-authored-by: Carmine Paolino <[email protected]>
tpaulshippy
pushed a commit
to tpaulshippy/ruby_llm
that referenced
this pull request
Aug 3, 2025
…#318) ## What this does An `on_tool_call` callback was added in `1.4.0` via crmne#299, but it doens't work with a model using the rails integration via `acts_as_chat`. This PR wires up the missing method so it works with the integration. ## 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 - [ ] ~I ran `overcommit --install` and all hooks pass~ - When I tried to commit the hooks generated a bunch of changes to `models.json` and `aliases.json` and broke a bunch of the specs, so I removed the hooks and ran specs and rubocop manually - [x] I tested my changes thoroughly - [x] I updated documentation if needed - No need - [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 crmne#123" or "Related to crmne#123" -->
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.
What this does
This PR adds a new callback hook to
Chatthat sends information when a tool call is initiated by the model. This is useful when building a coding agent to show the user progress of interactions inline with streaming responses.Type of change
Scope check
Quality check
overcommit --installand all hooks passmodels.json,aliases.json)API changes
Related issues
N/A