mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-31 03:59:25 +00:00
(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:  After:  --------- Co-authored-by: Erick Friis <erick@langchain.dev> |
||
---|---|---|
.. | ||
__init__.py | ||
_merge.py | ||
aiter.py | ||
env.py | ||
formatting.py | ||
function_calling.py | ||
html.py | ||
image.py | ||
input.py | ||
interactive_env.py | ||
iter.py | ||
json_schema.py | ||
json.py | ||
loading.py | ||
mustache.py | ||
pydantic.py | ||
strings.py | ||
usage.py | ||
utils.py |