Files
langchain/libs/core/langchain_core
Sydney Runkle f942d79aec perf(core): cache tool openai-function JSON-char count
count_tokens_approximately was calling json.dumps(tool_dict) and throwing
away everything but the length on every invocation — even though the dict
returned by convert_to_openai_tool(tool) is stable for a given tool. Stash
the char count on the tool instance under _openai_function_chars (paired
with the _openai_function_dict schema cache from the previous commit).
BaseTool.__setattr__ pops both keys on mutation of args_schema / description
/ name so dynamic tool re-registration or in-place edits invalidate
correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 09:44:22 -04:00
..
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00
2026-01-23 23:07:48 -05:00