-
Notifications
You must be signed in to change notification settings - Fork 16.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core[patch]: remove deprecated functions from tool binding hotpath (#…
…29015) (Inspired by #26918) We rely on some deprecated public functions in the hot path for tool binding (`convert_pydantic_to_openai_function`, `convert_python_function_to_openai_function`, and `format_tool_to_openai_function`). My understanding is that what is deprecated is not the functionality they implement, but use of them in the public API -- we expect to continue to rely on them. Here we update these functions to be private and not deprecated. We keep the public, deprecated functions as simple wrappers that can be safely deleted. The `@deprecated` wrapper adds considerable latency due to its use of the `inspect` module. This update speeds up `bind_tools` by a factor of ~100x: Before: ![Screenshot 2025-01-03 at 11 22 55 AM](https://github.com/user-attachments/assets/94b1c433-ce12-406f-b64c-ca7103badfe0) After: ![Screenshot 2025-01-03 at 11 23 41 AM](https://github.com/user-attachments/assets/02d0deab-82e4-45ca-8cc7-a20b91a5b5db) --------- Co-authored-by: Erick Friis <[email protected]>
- Loading branch information
Showing
1 changed file
with
32 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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