-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: allow tool calling to respond without a tool #2614
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
Conversation
7bd57e6
to
fcc822f
Compare
router/src/server.rs
Outdated
let event = Event::default(); | ||
yield Ok(event); |
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.
Why ? You're changing functionality here.
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.
great catch, Thanks. I've updated the logic to emit an event in both cases of a token or an error (to match the existing functionality).
d8ef7ac
to
7d2aa27
Compare
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.
Some fixes in _err
.
Remove send_function_name logic.
Add stream
test variant.
print(content_generated) | ||
assert ( | ||
content_generated | ||
== "There is no weather related function available to answer your prompt" |
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.
Odd answer to be honest.
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.
yea I agree, I think its because the model is technically responding to the error
field in the notify_error
tool, so the text is more of an error text than an actual response. Going to make a couple changes to see if I can minimize the issue
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
This PR is an improved version of #2597 and handles processing streaming responses as well as non streaming generations. This PR unrolls tool responses that do not select one of the user provided tools.
This implementation parses the first few tokens of generations requests with user provided tools to determine if a tool was selected. If no tool was selected the response is parsed and returned as a normal
content
value.This PR also supersedes draft PR #2606 as this approach has more benefits and less downsides