Improve tool call APIs #363
Merged
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.
Make changes to the tool call status reporting API so that:
toolCallId
is now available upon tool call request started (this is useful if one needs to use lmstudio-js as a OpenAI compatible endpoint proxy, as the toolCallId is required on the first fragment in OpenAI compatible endpoints.onToolCallRequestNameReceived
andonToolCallRequestArgumentFragmentGenerated
on both.act
and.respond
are now guaranteed to be called. If the underlying model doesn't support eager name reporting/arguments streaming, we will "fake" those events right beforeonToolCallRequestEnd
is called..respond
to add acallId
parameter, as there might be multiple calls even within just one "round" of prediction. This is breaking change but we will not bump the major version because all the affects APIs were explicitly marked asexperimental
.Fixes lmstudio-ai/lmstudio-bug-tracker#759 (LM Studio uses lmstudio.js internally)