fix: introduce create_tools_json() and share it with chat_completions.rs
#1177
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.
The main motivator behind this PR is that
stream_chat_completions()was not adding the"tools"entry to the payload posted to the/chat/completionsendpoint. This (1) refactors the existing logic to build up the"tools"JSON fromclient.rsintoopenai_tools.rs, and (2) updates the use of responses API (client.rs) and chat completions API (chat_completions.rs) to both use it.Note this PR alone is not sufficient to get tool calling from chat completions working: that is done in #1167.
Stack created with Sapling. Best reviewed with ReviewStack.
create_tools_json()and share it with chat_completions.rs #1177