langchain/libs/core/langchain_core
ccurme 4bb391fd4e
core[patch]: remove deprecated functions from tool binding hotpath (#29015)
(Inspired by https://github.com/langchain-ai/langchain/issues/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 <erick@langchain.dev>
2025-01-03 19:29:01 +00:00
..
_api core[patch]: fix deprecation admonition in API ref (#28992) 2025-01-02 14:37:55 -05:00
beta core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
callbacks [Core] respect tracing project name cvar (#28792) 2024-12-18 10:02:02 -08:00
document_loaders core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
documents core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
embeddings core: Add various ruff rules (#26836) 2024-10-07 22:30:27 +00:00
example_selectors core: Put Python version as a project requirement so it is considered by ruff (#26608) 2024-09-18 14:37:57 +00:00
indexing core[patch]: throw exception indexing code if deletion fails in vectorstore (#28103) 2024-12-13 16:14:27 -05:00
language_models core,anthropic[patch]: fix with_structured_output typing (#28950) 2024-12-28 15:46:51 -05:00
load partners: add xAI chat integration (#28032) 2024-11-12 15:11:29 -05:00
messages core[patch], openai[patch]: Handle OpenAI developer msg (#28794) 2024-12-18 21:54:07 +00:00
output_parsers core: xml output parser tags docstring (#28745) 2024-12-16 18:25:16 +00:00
outputs core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
prompts (Core) Small Change in Docstring for method partial for BasePromptTemplate (#28969) 2025-01-02 12:16:30 -05:00
pydantic_v1 multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
runnables core[patch]: remove redundant imports (#28861) 2024-12-23 10:31:23 -05:00
tools core: dont mutate tool_kwargs during tool run (#28824) 2024-12-19 18:11:56 +00:00
tracers [Core] respect tracing project name cvar (#28792) 2024-12-18 10:02:02 -08:00
utils core[patch]: remove deprecated functions from tool binding hotpath (#29015) 2025-01-03 19:29:01 +00:00
vectorstores core: add kwargs support to VectorStore (#25934) 2024-12-16 18:57:57 +00:00
__init__.py docs: udpated api reference (#25172) 2024-08-14 07:00:17 -07:00
agents.py multiple: update docs urls to latest 2 (#26837) 2024-09-30 17:37:07 -07:00
caches.py core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
chat_history.py core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
chat_loaders.py core: Put Python version as a project requirement so it is considered by ruff (#26608) 2024-09-18 14:37:57 +00:00
chat_sessions.py core: Put Python version as a project requirement so it is considered by ruff (#26608) 2024-09-18 14:37:57 +00:00
env.py core[patch]: docstrings langchain_core/ files update (#24285) 2024-07-16 09:21:51 -04:00
exceptions.py core: add space at end of error message link (#28270) 2024-11-21 22:19:59 +00:00
globals.py core[patch]: Fix word spelling error in globals.py (#24532) 2024-07-23 14:27:16 +00:00
memory.py core/langchain: fix version used in deprecation (#26724) 2024-09-20 16:47:18 -04:00
prompt_values.py core: Put Python version as a project requirement so it is considered by ruff (#26608) 2024-09-18 14:37:57 +00:00
py.typed core[minor], langchain[patch], experimental[patch]: Added missing py.typed to langchain_core (#14143) 2023-12-01 19:15:23 -08:00
rate_limiters.py core[patch]: Ignore ASYNC110 to upgrade to newest ruff version (#27229) 2024-10-09 11:25:58 -04:00
retrievers.py core, tests: more tolerant _aget_relevant_documents function (#28462) 2024-12-06 00:49:30 +00:00
stores.py core[patch]: Add ruff rules for flake8-simplify (SIM) (#26848) 2024-09-27 20:13:23 +00:00
structured_query.py core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
sys_info.py core[minor]: Add other langgraph packages to sys_info (#28190) 2024-11-19 09:20:25 -05:00